Display temp from my ds18b20 in browser

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
FanM
Normal user
Posts: 35
Joined: 07 Sep 2021, 23:37

Display temp from my ds18b20 in browser

#1 Post by FanM » 07 Oct 2023, 21:42

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).

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Display temp from my ds18b20 in browser

#2 Post by Ath » 07 Oct 2023, 21:58

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.
/Ton (PayPal.me)

FanM
Normal user
Posts: 35
Joined: 07 Sep 2021, 23:37

Re: Display temp from my ds18b20 in browser

#3 Post by FanM » 07 Oct 2023, 22:15

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?

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Display temp from my ds18b20 in browser

#4 Post by chromo23 » 07 Oct 2023, 22:35

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]

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Display temp from my ds18b20 in browser

#5 Post by chromo23 » 07 Oct 2023, 22:47

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

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Display temp from my ds18b20 in browser

#6 Post by TD-er » 07 Oct 2023, 22:50

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.

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Display temp from my ds18b20 in browser

#7 Post by chromo23 » 07 Oct 2023, 22:52

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]

FanM
Normal user
Posts: 35
Joined: 07 Sep 2021, 23:37

Re: Display temp from my ds18b20 in browser

#8 Post by FanM » 07 Oct 2023, 23:04

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!!!!!!!!!

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 30 guests