Use platform tag to register components on hue SensorManager (#32732)

* Use platform tag to register components on hue SensorManager

instead of a boolean flag to decide between sensor and binary sensor,
so it could be used externally (or to get ready for inclusion of other comps)

* Make new item discovery platform agnostic for SensorManager
This commit is contained in:
Eugenio Panadero authored and GitHub committed 2020-03-12 18:31:39 -07:00
1 parent 11a25157c1
commit 94b6ab2862
3 files changed
+14 -17

No files matched your search

@@ -17,7 +17,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
"""Defer binary sensor setup to the shared sensor module."""
await hass.data[HUE_DOMAIN][
config_entry.entry_id
].sensor_manager.async_register_component(True, async_add_entities)
].sensor_manager.async_register_component("binary_sensor", async_add_entities)
class HuePresence(GenericZLLSensor, BinarySensorDevice):
@@ -44,7 +44,7 @@ class HuePresence(GenericZLLSensor, BinarySensorDevice):
SENSOR_CONFIG_MAP.update(
{
TYPE_ZLL_PRESENCE: {
"binary": True,
"platform": "binary_sensor",
"name_format": PRESENCE_NAME_FORMAT,
"class": HuePresence,
}