Z-Wave Device Registry Support (#17291)
* Add device_registry support for sensor and switch domains * Add device_registry support for light * Add device registry to binary_sensor, climate, cover * Add device registry to zwave fan * Fix test for config entry loading * lint * revert erroneous modification * Revert device_registry.py change
This commit is contained in:
parent
c6d9ceca63
commit
9c52a3ce22
10 changed files with 189 additions and 31 deletions
|
@ -7,10 +7,11 @@ https://home-assistant.io/components/binary_sensor.zwave/
|
|||
import logging
|
||||
import datetime
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.event import track_point_in_time
|
||||
from homeassistant.components import zwave
|
||||
from homeassistant.components.zwave import ( # noqa pylint: disable=unused-import
|
||||
async_setup_platform, workaround)
|
||||
from homeassistant.components.zwave import workaround
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DOMAIN,
|
||||
BinarySensorDevice)
|
||||
|
@ -19,6 +20,23 @@ _LOGGER = logging.getLogger(__name__)
|
|||
DEPENDENCIES = []
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities,
|
||||
discovery_info=None):
|
||||
"""Old method of setting up Z-Wave binary sensors."""
|
||||
pass
|
||||
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up Z-Wave binary sensors from Config Entry."""
|
||||
@callback
|
||||
def async_add_binary_sensor(binary_sensor):
|
||||
"""Add Z-Wave binary sensor."""
|
||||
async_add_entities([binary_sensor])
|
||||
|
||||
async_dispatcher_connect(hass, 'zwave_new_binary_sensor',
|
||||
async_add_binary_sensor)
|
||||
|
||||
|
||||
def get_device(values, **kwargs):
|
||||
"""Create Z-Wave entity device."""
|
||||
device_mapping = workaround.get_device_mapping(values.primary)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue