Custom block

Post Reply
User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Custom block

Post by gillesroszak » Sun Oct 15, 2017 12:28 pm

HI guys,
Being a real noob in coding, i need your help for building a custom block.
I have a nodemcu esp8266 who collecting data from T° sensors DS18B20 and send them to thnigspeak who makes graph
I would like to include this graph (iframe) thingspeak to a blank block but I have no idea how to do it !!!!!

Thanks for your reply
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Sun Oct 15, 2017 12:40 pm

Gilles a block with an iframe is likely to look quite bad because it will be small and slowing your page down. I would say try to avoid iframes as much as possible, especially in blocks

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 11:17 am

Hi Jachym,
thanks for your reply.
May be there is another way to go ??
Thingspeak provide an API request code, see below :

GRT channel feed :

Code: Select all

GET https://api.thingspeak.com/channels/343953/feeds.json?api_key=......&results=2
Or GET channel field :

Code: Select all

GET https://api.thingspeak.com/channels/343953/fields/1.json?api_key=....&results=2
Can we do something with it
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Mon Oct 16, 2017 11:37 am

Yes, that would be much easier, parse the JSON file and then display it in the block much better solution then Iframe.

I edited your post and deleted the API keys from the URL

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 11:48 am

thanks, for deleting the API key jachym

Can you help me or tell me where i can found some tutorial or explanation to do it please.
it seems to difficult for me
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Mon Oct 16, 2017 12:05 pm

gillesroszak wrote: Mon Oct 16, 2017 11:48 am thanks, for deleting the API key jachym

Can you help me or tell me where i can found some tutorial or explanation to do it please.
it seems to difficult for me
It depends what information from the API result you want.

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 1:41 pm

there will be 2 data series, (soil T° 10 cm and 20 cm) i just want to display the current T° so the last data
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Mon Oct 16, 2017 2:53 pm

OK, email me the URL with the full API key so that I can look at it and I will send you the customized block by email as well

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 3:18 pm

Ok done it

Thanks
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Mon Oct 16, 2017 5:41 pm

I sent you the working block.

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 5:46 pm

yes but it does not update ???
What can be the problem ?
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Mon Oct 16, 2017 5:49 pm

It is cached, if you want to change the cache time

go to the script and modify the number:

if (time()-filemtime("cache/data.txt") > 60 * 30) {

in minutes

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 5:55 pm

OK if I want an update every 10 mn what should i write ?

Very sorry Jachym but ......
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Custom block

Post by Jachym » Mon Oct 16, 2017 5:57 pm

gillesroszak wrote: Mon Oct 16, 2017 5:55 pm OK if I want an update every 10 mn what should i write ?

Very sorry Jachym but ......
Change 30 to 10:

60 * 10

User avatar
gillesroszak
Forecaster
Forecaster
Posts: 100
Joined: Sun Aug 20, 2017 1:03 pm
Location: Kerbach
Station model: Aercus Weather ranger
Software: WeeWx on Rpi 0W
Contact:

Re: Custom block

Post by gillesroszak » Mon Oct 16, 2017 6:10 pm

Thanks
Gilles


http://www.meteokerbach.fr
Aercus Weather Ranger And WeeWx

Image

Post Reply