Help with Rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
lars@baekmark.dk
New user
Posts: 3
Joined: 29 May 2017, 13:53

Help with Rules

#1 Post by lars@baekmark.dk » 02 Oct 2018, 10:14

Hi all

I have connected a ESP8266-01 to PCF8574 in order to control four relays and using two input for getting the status from my GaragePort. All is working, but the status of the two inputs is being sent to my Domoticz server every 30 sec via rules:
n GaragePortStatusClose#Switch=0.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=On
endon

on GaragePortStatusClose#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=Off
endon

on GaragePortStatusOpen#Switch=0.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=73&switchcmd=On
endon

on GaragePortStatusOpen#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=73&switchcmd=Off
endon

Note that active is 0.00 on and off is 1.00

I'll like to have a system, where the changes is sent when there is a change in input, and not every 30 sec. It's messing up my log on Domoticz.

Can someone give a hint on how to get the correct rules to solve my issue?

I'm using ESPMega v. mega-20181001

Big thanks in advance :D

Lars

marion9
New user
Posts: 5
Joined: 02 Oct 2018, 10:46

Re: Help with Rules

#2 Post by marion9 » 02 Oct 2018, 10:56

I am joining the thread, want to check replies

TD-er
Core team member
Posts: 8746
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Help with Rules

#3 Post by TD-er » 02 Oct 2018, 13:21

I am not really sure, but I think these rules can be half in size, since you can 'translate' the values into some other strings like "on/off" and also invert.

The format is

Code: Select all

[task#value#transformation#justification]

Code: Select all

on GaragePortStatusClose#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=Off
endon
Could possibly be changed into:

Code: Select all

on GaragePortStatusClose#Switch do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=[GaragePortStatusClose#Switch#!O]
endon
I have not tested it, just based on the sourcecode in Misc.ino.
"!" is invert
"O" is translate it into "On/Off"

I think if you send the values to a dummy variable first, that one will check for changes and only trigger an action on changes.
Maybe @Grovkillen also has some ideas on this one?

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Help with Rules

#4 Post by toffel969 » 02 Oct 2018, 14:37

lars@baekmark.dk wrote: 02 Oct 2018, 10:14 Hi all

I have connected a ESP8266-01 to PCF8574 in order to control four relays and using two input for getting the status from my GaragePort. All is working, but the status of the two inputs is being sent to my Domoticz server every 30 sec via rules:
n GaragePortStatusClose#Switch=0.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=On
endon

on GaragePortStatusClose#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=Off
endon

on GaragePortStatusOpen#Switch=0.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=73&switchcmd=On
endon

on GaragePortStatusOpen#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=73&switchcmd=Off
endon

Note that active is 0.00 on and off is 1.00

I'll like to have a system, where the changes is sent when there is a change in input, and not every 30 sec. It's messing up my log on Domoticz.

Can someone give a hint on how to get the correct rules to solve my issue?

I'm using ESPMega v. mega-20181001

Big thanks in advance :D

Lars

If I understand you right, you would just need to setup your domoticz as controller, set the delay of the input switch devices to 0, enable "send Data". Then you would get messages on change only.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

lars@baekmark.dk
New user
Posts: 3
Joined: 29 May 2017, 13:53

Re: Help with Rules

#5 Post by lars@baekmark.dk » 03 Oct 2018, 09:25

toffel969 wrote: 02 Oct 2018, 14:37
lars@baekmark.dk wrote: 02 Oct 2018, 10:14 Hi all

I have connected a ESP8266-01 to PCF8574 in order to control four relays and using two input for getting the status from my GaragePort. All is working, but the status of the two inputs is being sent to my Domoticz server every 30 sec via rules:
n GaragePortStatusClose#Switch=0.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=On
endon

on GaragePortStatusClose#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=74&switchcmd=Off
endon

on GaragePortStatusOpen#Switch=0.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=73&switchcmd=On
endon

on GaragePortStatusOpen#Switch=1.00 do
SendToHTTP 192.168.6.44,8080,/json.htm?type=command&param=switchlight&idx=73&switchcmd=Off
endon

Note that active is 0.00 on and off is 1.00

I'll like to have a system, where the changes is sent when there is a change in input, and not every 30 sec. It's messing up my log on Domoticz.

Can someone give a hint on how to get the correct rules to solve my issue?

I'm using ESPMega v. mega-20181001

Big thanks in advance :D

Lars

If I understand you right, you would just need to setup your domoticz as controller, set the delay of the input switch devices to 0, enable "send Data". Then you would get messages on change only.
Hi toffel969

that did it!!! No rules, and your suggestions, it just works! :D

Big thanks from rainy/windy/cold Denmark

/Lars

Post Reply

Who is online

Users browsing this forum: No registered users and 56 guests