Why is this rule not working as expected?

Guest shared this problem 9 months ago
Solved

Hi,

I have a rule with a motion sensor, power plug and a virtual sensor.

1bf090d3ed7a88c67b2cc4fe2795f0c9


The virtual sensor "DAYLIGHT SENSOR" is set to active between sunrise and sunset and inactiven in the night.

So, I want to enable the power plug if the motion sensor is active AND the daylight sensor is inactive (night).

The problem is, that the power plug will be enabled everytime. The status of the daylight sensor does not make any difference.

What is the problem?

Best Answer
photo

Thank you! That seems to work nowand the rule looks like this:

ca07b7328ee965e840dd69b18f0671f8


But that also means that the AND operator does in some cases not works as expected. Maybe a bug..

Comments (4)

photo
1

Hello,

If I unterstand correctly you never stop the power plug cause you use it in the first condition as "Aus". So if you don't have another rule to switch it of, it'll never be stopped. EDIT : after recheck I'm wrong. Normally at daynight, sensor OFF and Power AN you would stop the light. Have you tested also without the "JOIN" ? EDIT EDIT : also you can try and "update all" after the "JOIN"

I would create two rules, one for START and one for STOP.

Wenn Sensor AN UND Daylight INAKTIV

Power ON

--

Wenn Sensor AUS UND Power AN

Power Aus


Hope it will help

Regards,

photo
1

It´s not a problem that that power plug will not which off again. That is wokring fine because the motion sensor have a fixed parameter that once motion is detected, it will be active for 5 minutes.

In general the rules works fine. On motion the power plug will be activated and 5 minutes later it will be deactivated.

The problem is that it will be activated when the virtual sensor "daylight sensor" is on active and on inactive. How is that possible? This condition is completly ignored in the when clause.

photo
1

Hello,

Correct, normally if daylight is activ it would be impossible to activate the power.

Maybe a first if statement to check if daylight is active and just a "STOP" statement inside ? Juste after the JOIN ?

Sorry to not be able to give more idea.

photo
1

Thank you! That seems to work nowand the rule looks like this:

ca07b7328ee965e840dd69b18f0671f8


But that also means that the AND operator does in some cases not works as expected. Maybe a bug..

photo
1

That was to early.. Today in the morning it was working as expected, but now the power plug is active again on motion even if the virtual sensor is on inactive. That´s must be a bug and I will create a ticket now.

photo
photo
1

Just come back with an analog experiment :

I use a Virtual Switch to check if user want a notification. Basically in all my rules I add a if VSwitch is true > send a message

This didn’t work since weeks. After checking notification issue and also recheck all my rules, I detect that this switch didn’t be consider inside the rules.

I check the status log of the VSwitch and see “no data”. So after a reboot, I force the Switch a few times ON/OFF and check the log. Finally the status appear inside.

Since the rules, without any change are working correctly and I receive the notification.

I suggest you to force your Daylight Sensor a few times and check the status, maybe it’s an issue with this.

photo
1

Hi Tomu

Actually, it'ss a very simple rule. Here is an example:

/b798748eda88677e89b22da747d2455b