Open SeanPM5 opened 3 years ago
Do you have Home Assistant in the list of allowed notifications? That stops the sensor working. Also, does it work if you manually start sleep. I certainly see that the auto sleep focus is dodgy in terms of locking my watch screen
Good catch, that seemed to be precisely the problem. Having HA in the Allowed Notifications app list causes the sensor to not work. Weird....
Once I removed it from that list it was working fine and reporting the correct states (true/on).
Don't notice any issues so far with manually starting it, and watch lock screen seems to work fine too.
I'm wondering where a good place to note this in the app is, so somebody trying to figure it out would notice. Inside the sensor itself in Sensors? Under the permission row? I don't want to clutter the UI too much, but I would prefer to make this clear since it's a common problem and there's sadly nothing we can do to work around it.
Could with the explanation text for the focus permission. Maybe in the sensors screen, could break focus out of its group with motion and add some text.
I was having an issue with Focus never being reported to Home Assistant as well. Turns out having the "Share Across Devices" setting disabled also blocks this information from being captured by the sensor.
Not 100% certain it's related but thought I'd mention that as well.
An unrelated question: is it possible for HA to know which focus is active? I haven't looked into the API myself yet, but just curious.
I have a related problem. On my iPhone 12 Pro the Focus change is recognized instantly, while on the iPhone XS it takes minutes to update the state. Is there anything I can do to make it faster on the XS?
I have a problem since the update to Home Assistant 2021.12. on my iPhone 13 MAX. Before the update, the Focus Sensor would display correctly when I had a Focus turned on. Since the update, no Focus state is updated on my iPhone 13 MAX. The sensor always shows "off". However, on an iPhone 12 Pro, the Focus state is correctly displayed as "on". I have tried and checked everything possible - all settings are the same. Uninstalling and reinstalling the Home Assistant app did nothing either.
I started having problems after updating to iOS 15.2. I was running 15.1 and had an automation that was triggered based on the focus state (mainly used when enabling sleep). Immediately after updating to 15.2 that stopped working when putting my phone in to sleep focus. It actually works immediately and as expected if I change the focus state to any of the other modes (work, personal, a custom one, etc). I have confirmed that HA is not in the allowed notifications (as I also noticed that bug) and wind down is turned off (which also caused the state to not be updated).
My current work around is using a custom Focus mode, which triggers my HA automation, then manually changing the mode to Sleep.
My HA versions didn't change between the iOS versions and I'm currently running the latest version of HA OS and Core.
I have a iPhone 12 Pro.
For anyone still having trouble with this, or interested in improving documentation, I found that my phone and my wife's were behaving differently.
If you read the notes about the "Focus Status" setting, it suggests this setting controls whether iOS even informs the app at all that it's in a focus mode or not. After enabling this setting, and enabling it for all the focus modes where I want HomeAssistant to show "focus" as true
everything works as expected.
HTH
I tried everything mentioned before. Nothing helped 👎
Good catch, that seemed to be precisely the problem. Having HA in the Allowed Notifications app list causes the sensor to not work. Weird....
Once I removed it from that list it was working fine and reporting the correct states (true/on).
Don't notice any issues so far with manually starting it, and watch lock screen seems to work fine too.
I have an automation that kicks off when I turn on sleep mode that stopped working. I recently just got some security cameras that I made some HA interactive notifications for, so I added HA to my sleep routine notifications and had this same issue. Putting my phone in sleep focus wouldnt trigger the automation, but removing it fixed my issue. Thank you!
Funny enough, if you WANT ha to ignore certain focus modes you can enable notifications for the app in that focus mode xD
@SeanPM5 Same thing here. Try the other focuses. I found 'Sleep' focus was the only one that did this. Currently debugging that.
Same issue here. One workaround is to update the state of binary_sensor.<phoneName>_focus
entity by sending an API request using the iOS shortcuts app. I created an Automation in the Shortcut app to trigger when the focus is turned on and it runs the API request Action.
Found it! Go to settings > focus > focus status > select all focus items you want to be reported.
Edit: Home assistant only reports focus as On/Off so i only enabled one focus mode. It works with sleep.
iOS device model, version and app version
Model Name: iPhone 13 Pro Software Version: 15.1 stable App version: 2021.11 (2021.261)
Home Assistant Core Version
2021.11.0b0
Describe the bug The binary sensor for focus does not appear to be working when in "Sleep" focus. At first I assumed this was maybe because the OS entered sleep focus automatically (as part of the "Wind Down" schedule thing). So to test that theory I disabled and manually re-enabled Sleep focus through the Control Center menus, and that still wasn't updating the binary sensor state.
All other Focuses (such as DND, Fitness, etc) appear to update the sensor state immediately as expected, it's just a problem with Sleep focus. I tried this on my iPad which is also running iOS 15.1 and saw the same behavior there too.
The latest beta macOS app on my Intel MBP / Monterey 12.0.1 (21A559) is correctly reporting the sleep focus state though. So it appears to be limited to iOS. Not sure if it was like this before 15.1, have been busy moving and hadn't tried until now.
To Reproduce Activate Sleep focus on 15.1 and the state of focus binary sensor will not update, all other focuses appear to still update the sensor.
Expected behavior Update state of focus sensor
Screenshots
Additional context