Closed jaraco closed 1 month ago
Attempting to understand the difference between "Motion" and "Occupancy" sensors as coded in:
I did some searching and found https://github.com/MisterWil/abodepy/issues/10#issuecomment-325838125, which seems to indicate that the origin of these two classes is javascript (presumably from the Abode web UI) that alters the labels based on the reported version.
Moreover, there seems to be no examples of a device that returns a version prefixed with "MINIPIR", so this code path may never be activated.
In the handling of
Device.new
, there are some convoluted behaviors in resolving the specialized subclasses of BinarySensor (namelySensor
,Occupancy
, andMotion
):https://github.com/jaraco/jaraco.abode/blob/595f714456315159fa7d2f34f826b950d86e2f7d/jaraco/abode/devices/base.py#L127-L180
In particular, in
get_generic_type
, the device tags are explicitly managed rather than being associated with a sub_cls and then indicated as "unknown", even though they are known. Then another routineresolve_type_unknown
replaces these falsely-unknown types with real types.This roundabout approach to resolving types is confusing, error-prone, and counter-intuitive, contributing to home-assistant/core#121300 and delaying its resolution.
Let's find a better way.