Rules using variable not working

Pepijn de Geus shared this question 4 years ago
Answered

Hi there,

I'm trying to create a rule turning on some light when the power consumption of one sensor is above a certain level. When it drops below that level, the light should turn off again. Since my first tries didn't work, I boiled my rules down to something even more simple: sending an email based on the status of a switch.


I still don't get it to work. When taking out the variables the rules work, but they will keep sending emails forever. Not exactly desired either :)


What is it I'm doing wrong? I already notices the rules created in the new GUI are not always correct (checked using the API), so these are created in the old web interface.

I've tried 2 difference approaches - check out the attachments.

Thanks in advance!

Best Answer
photo

Make 2 rules with When statement, one for kaku on and 1 for kaku off.


Then an if statement checking the var 'bankstatus'.

This should work.

I always tought that a when statement is executed when a devices changes its status.

It is unlikely that Kaku and bankstatus are changing at the same time.

Comments (2)

photo
1

Make 2 rules with When statement, one for kaku on and 1 for kaku off.


Then an if statement checking the var 'bankstatus'.

This should work.

I always tought that a when statement is executed when a devices changes its status.

It is unlikely that Kaku and bankstatus are changing at the same time.

photo
2

Alright, turns out the problem was not my ruling skills, but with the Zipabox. I figured out some of my previous rules didn't work either. Rebooting did't fix that, but unplugging the box solved te problem.

Attached is the working configuration, based on Sanders comment.

Thanks!