jcgoette / baby_buddy_homeassistant

This custom integration provides sensors for Baby Buddy API endpoints.
MIT License
59 stars 26 forks source link

timer switch entity not working with 2.0.0-beta1 #108

Closed Cadair closed 1 year ago

Cadair commented 1 year ago

Hello,

I haven't had a chance to look into this yet but it seems that the 2.0.0 beta breaks the timer switch (it's just always off) everything else appears to work fine, and there's no errors in the logs.

Cadair commented 1 year ago

Ok, so after some sleuthing around, it seems that the API response for timers back from babybuddy no longer includes an 'active' field in the timer JSON:

2023-05-04 16:40:19.404 DEBUG (MainThread) [custom_components.babybuddy.switch] self.coordinator.data[1][self.child[ATTR_ID]][ATTR_TIMERS]={'id': 3985, 'child': 1, 'name': None, 'start': '2023-05-04T16:36:18.151572+01:00', 'duration': '00:04:01.211576', 'user': 3}
2023-05-04 16:40:19.404 DEBUG (MainThread) [custom_components.babybuddy.switch] is_on=False
Cadair commented 1 year ago

Further sleuthing reveals this is probably deliberate: https://github.com/babybuddy/babybuddy/commit/7b7f17fde6cc6c45a36752cbf1b2752fe396476d