Page 1 of 1

Interacting with Domoticz

Posted: 17 Mar 2019, 13:08
by ulfh2018
I am working on a project where ESP Easy is interacting with Domoticz, or the other way around. I have now managed to get information from Domoticz to ESP Easy and Domoticz to read values from devices on ESP Easy. I am using two Setpoints on Domoticz to set wanted value of the temperature using rules on ESP Easy and dzVents on Domoticz:
return {
active = true,
on = {
devices = {
'BadNede'}
},
execute = function(domoticz, device)
local url= 'http://10.0.0.217/control?cmd=event,Bad ... ice.state)..'' -- your IP !!!
print(url)
domoticz.openURL(url)
end}
This works as expected.

Now I want to implement a dummy switch which I want to use to indicate the status of the relays, but I don't know if this can be done by rules on ESP Easy, and if so how it should be implemented.

It is possible this is not a topic for this forum, so I cross post it on the Domoticz forum.

Best regards

Ulf

Re: Interacting with Domoticz

Posted: 17 Mar 2019, 20:45
by kimot
Create dummy switch in Domoticz and take note about its IDX

In rules on ESPeasy use something like this:

Code: Select all

SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=26&switchcmd=On

or

SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=26&switchcmd=Off

Here IDX is 26

Again - all this is in discussion below my video, which you know.

Code: Select all

on HeatingOn do
 if [Rele#Switch]=0
  TaskValueSet,2,1,[Variables#Counter]+1
 endif
 gpio,5,1
 SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=91&switchcmd=On
endon

on HeatingOff do
 gpio,5,0
 SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=91&switchcmd=Off

endon

Re: Interacting with Domoticz

Posted: 18 Mar 2019, 20:43
by ulfh2018
I'm sorry I did bother you with the question. I had tested the syntax, and it did not work. The reason was a logical error in my Rule set. Fixed now, and works as expected!

Thanks a lot!