I have this sketch working: http://harizanov.com/2014/11/esp8266-po ... r-reading/
Reads out a DHT22 temperature + humidity sensor and displays data on a webpage that is hosted by the ESP8266. Quite nice i must say!
But ofcourse i want the data in Domoticz, so i created this script:
#!/bin/bash
# This script retrieves the temperature and humidity from the webpage
# generated by the code running on ESP8266 that is posted here
# http://harizanov.com/2014/11/esp8266-powered-web-server-led-control-dht22-temperaturehumidity-sensor-reading/
# Fill in variables
ESP_IP="192.168.4.248"
DOMO_IP="192.168.4.4"
DOMO_PORT="8084"
DOMO_IDX="121"
# Retrieve webpage and strip out relevant information and put information (position 13 & 16) into two variables (temp, hum)
curl -s http://$ESP_IP/dht22.tpl | grep "reading is" | awk '{print $13, $16;}' | sed 's/*C,//g' | while read temp hum
do
if awk "BEGIN {exit $hum <= 25 ? 0 : 1}"
then
#echo "Dry"
hum_status="2"
elif awk "BEGIN {exit $hum > 60 ? 0 : 1}"
then
#echo "Wet"
hum_status="3"
elif awk "BEGIN {exit (($hum >= 25)&&($hum <= 60)) ? 0 : 1}"
then
#echo "Comfortable"
hum_status="1"
else
#echo "Normal"
hum_status='0'
fi
# Send data to virtual sensor in Domoticz ("Temp + Humidity").
OUTPUT=`curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$DOMO_IDX&nvalue=0&svalue=$temp;$hum;$hum_status"`
done
I'm going to put this in my cron to run every minute.
Seems to work, but comments about improvements that can be made are always welcome. The humidity status (when is it 'comfortable', 'wet' etc) is based on a piece of Domoticz code: https://github.com/contactless/domoticz ... XNames.cpp
ThinkPad wrote:I have this sketch working: http://harizanov.com/2014/11/esp8266-po ... r-reading/
Reads out a DHT22 temperature + humidity sensor and displays data on a webpage that is hosted by the ESP8266. Quite nice i must say!
But ofcourse i want the data in Domoticz, so i created this script:
#!/bin/bash
# This script retrieves the temperature and humidity from the webpage
# generated by the code running on ESP8266 that is posted here
# http://harizanov.com/2014/11/esp8266-powered-web-server-led-control-dht22-temperaturehumidity-sensor-reading/
# Fill in variables
ESP_IP="192.168.4.248"
DOMO_IP="192.168.4.4"
DOMO_PORT="8084"
DOMO_IDX="121"
# Retrieve webpage and strip out relevant information and put information (position 13 & 16) into two variables (temp, hum)
curl -s http://$ESP_IP/dht22.tpl | grep "reading is" | awk '{print $13, $16;}' | sed 's/*C,//g' | while read temp hum
do
if awk "BEGIN {exit $hum <= 25 ? 0 : 1}"
then
#echo "Dry"
hum_status="2"
elif awk "BEGIN {exit $hum > 60 ? 0 : 1}"
then
#echo "Wet"
hum_status="3"
elif awk "BEGIN {exit (($hum >= 25)&&($hum <= 60)) ? 0 : 1}"
then
#echo "Comfortable"
hum_status="1"
else
#echo "Normal"
hum_status='0'
fi
# Send data to virtual sensor in Domoticz ("Temp + Humidity").
OUTPUT=`curl -s "http://$DOMO_IP:$DOMO_PORT/json.htm?type=command¶m=udevice&idx=$DOMO_IDX&nvalue=0&svalue=$temp;$hum;$hum_status"`
done
I'm going to put this in my cron to run every minute.
Seems to work, but comments about improvements that can be made are always welcome. The humidity status (when is it 'comfortable', 'wet' etc) is based on a piece of Domoticz code: https://github.com/contactless/domoticz ... XNames.cpp
Nice done!
I had seen this project to and thought how do I get the data in Domoticz without a http possibility this is a creative solution! I am going to try it this weekend.
Nice, let me hear your results.
The temperature/humidity scraping part works fine, but i am not sure about the part that translates a humidity level to a state ('Comfortable', 'Wet').
ThinkPad wrote:Nice, let me hear your results.
The temperature/humidity scraping part works fine, but i am not sure about the part that translates a humidity level to a state ('Comfortable', 'Wet').
bdw, is it not possible to send the update values from the ESP module directly to domoticz ?
I think i have read somewhere that you can use it in combination with 'MySensors' ?
Like making one gateway that receives updates from all node/childs ?
And able to send commands back from the gateway to the ESP (to control a light switch for example)
Sure you do not want to poll/control 20 of these things via scripts?
bdw, is it not possible to send the update values from the ESP module directly to domoticz ?
I think i have read somewhere that you can use it in combination with 'MySensors' ?
Like making one gateway that receives updates from all node/childs ?
And able to send commands back from the gateway to the ESP (to control a light switch for example)
That would definitely be the way to go,
that way you could also let the device enter deep sleep to conserver power between updates
and it would probably possible to run of a battery for a long time
Domoticz stable on a Raspberry Pi 3
RFXtrx433E - RFLink - Smartmeter (through RasPi-Zero-W) - Hue - BMP180 - DHT22 - Wemos D1 Mini's with PIR
MySensors project is much better than ESP8266 if you are aiming at a low power consumption. My script (including the dry/wet/comfortable status) seems to work fine i must say.
It only seems the DHT22 warms up or so, the reading is not accurate anymore (1 degree too high) after a few days of 24/7 usage.
This is really basic firmware for the ESP that creates a totally transparent TCP socket to ESP UART0 bridge. Characters come in on one interface and go out the other.
Do you already have a serial project to which you just want to add WiFi? This is your ticket. No more dealing with the AT command set.
I think when i connect the ESP8266 to my smartmeter' P1-port, i can install something like ser2net and have a wireless smart meter ?
Something to try soon
Anybody tried this already ? Got a few esp8266 incoming
This is really basic firmware for the ESP that creates a totally transparent TCP socket to ESP UART0 bridge. Characters come in on one interface and go out the other.
Do you already have a serial project to which you just want to add WiFi? This is your ticket. No more dealing with the AT command set.
I think when i connect the ESP8266 to my smartmeter' P1-port, i can install something like ser2net and have a wireless smart meter ?
Something to try soon
Anybody tried this already ? Got a few esp8266 incoming
I don't know if it would work the right way round.
When reading the description, it looks like it is from wifi --> serial, not serial --> wifi like we would need. But maybe it works, i haven't tried it.
I have the board
I have the ide for arduino with loaded espaeasy.
I have sensors
I now how to compile and upload, to the board.
I do not how i set the boards in to the upload mode..
I mis the driver [ s]
I run windows 8.
And for my help a sample sketch for espeasy give me a smile...
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
I have the board
I have the ide for arduino with loaded espaeasy.
I have sensors
I now how to compile and upload, to the board.
I do not how i set the boards in to the upload mode..
I mis the driver [ s]
I run windows 8.
And for my help a sample sketch for espeasy give me a smile...
As far as i know, many of these cheap chinese development boards use the ESP8266 only for Wifi and have a different chip to do the IO and other stuff. It can be hard to find schematics from these boards, but i've found one for a similar board. As you can see on that board, there's an STC 15L2K16S MCU that does the IO and other stuff. The ESP is only connected with this chip through the serial interface. So in order to change its prebuild function, you would need to reprogram the STC chip. I guess that the ESP is running stock AT firmware.
Your board is different but may also have a STC MCU... Try to find the schematics. It if has an STC MCU chip, running the ESP Easy firmware will likely not work with the onboard DHT11 etc, because they are not connected on the PCB to the ESP module.
What board od you have?
And what driver you did install?
And the line you mean is the for the install of the esp. [ that is n problem.]
And how do you get the board in upload mode?
I've uploaded the sketch to this NodeMcu board : link
This board has a CH340G chip for the usb connection.
Don't know if i ever downloaded a driver for it (already have arduino boards with same chip for a while)