Monitor-App icon indicating copy to clipboard operation
Monitor-App copied to clipboard

Everyone_home/not_home wrong state

Open pointlevel opened this issue 4 years ago • 4 comments

Hello!

I have started to looking to use the binary sensors created from the app. But my sensors are reporting wrong state. In the app i have 4 macs. And by the time writing, 2 is home and 2 is away. And the status of the sensors is:

binary_sensor.everyone_home = on
binary_sensor.everyone_not_home = off

Feels to me that they are switched?

pointlevel avatar Aug 21 '20 14:08 pointlevel

Hello @pointlevel,

Yeah I just saw it, and weird I didn't see it before. Though @skynet01 had reported it before, but seems my fix not as solid as I thought.

Will see if its something I can fix over the weekend.

Regards

Odianosen25 avatar Aug 21 '20 17:08 Odianosen25

Now a couple of hours later the sensors is different(correct) with same number of people in the house(actually also the same people), se below:

binary_sensor.everyone_home = off
binary_sensor.everyone_not_home = off

pointlevel avatar Aug 21 '20 20:08 pointlevel

Yes @pointlevel,

It’s the same bug reported. Initially it’s wrong, and after a while it’s head gets settled. I just need to find a reliable way to fix it, still no clue yet.

Regards

Odianosen25 avatar Aug 21 '20 20:08 Odianosen25

While we are on the subject of these variables it looks like they are being reset when HA restarts and then updated once scan is complete. This results in some automations being fired incorrectly. Here is my case scenario:

  1. people are home - binary_sensor.somebody_home = on
  2. -- HA Restarts --
  3. binary_sensor.somebody_home > gets set to off. > automation is fired because no one is home
  4. scan starts, people are found again
  5. binary_sensor.somebody_home > gets set to on > automation is fired because someone is home

I believe a solution is to preserve the state of these variables during restart and only update them after the scan is finished (if it's not already like this). Currently i had to add delays to my automations just to compensate for this.

skynet01 avatar Aug 24 '20 18:08 skynet01