Problems using rules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
hyperx
New user
Posts: 3
Joined: 16 Jun 2016, 09:48

Problems using rules

#1 Post by hyperx » 09 Sep 2016, 18:06

Hello,

since i can´t create a rule which depends on sunrise/sunset, i created a temp-switch that switches ON and off on sunrise/sunset (using it external)

So i want that the lights /PIR only turns ON/OFF when it´s dark outside.
The problem is, that it doesn´t matter if the switch is ON or OFF, the rule "if switch2#switch2 = 1" will be ignored and it always goes through, so the lights still turns on and off

if switch2#switch2 = 1
On pir#switch do
pwm,4,1
timerSet,1,20
endon

On Rules#Timer=1 do
pwm,4,0
endon
endif

Any ideas ? Using R120 with ESP12 wemos.

hamster
Normal user
Posts: 62
Joined: 27 Sep 2015, 21:01
Location: UK

Re: Problems using rules

#2 Post by hamster » 09 Sep 2016, 20:22

This is the rule I use to control my hot water

Code: Select all

On thermon do
 pcfgpio,3,0 //turn on
endon

On thermoff do
 pcfgpio,3,1 //turn off
endon

on Hotwater#Temperature<39 do
if [dumb#Occupied]=1
if [dumb#Night]=0
event,thermon
timerSet,1,200
endon

On Rules#Timer=1 do
if Boiler#Temperature<30 do
TaskValueSet 10,1,100
endon

on Hotwater#Temperature>39 do
event,thermoff
TaskValueSet 10,1,5
endon

on Hotwater#Temperature<28 do
event,thermoff
TaskValueSet 10,1,1
endon

on occupied do
  TaskValueSet 9,1,1
endon

on notoccupied do
  TaskValueSet 9,1,0
endon

On Clock#Time=all,22:30 do
TaskValueSet 9,2,1
endon 
On Clock#Time=all,06:00 do
TaskValueSet 9,2,0
endon

on hw_over_ride_on do
  TaskValueSet 9,2,0
endon

on hw_over_ride_off do
  TaskValueSet 9,2,1
endon
I use dummy switches controlled by domoticz for occupancy and if its night / day
also after the boiler starts heating the water a timer is set to check the boiler temperature has heated, if not I get a notification.
I also have some overide switches

kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re: Problems using rules

#3 Post by kr0815 » 09 Sep 2016, 23:44

Below my code for a task like yours

GPIO12 is the relais for the light
PIR#motion is the PIR
dummy#light is the externally controlled dummy switch for day/night

i´d say you have to swap your first 2 lines ?

Code: Select all

On System#Boot do    
gpio,5,1
endon

On PIR#motion=1 do
if [dummy#light]=1
gpio,12,1
timerSet,1,60
else
endif
endon

On Rules#Timer=1 do 
gpio,12,0
endon

hyperx
New user
Posts: 3
Joined: 16 Jun 2016, 09:48

Re: Problems using rules

#4 Post by hyperx » 12 Sep 2016, 19:30

Thank you !
... Working !!

Post Reply

Who is online

Users browsing this forum: No registered users and 54 guests