Add suggested area for zwave_js devices (#47250)

This commit is contained in:
Raman Gupta
2021-03-02 01:17:25 +00:00
committed by Paulus Schoutsen
parent 3ebe31e172
commit 88d29bcf20
6 changed files with 41 additions and 17 deletions
+3
View File
@@ -16,3 +16,6 @@ PROPERTY_DOOR_STATUS_BINARY_SENSOR = (
CLIMATE_RADIO_THERMOSTAT_ENTITY = "climate.z_wave_thermostat"
CLIMATE_DANFOSS_LC13_ENTITY = "climate.living_connect_z_thermostat"
CLIMATE_FLOOR_THERMOSTAT_ENTITY = "climate.floor_thermostat"
BULB_6_MULTI_COLOR_LIGHT_ENTITY = "light.bulb_6_multi_color"
EATON_RF9640_ENTITY = "light.allloaddimmer"
AEON_SMART_SWITCH_LIGHT_ENTITY = "light.smart_switch_6"
+2 -4
View File
@@ -10,9 +10,7 @@ from zwave_js_server.model.driver import Driver
from zwave_js_server.model.node import Node
from zwave_js_server.version import VersionInfo
from homeassistant.helpers.device_registry import (
async_get_registry as async_get_device_registry,
)
from homeassistant.helpers.device_registry import async_get as async_get_device_registry
from tests.common import MockConfigEntry, load_fixture
@@ -20,7 +18,7 @@ from tests.common import MockConfigEntry, load_fixture
@pytest.fixture(name="device_registry")
async def device_registry_fixture(hass):
"""Return the device registry."""
return await async_get_device_registry(hass)
return async_get_device_registry(hass)
@pytest.fixture(name="controller_state", scope="session")
+19 -1
View File
@@ -18,7 +18,11 @@ from homeassistant.config_entries import (
from homeassistant.const import STATE_UNAVAILABLE
from homeassistant.helpers import device_registry, entity_registry
from .common import AIR_TEMPERATURE_SENSOR, NOTIFICATION_MOTION_BINARY_SENSOR
from .common import (
AIR_TEMPERATURE_SENSOR,
EATON_RF9640_ENTITY,
NOTIFICATION_MOTION_BINARY_SENSOR,
)
from tests.common import MockConfigEntry
@@ -467,3 +471,17 @@ async def test_removed_device(hass, client, multiple_devices, integration):
)
assert len(entity_entries) == 15
assert dev_reg.async_get_device({get_device_id(client, old_node)}) is None
async def test_suggested_area(hass, client, eaton_rf9640_dimmer):
"""Test that suggested area works."""
dev_reg = device_registry.async_get(hass)
ent_reg = entity_registry.async_get(hass)
entry = MockConfigEntry(domain="zwave_js", data={"url": "ws://test.org"})
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
entity = ent_reg.async_get(EATON_RF9640_ENTITY)
assert dev_reg.async_get(entity.device_id).area_id is not None
+5 -3
View File
@@ -12,9 +12,11 @@ from homeassistant.components.light import (
)
from homeassistant.const import ATTR_SUPPORTED_FEATURES, STATE_OFF, STATE_ON
BULB_6_MULTI_COLOR_LIGHT_ENTITY = "light.bulb_6_multi_color"
EATON_RF9640_ENTITY = "light.allloaddimmer"
AEON_SMART_SWITCH_LIGHT_ENTITY = "light.smart_switch_6"
from .common import (
AEON_SMART_SWITCH_LIGHT_ENTITY,
BULB_6_MULTI_COLOR_LIGHT_ENTITY,
EATON_RF9640_ENTITY,
)
async def test_light(hass, client, bulb_6_multi_color, integration):
+1 -1
View File
@@ -27,7 +27,7 @@
"nodeType": 0,
"roleType": 5,
"name": "AllLoadDimmer",
"location": "",
"location": "LivingRoom",
"deviceConfig": {
"manufacturerId": 26,
"manufacturer": "Eaton",