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 2020-03-13 02:31:39 +01:00 committed by GitHub
parent 11a25157c1
commit 94b6ab2862
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 17 deletions

View file

@ -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,
}