Interacting with Domoticz

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
ulfh2018
Normal user
Posts: 30
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Interacting with Domoticz

#1 Post by ulfh2018 » 17 Mar 2019, 13:08

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

kimot
Normal user
Posts: 147
Joined: 12 Oct 2017, 20:46

Re: Interacting with Domoticz

#2 Post by kimot » 17 Mar 2019, 20:45

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

ulfh2018
Normal user
Posts: 30
Joined: 19 Feb 2018, 06:11
Location: Oslo Norway

Re: Interacting with Domoticz

#3 Post by ulfh2018 » 18 Mar 2019, 20:43

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!

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests