Page 1 of 1

Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 21:42
by FanM
Hi there!
Please help me, i cannot to do the simple thing.
I have ds18b20 connected to D2. I need just to access to my esp8266 with espeasy and get temperature from that sensor. Have no idea how to do that.
http://<ESP IP address>/control?cmd sends commands, but there is no information how to get an info from sensor.

And one more thing. There is a lot of controllers, but they all send information in localhost servers that i need to install by myself on some server in my network.
But how to send the info from my ds18b20 that i can see from any place? Any public server i can use?
Just like it was with blynk app (now it is commerscial).

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 21:58
by Ath
Depends on how you want to use the data from ESP, as it is also available in json format, or csv, from the /json and /csv paths on your ESPEasy unit.

Controllers can be configured to use any IP address or hostname, its just that HTTPS is not supported (yet).
There are MQTT servers available for free where you can send your data and view it online. Not using that, so no examples, sorry.
For these external servers you'll have to increase the client timeout from 100 msec to at least 1000 msec, and maybe even a higher value.

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 22:15
by FanM
Thanks!
I have a ds18b20 that shows temperature in my oven (heater). I need to check it by opening a link. json have that info, but there is a lot of additional info that i do not need. I need just to see the temperature.
By the way, /csv is not working. result: ERROR: TaskNr not valid!

About controllers i get it. But i need a solution then. I have a php server that can get a request and put temp info in my mysql table, that is not a problem. I know what to do next.
How to configure the rule to send that info?
I need to use something like:
SendToHTTP sitename.com,80,/sensors/?ID=123&Temperature=
What should i put in "Temperature="? Where can i get the value i need to send?
And how the rule should looks like to send an info, for example, once in 1 minute?

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 22:35
by chromo23
Maybe easyfetch is something for you.
(Follow the link in my signature)

If you need the data outside the LAN i can recommend thingspeak (https://thingspeak.com/)

Edit:

thingspeak example:

Code: Select all

   SendToHTTP,api.thingspeak.com,80,/update?api_key=XXXXXXXXXXXXXXX&field1=[sensor#Temperature]&field2=[sensor#Humidity]

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 22:47
by chromo23
FanM wrote: 07 Oct 2023, 22:15 And how the rule should looks like to send an info, for example, once in 1 minute?

1. possibility Loop timer (https://espeasy.readthedocs.io/en/lates ... imer#timer)

Code: Select all

On System#Boot Do
  LoopTimerSet,1,60 // set loop timer #1 to 60 seconds
Endon

On Rules#Timer=1 Do
  SendToHTTP,api.thingspeak.com,80,/update?api_key=XXXXXXXXXXXXXXX&field1=[sensor#Temperature]&field2=[sensor#Humidity]
Endon
2. possibility "Clock#Time" event (https://espeasy.readthedocs.io/en/lates ... 3DAll#time)

Code: Select all

On Clock#Time=All,**:**
  SendToHTTP,api.thingspeak.com,80,/update?api_key=XXXXXXXXXXXXXXX&field1=[sensor#Temperature]&field2=[sensor#Humidity]
Endon

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 22:50
by TD-er
The /csv url needs some parameters.
See: https://espeasy.readthedocs.io/en/lates ... ht=csv#csv

You can also fetch such info from the /json url (same page in the documentation).
That's also what cromo23 uses for his ESPEasyFetch.

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 22:52
by chromo23
FanM wrote: 07 Oct 2023, 22:15 SendToHTTP sitename.com,80,/sensors/?ID=123&Temperature=
What should i put in "Temperature="? Where can i get the value i need to send?
SendToHTTP sitename.com,80,/sensors/?ID=123&Temperature=[NAME_OF_THE_DEVICE#VALUE_NAME]

e.g.:

Code: Select all

SendToHTTP sitename.com,80,/sensors/?ID=123&Temperature=[sensor#Temperature]

Re: Display temp from my ds18b20 in browser

Posted: 07 Oct 2023, 23:04
by FanM
chromo23 wrote: 07 Oct 2023, 22:35 Maybe easyfetch is something for you.
(Follow the link in my signature)
That is awesome, parsing the data from json by javascript. That is brilliant!
Thank you very much, that will work. I will edit html for my needs.

And thanks for rules, i will try it for thingspeak and for my php server.

Thanks again!!!!!!!!!