Page 5 of 5

Re: ESP made easy

Posted: Friday 19 August 2016 11:07
by Derik
xl15 wrote:But it seems to me that it is the dummy switch that has the lag/delay?
Do not look @ the browser.
Just llok @ the time's
And when you have working hardware..... it will be great software!!!!
Be careful addictive stuff !!!! :D :D :lol: :lol:

Re: ESP made easy

Posted: Friday 19 August 2016 11:27
by trixwood
The web interface is somewhat delayed and not real time,... so timing it with your tv timer is kinda measuring how long it takes for the interface to update the values on your screen, not how long it actually took to switch. To see that look in your log file.

Re: ESP made easy

Posted: Friday 19 August 2016 11:37
by xl15
OK. Sounds promising guys! Thanks.
The log looks good, no delay (same as "Last seen").

Re: ESP made easy

Posted: Monday 22 August 2016 9:32
by xl15
Now the ESP8266 turns on a LED connected to the NodeMCU.
Much better :)


Re: ESP made easy

Posted: Friday 21 October 2016 16:24
by Ingmar
I would like to make a counter for the toilet, to keep track of how often we flush the toilet (and how much water we use with that). I was thinking about mounting a simple switch to the toilet flush button, which is connected to a Wemos/NodeMCU device which can pass it on to Domoticz that would need to sum it up per day and calculate the amount of water used. Even better is to have 2 switches; one for the big flush and one for the small flush.

But I can't figure out how to get it working... what kind of decive do I need to set up in ESP easy anyway? Who can help :?:

Re: ESP made easy

Posted: Friday 21 October 2016 16:44
by Derik
Ingmar wrote:I would like to make a counter for the toilet, to keep track of how often we flush the toilet (and how much water we use with that). I was thinking about mounting a simple switch to the toilet flush button, which is connected to a Wemos/NodeMCU device which can pass it on to Domoticz that would need to sum it up per day and calculate the amount of water used. Even better is to have 2 switches; one for the big flush and one for the small flush.

But I can't figure out how to get it working... what kind of decive do I need to set up in ESP easy anyway? Who can help :?:

Perhaps by a cheap watermeter:
https://www.wildkamp.nl/Watermeter-type ... oCRyLw_wcB
Built a sensor on it...
http://www.esp8266.nu/index.php/IR
Or perhaps a:
http://www.ebay.com/itm/Arduino-Infrare ... 2078387314
If theat one is working


And build a contact @ the button..
You can count the water and you can count the times flush..

all this with 1 esp..
And you can switch also a motion to so you light is off and on'
And perhaps the temp in the room..

Re: ESP made easy

Posted: Friday 21 October 2016 20:40
by niwreg
Maybe somebody here can help me, i flashed ESP easy on an ESP-1, but i can't get through setup to connect to my SSID

there are weird characters behind it (and it is a long SSID with spaces) tried manual and select from the list. But i do get redirected to the setup page all the time.

Re: ESP made easy

Posted: Friday 21 October 2016 21:41
by Ingmar
Derik wrote:
Ingmar wrote: I was thinking about mounting a simple switch to the toilet flush button, which is connected to a Wemos/NodeMCU device which can pass it on to Domoticz that would need to sum it up per day. Even better is to have 2 switches; one for the big flush and one for the small flush.

But I can't figure out how to get it working... what kind of decive do I need to set up in ESP easy anyway? Who can help :?:

Perhaps by a cheap watermeter:
https://www.wildkamp.nl/Watermeter-type ... oCRyLw_wcB
Built a sensor on it...
http://www.esp8266.nu/index.php/IR
Or perhaps a:
http://www.ebay.com/itm/Arduino-Infrare ... 2078387314
If theat one is working


And build a contact @ the button..
You can count the water and you can count the times flush..

all this with 1 esp..
And you can switch also a motion to so you light is off and on'
And perhaps the temp in the room..
Thnx for the reply. I just want to know what kind of device i need to choose from the list in the configuration screen of the espeasy firmware, so that it will send a signal to Domoticz. Then Domoticz needs to count how many times the toilet button has been pressed. How do I do that? Is that some kind of counter?

Re: ESP made easy

Posted: Saturday 22 October 2016 21:50
by Derik
set your ESP in Domoticz mode....
Then make a dumy switch of the type device you need, counter or switch etc. [ write your IDX ]
The choose the type of sensor in the ESP.
Set the idx save..
reboot.

And look in Domoticz

Re: ESP made easy

Posted: Friday 28 October 2016 9:37
by xl15
Regarding the water use I think it's very inaccurate to use "times flushed". Sometimes you hold the button pressed longer etc. A water meter on the inlet to the toilet is much better. If it's just the amount of water that is interesting that is.
Havn't tried it myself, but Espeasy has water meter as a standard device.
Also the hardware will be easier without mounting switches behind/under the flush buttons.

Something like this?
http://www.ebay.com/itm/G1-2-Water-Flow ... Sw-itXwglR

Re: ESP made easy

Posted: Wednesday 02 November 2016 14:26
by Mazzokun
Hi all! I'm new with ESP. I flashed 3 Sonoff switch with ESP EASY and I'm using MQTT to control them with virtual switch in Domoticz.
Works well but if I put on switch, then pull off AC power from Esp, pull on AC power to ESP, and last turn back into domoticz I see the light on.. but the real lamp is off..
Is there a way to send the status of the switch to domoticz at boot time? Or a way to send the status of the switch to domoticz every X time?
Because if i Use HTTP Domoticz setting there is an option to send to domoticz the status of the switch but Http requests are very slow compared to MQTT.
Thank you, I know I'm a NOOB :oops:

Re: ESP made easy

Posted: Tuesday 21 February 2017 17:02
by Toulon7559
Fiddling with ESP8266 (type Wemos D1) with OLED-shield (SS1306, showing 6 lines of 8 characters).
Earlier in this thread some discussion, but trying the examples was not successful.

Looking at the examples mentioned above and at my own 'inventory' of lua-scripts, I compiled the following script for experimentation with upload of info from Domoticz to the OLED of the ESP8266 running ESPEasy R146M.
This 'test-script' has 3 comparable sections, dealing with Temp, Humidity, PV-Production and Consumption, each with related UploadURL(s).
After test you might split this 'test-script' into 4 small, separate, dedicated scripts (for each of the lines 3, 4, 5 and 6 on the OLED), or you must do something clever with the commandArray to run more than 1 UploadURL from this script: hint appreciated.
Probably the script could be considerably shrinked, but ;-) during experimentation some 'simple, stepwise setup with abundant comment&check lines' aids in debugging.

Code: Select all

-- Lua-script for info-upload to ESP8266 with OLED SS1306
-- (c)2017 Toulon7559 rev. 01 [but you are free to adapt the script for personal use]

-- Line 04 = Definition of function(s) and Setting of references
function round(num, dec)
   if num == 0 then
     return 0
   else
     local mult = 10^(dec or 0)
     return math.floor(num * mult + 0.5) / mult
   end
end

baseurl = "http://192.168.0.131/control?cmd=oled"

-- Line 16 = Call Meteo-info from Domoticz-database
Binnen_Temp_RV_Baro = 'WS7000_Temp_RV_Baro'
sTemp, sRV, sComfort, sBaro = otherdevices_svalues[Binnen_Temp_RV_Baro]:match("([^;]+);([^;]+);([^;]+);([^;]+)")
sTemp = round(tonumber(sTemp),1);
print ('Temp = '.. sTemp)
sRV = round(tonumber(sRV),1);
print ('RV = '.. sRV)
sComfort = tonumber(sComfort);
print ('Comfort = '.. sComfort)
sBaro = tonumber(sBaro);
print ('Baro = '.. sBaro)

UploadURL0A = baseurl .. ",3,1,T=".. sTemp .."C" 
UploadURL0B = baseurl .. ",4,1,V=".. sRV .."%"
print (UploadURL0A)
print (UploadURL0B)

-- Line 33 = Call Production-info from Domoticz-database
Production = 'PVO_Generation_A7'
sPwr1, sEnergy1 = otherdevices_svalues[Production]:match("([^;]+);([^;]+)")
sPwr1 = round(tonumber(sPwr1),0);
print ('Pwr1 = '.. sPwr1)
sEnergy1 = round(tonumber(sEnergy1),0);
print ('Energy1 = '.. sEnergy1)

UploadURL1 = baseurl .. ",5,1,PV=".. sPwr1 .."W" 
print (UploadURL1)

-- Line 44 = Call Consumption-info from Domoticz-database
Consumption = 'PVO_Consumption_A7'
sPwr2, sEnergy2 = otherdevices_svalues[Consumption]:match("([^;]+);([^;]+)")
sPwr2 = round(tonumber(sPwr2),0);
print ('Pwr2 = '.. sPwr2)
sEnergy2 = round(tonumber(sEnergy2),0);
print ('Energy2 = '.. sEnergy2)

UploadURL2 = baseurl .. ",6,1,In=".. sPwr2 .."W"
print (UploadURL2)

-- Line 55 = Perform upload
commandArray = {}

commandArray['OpenURL']= UploadURL0A
-- commandArray['OpenURL']= UploadURL0B
-- commandArray['OpenURL']= UploadURL1
-- commandArray['OpenURL']= UploadURL2

return commandArray
This script fills the lines of the OLED at choice for lines 3, 4, 5 and 6, but further improvement is certainly possible, as described below.

Note1:
Experience with this script is that no spaces are allowed in the UploadURLs in the segments between ""
If you insert a space in such segment, then (starting with the space) no further info is displayed.
This in contrary to running such a line from the inputline of a browser: then a space is accepted.
Adding leading zeroes is a solution also providing a fixed length filling of the OLED-line.
Could be realised (e.g. for PV-production) by addition of following simple "if-then"-code-lines.

Code: Select all

if sPwr1 > 999 then
   UploadURL1 = baseurl .. ",5,1,PV=".. sPwr1 .."W"
   else UploadURL1 = baseurl .. ",5,1,PV=0".. sPwr1 .."W" 
end
if sPwr1 <100 then
   UploadURL1 = baseurl .. ",5,1,PV=00".. sPwr1 .."W"
end
if sPwr1 <10 then
   UploadURL1 = baseurl .. ",5,1,PV=000".. sPwr1 .."W"
end
Also slight problem for nil-value-input for PV (as happening at night): with this script you get an error-report related to 'empty' variable num.
Subtle difference with a 0-value-input, which is happily accepted.
Note2:
According to the printoutputs the script is OK, see below a log-extract from Domoticz

Code: Select all

 2017-02-22 19:55:00.438 LUA: Temp = 20.8
2017-02-22 19:55:00.438 LUA: RV = 48
2017-02-22 19:55:00.438 LUA: Comfort = 1
2017-02-22 19:55:00.438 LUA: Baro = 1000
2017-02-22 19:55:00.438 LUA: http://192.168.0.131/control?cmd=oled,3,1,T=20.8C
2017-02-22 19:55:00.438 LUA: http://192.168.0.131/control?cmd=oled,4,1,V=48%
2017-02-22 19:55:00.438 LUA: Pwr1 = 0
2017-02-22 19:55:00.438 LUA: Energy1 = 14812156
2017-02-22 19:55:00.438 LUA: http://192.168.0.131/control?cmd=oled,5,1,PV=0W
2017-02-22 19:55:00.438 LUA: Pwr2 = 432
2017-02-22 19:55:00.439 LUA: Energy2 = 37099768
2017-02-22 19:55:00.439 LUA: http://192.168.0.131/control?cmd=oled,6,1,In=432W
2017-02-22 19:55:00.439 EventSystem: Fetching url...
2017-02-22 19:55:00.439 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_time_ESP8266F_upload01.lua 
The info from the UploadURL appears at the OLED, but nevertheless you get an error report in the log

Code: Select all

2017-02-22 19:55:00.751 Error: Error opening url: http://192.168.0.131/control?cmd=oled,3,1,T=20.8C
;-) Puzzles remain ............

Re: ESP made easy

Posted: Friday 03 March 2017 14:41
by Ewaldharmsen
I use sonoff together with ESP Easy, it works great!

But I want to check out the return code when I switch a device.
Does anybody know how read the return message from ESP Easy when I send this command?:

Code: Select all

http://192.168.0.113/control?cmd=GPIO,12,1

Re: ESP made easy

Posted: Wednesday 05 April 2017 20:33
by Eawo
Hello I've bought 5 sonoff and installed espeasy on them. And I have used this guide: https://www.letscontrolit.com/wiki/inde ... icz_Switch
Everything is working but I had to add this in domoticz to get it working '' http://192.168.0.100/control?cmd=GPIO,12,1'' I want it to work only using the idx number. Incase I want to use a dht22 or something.