Read temperature via web command on D1 with SHT30 installed
Moderators: grovkillen, Stuntteam, TD-er
Read temperature via web command on D1 with SHT30 installed
I am running several D1's with the latest nightly build and SHT30's onboard. I need send an HTTP command that will read the temperature... How in the world do I do that?
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Read temperature via web command on D1 with SHT30 installed
Please explain more.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Read temperature via web command on D1 with SHT30 installed
I have placed a few of these in network closets for testing at work. The problem is, traditional network monitors do not use MQTT and ESP's do not use SNMP and I need to get the data from the devices. If I can ask the device a question via HTTP that responds with a simple numerical answer, I can directly import that value. I would likely ask the device every minute or so, but not likely an more frequently than that.
I had hoped to use the control?cmd/status for it, but it does not appear to provide more than a question mark for the answer. I could ask for /json, but that is very difficult to break down and out in a probe. Unless I can ask for a very specific variable with an extension to the json command.
I had hoped to use the control?cmd/status for it, but it does not appear to provide more than a question mark for the answer. I could ask for /json, but that is very difficult to break down and out in a probe. Unless I can ask for a very specific variable with an extension to the json command.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Read temperature via web command on D1 with SHT30 installed
You can filter the JSON request but not down to a single value. I guess it could be useful. Please open a new feature request on GitHub.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
-
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
Re: Read temperature via web command on D1 with SHT30 installed
How about this:
make an Event in Rules
Event contains a SendToHTTP with the temperature
Someting like (example to Domoticz):
Call that Event from outside
make an Event in Rules
Event contains a SendToHTTP with the temperature
Someting like (example to Domoticz):
Code: Select all
on testevent do
SendToHTTP,x.x.x.x,8080,/json.htm?type=command¶m=udevice&idx=385&nvalue=0&svalue=[SHT30#Temperature]
endon
Code: Select all
http://x.x.x.x/control?cmd=event,testevent
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
Re: Read temperature via web command on D1 with SHT30 installed
I can't run software or remote commands on the system that does the monitoring. I really just need the ESP to generate a web page with the numerical temperature.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Read temperature via web command on D1 with SHT30 installed
Please, open a feature request on GitHub.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Read temperature via web command on D1 with SHT30 installed
FanOfHue is developing a plugin that might solve your problem.I really just need the ESP to generate a web page with the numerical temperature.
See viewtopic.php?f=6&t=6098&p=33332
- Thomas
Re: Read temperature via web command on D1 with SHT30 installed
Just an idea how to solve your task instantly.
Assuming you have a webserver running on your monitoring system just place a small php-script named survey.php on it:
Define the webserver as Generic HTTP Controller in ESPEasy with Controller Publish "survey.php?value=%value%&ID=%unit%", enable the controller in device settings.
The php script will generate a neat small individual webpage containing date, time and value of each of your different devices named "TemperatureXY.html" (XY=unit no. of the device). On your monitoring system you're now able to call the individual pages using "http://localhost/TemperatureXY.html".
Assuming you have a webserver running on your monitoring system just place a small php-script named survey.php on it:
Code: Select all
<?php
isset($_GET['value']) ? $value=$_GET['value'] : $value='';
isset($_GET['ID']) ? $ID=$_GET['ID'] : $ID='';
$now = time();
$date = date("d.m.Y", $now);
$time = date("H:i:s", $now);
$page = "Temperature".$ID.".html";
$handle = fopen($page, 'w');
fwrite($handle,"<html>");
fwrite($handle,"<body>");
fwrite($handle,"<p>".$date."</p>");
fwrite($handle,"<p>".$time."</p>");
fwrite($handle,"<p>".$value."</p>");
fwrite($handle,"</body>");
fwrite($handle,"</html>");
fclose($handle);
?>
The php script will generate a neat small individual webpage containing date, time and value of each of your different devices named "TemperatureXY.html" (XY=unit no. of the device). On your monitoring system you're now able to call the individual pages using "http://localhost/TemperatureXY.html".
Code: Select all
pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $
Re: Read temperature via web command on D1 with SHT30 installed
Do not forget the custom web pages.
Just upload an .htm file (http://ip_of_your_device/upload) that returns just the value you want and then call that file within your call url e.g. :
http://<ip of you device/return1.htm
-D
Just upload an .htm file (http://ip_of_your_device/upload) that returns just the value you want and then call that file within your call url e.g. :
http://<ip of you device/return1.htm
-D
-D
Re: Read temperature via web command on D1 with SHT30 installed
Interesting. I didn't read about this possibility anything. Do you have some links for documentation?
Code: Select all
pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $
Re: Read temperature via web command on D1 with SHT30 installed
https://www.letscontrolit.com/wiki/inde ... _Dashboard
but all you have to do is upload your own .htm file that posts the value you wish as a response. and then call that url. That's all.
If you extend your file as .esp the system will be doing some parsing as in the example in the link.
if you extend it as .htm there will be no parsing.
Whichever works the best for you.
-D
-D
Re: Read temperature via web command on D1 with SHT30 installed
Wow, that's cute.
Thank you for this information. I think this is exactly what mattlward was looking for - and at least, me, too.
Thank you for this information. I think this is exactly what mattlward was looking for - and at least, me, too.
Code: Select all
pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $
Who is online
Users browsing this forum: No registered users and 42 guests