Closed yyolk closed 1 week ago
I was also testing the change and noticed the issue, I'll investigate during this week. Thanks for the very complete report.
Apparently sending WKInterfaceDevice.current().batteryState
as enum was not working, so I update it to send as rawValue then I recreate it in iOS side, check PR above.
Testflight beta coming soon
Apparently sending
WKInterfaceDevice.current().batteryState
as enum was not working, so I update it to send as rawValue then I recreate it in iOS side, check PR above.
Wow! Thanks for the insight. That makes a lot more sense than what I was thinking 🤔
I now see why passing WKInterfaceDevice.current().batteryState
enum wouldn't work versus a primitive float value from the battery level now that we know it doesn't.
I got the latest TestFlight overnight 2024.9 (2024.813) and I can confirm I see both sensors are now working and reporting the values correctly.
Thank you for looking into it, explaining the issue, making the fix, merging it, and pushing out a new TestFlight build!
iOS device model, version and app version
Model Name: iPhone 13 Pro Max, Apple Watch Series 6 Software Version: iOS 17.6.1 (21G93), WatchOS 10.6.1 (21U580) App version: 2024.9 (2024.803)
Home Assistant Core Version
2024.8.3
Describe the bug Testing the iOS Beta through testflight. For #2945 - I received the testlfight build overnight from 2024.9 (2024.796) where the
watch-battery
sensor was still reporting correctly.After an automatic update to build to 2024.9 (2024.799) (also 2024.9 (2024.803)), the sensor appears to reporting but continues to report the same value it was previously. After waiting over a day to see if "it would resolve itself" I tried to debug.
The
watch-battery
sensor continues to report its last known state.watch-battery
will result in the state eventually reverting when a sensor update comes through (back to the previous state that didn't change.)The
watch-battery-state
doesn't changewatch-battery
not updating, or reporting the same value, this sensor is locked inNot Charging
After uninstalling, rebooting, and re-installing the app,
watch-battery
reports-1
.To Reproduce
watch-battery
sensor will report the last known value repeatedly, persisting through reboots of the device or-1
if you uninstalled, rebooted and re-installedExpected behavior
The sensor accurately report the current
watch-battery
level andwatch-battery-state
.Not the last known value (or the default value in the case of a uninstall, reboot, reinstall).
Screenshots
My phone is named "Frequency Between Disasters №" which is a reference to when I have to move to a new phone it feels disasterous.
This screenshot depicts:
watch-battery
to35
and then30
60
-1
while testing uninstalling, rebooting, re-installingThis screenshot depicts:
10
after a downgrade to 2024.9 (796) where the sensor reports correctlyAdditional context
I've switched between 2024.9 (2024.803) and 2024.9 (2024.799) and saw the same results.
As co-author of #2945 I don't know for sure what would be causing this behavior, below is all guesswork.
I focused primarily on the changes in https://github.com/yyolk/home-assistant-iOS/blob/009b4d0ecd37664a049f89fc2363f8a5abc5e946/Sources/Shared/API/Webhook/Sensors/WatchBatterySensor.swift#L11-L40
It is returning an array of promises my thought is that it seems that there might be some behavior where it will deliver before both promises are fulfilled (if they're getting fulfilled at all?). Since this worked while there was one Promise in the array, the difference could be trying to fulfill multiple.
Additionally the behavior seems to point to some caching happening in the watch communication where it will continue to use the last known value, as seen in updating while it was reporting accurately, and continuing to report that value even when manually changing it within home-assistant dev tools.