-
Notifications
You must be signed in to change notification settings - Fork 67
Description
I am working on an updated quirk for the Aqara Pet Feeder ACN001 which includes enabling modifying the schedule onboard the device. As part of this, in the quirk I am adding a new enum member Schedule = 0x00 to the FeedingSource class.
class FeedingSource(types.enum8):
"""Feeding source."""
Schedule = 0x00
Feeder = 0x01
Remote = 0x02
However, this does not work to show Schedule in the Last Feeding Source sensor in Home Assistant because ZHA has the AqaraFeedingSource class in sensor init.
class AqaraFeedingSource(types.enum8):
"""Aqara pet feeder feeding source."""
Feeder = 0x01
HomeAssistant = 0x02
Instead, Home Assistant will show undefined_0x00 when the schedule is used. Updating the AqaraFeedingSource with Schedule = 0x00 will let Home Assistant properly display when the schedule is used as the feeding source. The screenshot below shows the state before (undefined_0x00) and after (Schedule) I modified the sensor init with an updated AqaraFeedingSource class on my system.
class AqaraFeedingSource(types.enum8):
"""Aqara pet feeder feeding source."""
Schedule = 0x00
Feeder = 0x01
HomeAssistant = 0x02
It is not clear to me why the quirk's FeedingSource and ZHA's sensor init class AqaraFeedingSource do not use the same enum members. HomeAssistant is clearer for the source than Remote, so I could update the quirk to match if preferred.
I plan to open a PR for the updated quirk soon in zha-device-handlers.
I am also happy to open a PR for this. It is a simple change in the init.