PeteLawrence / homebridge-people

204 stars 52 forks source link

Use presence buttons as Condition - not working consistently #43

Open farstreet opened 7 years ago

farstreet commented 7 years ago

One of the big shortcomings of Apple's Home app is that you cannot program Conditions but only Triggers (Location Changes, Time of Day, Accessory Controlled or Sensor Detects Something). Luckily other administration apps like EVE allow this, however with limitations. E.g. a Time of Day Trigger cannot be subject to a Condition that it should only occur when somebody specific (or anyone) is at home.

I tried to be inventive (I have my moments) and worked out a 2-step approach:

1) Create a Time of Day Automation that does nothing but triggering a stateless dummy switch 2) Create a Accessory Controlled Automation that uses the above mentioned dummy switch as Trigger and then (through Eve app) add a Condition that the AnyOne button should be activated before the foreseen scenes/accessories are being executed.

So far so good. Only thing I notice is that the 2nd part is not always executed, which could normally only mean that the Condition (Anyone active) is not met.

My theory is that - when not using the Home app for some time - it looks like the presence buttons are no longer updated or even completely forgotten by Homekit. That could also explain why - when I go in the Home app after a few hours of not using it - I am getting Notifications through my iPhone about a status change for the presence buttons and Automations where these buttons are used as Trigger are executed at that moment only. This behaviour is also explained in another issue: #27 , so far without any idea as to why it is happening.

Would be interested in hearing other users experiences and/or alternative solutions. Also potential logging possibilities for debugging would be welcome.

nitaybz commented 7 years ago

I'm experiencing some issues as well... similar to yours, I just got home now and the automation for when I get home only started after opening the 'Home' app, that happens every once in a while, sometimes it does start the automation and sometimes not, my automation is not as complicated as yours, I only set it to start a scene when I'm coming home and my wife is away.

the weird thing is that I've seen the IFTTT notification that sends the status and also I saw notification from home app regarding my presence, but the automation did not work until I opened the app.

I'm using both iPad and Apple TV 4th gen as hubs. as for now my Apple TV is set to sleep after 15 min, I will try to cancel this configuration and will update if there's any change.

farstreet commented 7 years ago

It's only an issue for me when I see the push notifications (I have them configured as Banners) only at the time when I open the Home app. Every once in a while (I guess if I was in the home app less than x minutes before the button got triggered), the behaviour is correct. The Push Notification appears without having to go into the Home app and the Automations linked to the triggering execute as they should. But no consistency as to when it's working and when not.

andyrooo82 commented 7 years ago

This happened to me as well tonight when I got home. The app I use Locative did send the command but the rule didn't run which I created in Eve as i use the plugin SunCalc to work out if it's dark outside or not (I dont want to turn on the lights when i get home in the middle of the day). I didn't open the home app though I just told siri i was home and it ran the rule anyway.

It seems to be very hit and miss, I used a browser instead to send the commands and it worked, then didn't. I tried combinations of having the Home app / Eve app open closed etc but not find the root cause as it's seems to be sporadic.

farstreet commented 7 years ago

I am considering to put 24 Time based Automations in the Home app, to run each 30 minutes, doing a virtual invisible action like triggering a switch or sending something to my IFTTT Maker channel, just to keep the app 'alive'. Wondering if that would bypass (not solve..) the problem.

farstreet commented 7 years ago

Didn't do the above (too much work), but I did change my AppleTV sleep settings from "30 minutes" to "Never". It would be extremely disappointing if that solves the issue, but not impossible.

nitaybz commented 7 years ago

@farstreet I tried it, to change the apple TV to never sleep. but it doesn't work either. and this problem seems to happen only recently. seems like 2 weeks ago it worked perfectly, and I already had iOS 10.2 on my iPhone(7). The only thing that changed in the past 2 weeks is that I updated my Homebridge to the latest release.... could this have something to do with the automation not firing every time?

benzman81 commented 7 years ago

@nitaybz dont think so. I had a pretty old version running and the problem already occured. Then my next thep was to update everthing to see if that helps, but it didnt. The only thing that changed in my environment is the update of 10.2. I havent even updated the Apple Tv which I thought might have been the problem. But it wasnt. Now everthing is up to date and still the issue occurs. I am pretty sure its an iOS 10.2 bug as this also introduced notifications for other accecesorries.

nitaybz commented 7 years ago

yup... I guess we'll have to wait for the next update.... that 10.2 update brought more harm than good, does anyone else can't add accessories to automations/scenes/groups? (makes the Home app crash)

farstreet commented 7 years ago

I can add accessories without any problem, never been an issue.

I must say that since this morning, I haven't had a single time yet where I opened the app and I noticed that the push notifications got sent. And the Automations that I have during the day (turning everything off when NoOne becomes active AND a switch that gets activated at 9am) both ran correctly without me having to go into the app.

JimBobSD commented 7 years ago

I am having the same problem of HomeKit not detecting the change in Occupancy status until I open a HomeKit enabled app on my iPhone. Once I open the HomeKit enabled app, the trigger then takes place.

Sometimes I see no problems for several days in a row. It works as expected. However, randomly, it stops detecting the Occupancy change.

I have two types of triggers that this affects. The first type of Trigger is based on Anyone showing Occupancy. The second type of Trigger is (like the original post) where the Trigger is based on another event -- where a required Condition is Anyone showing Occupancy.

farstreet commented 7 years ago

Anyone considered making this statefull switches instead of motion sensors? I wouldn't know how to do it but they seem much more stable. As long as accidental (or even intended, for testing purposes) state changes get overruled at the next automatic status update by the plugin.

nitaybz commented 7 years ago

@farstreet I like this idea... might actually work. though homekit automations are still not gonna work consistently until apple will fix the problem.

I gotta tell you though, I tried the latest 10.2.1 beta 3 update and the problem is still there. new feature (or problem) they added makes the app asks you if you're interested in running the automation, it's not doing it with all the automation so I'm still not sure why and when this is happening...

I think turning this plugin into a a switch instead of a sensor might fix that issue as well.

farstreet commented 7 years ago

I hope somebody picks it up and programs it

andyrooo82 commented 7 years ago

Mines been working ok for the last few days both leave and arrive which is nice. But today leave didn't run until I opened home app. So random. Does anyone know if changing it to state full switches from sensors would work? If so +1 from me

farstreet commented 7 years ago

As I am at this very moment also experimenting with Home Assistant (what a pain though), I have created last night 4 stateful switches (myself, partner, AnyOne, NoOne) in the homebridge-webhooks plugin that I feed with presence information coming from Home Assistant.

Then updated my Homebridge Automations to use those switches (from hb-webhooks) instead of the sensors (from hb-people) in the applicable Triggers and Conditions.

So far this morning it worked as I wanted it to work... Will keep you guys updated.

benzman81 commented 7 years ago

As far as I can tell my other plugings homebridge-nuki and homebridge-http-webhooks have the problem with door/window sensors and locks as well.

andyrooo82 commented 7 years ago

@benzman81 Would make sense as it's not an issue with the plugin but with iOS.

farstreet commented 7 years ago

Since this morning, I notice it takes the Home app very long to update the status of my accessories when I open the app. Both at home and remote.

JonSilver commented 7 years ago

Me too. Very slow indeed. And a triangle with an exclamation mark against every people sensor.


From: Jurgen notifications@github.com Sent: Wednesday, January 11, 2017 4:35:57 PM To: PeteLawrence/homebridge-people Cc: Subscribed Subject: Re: [PeteLawrence/homebridge-people] Use presence buttons as Condition - not working consistently (#43)

Since this morning, I notice it takes the Home app very long to update the status of my accessories when I open the app. Both at home and remote.

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/PeteLawrence/homebridge-people/issues/43#issuecomment-271919044, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIbAgjwpXbFq9RAqN6UOo9bii_-3qZ5kks5rRQTtgaJpZM4LYn7N.