From 217e280f8bdc72b72b0e30594546c2b7b26d17a7 Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Sat, 25 Jan 2020 12:42:19 -0500 Subject: [PATCH] Update ZHA remotes registry to proper identify "remotes (#31146) * Update ZHA remote device types. * Remove `binary_sensor` entity from affected devices. * Update ZHA Profiles. Prevent DeviceType.ON_OFF_LIGHT_SWITCH from creating entities. * Update tests and remove unused entities. --- .../components/zha/core/registries.py | 4 +++- tests/components/zha/zha_devices_list.py | 23 ++++--------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/zha/core/registries.py b/homeassistant/components/zha/core/registries.py index e89c0b8189b..311f8fa275f 100644 --- a/homeassistant/components/zha/core/registries.py +++ b/homeassistant/components/zha/core/registries.py @@ -44,8 +44,11 @@ REMOTE_DEVICE_TYPES = { zigpy.profiles.zha.DeviceType.COLOR_DIMMER_SWITCH, zigpy.profiles.zha.DeviceType.COLOR_SCENE_CONTROLLER, zigpy.profiles.zha.DeviceType.DIMMER_SWITCH, + zigpy.profiles.zha.DeviceType.LEVEL_CONTROL_SWITCH, zigpy.profiles.zha.DeviceType.NON_COLOR_CONTROLLER, zigpy.profiles.zha.DeviceType.NON_COLOR_SCENE_CONTROLLER, + zigpy.profiles.zha.DeviceType.ON_OFF_SWITCH, + zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT_SWITCH, zigpy.profiles.zha.DeviceType.REMOTE_CONTROL, zigpy.profiles.zha.DeviceType.SCENE_SELECTOR, ], @@ -104,7 +107,6 @@ DEVICE_CLASS = { zigpy.profiles.zha.DeviceType.LEVEL_CONTROLLABLE_OUTPUT: LIGHT, zigpy.profiles.zha.DeviceType.ON_OFF_BALLAST: SWITCH, zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT: LIGHT, - zigpy.profiles.zha.DeviceType.ON_OFF_LIGHT_SWITCH: SWITCH, zigpy.profiles.zha.DeviceType.ON_OFF_PLUG_IN_UNIT: SWITCH, zigpy.profiles.zha.DeviceType.SMART_PLUG: SWITCH, }, diff --git a/tests/components/zha/zha_devices_list.py b/tests/components/zha/zha_devices_list.py index d5875edc9e2..5475a5cb2f7 100644 --- a/tests/components/zha/zha_devices_list.py +++ b/tests/components/zha/zha_devices_list.py @@ -45,10 +45,7 @@ DEVICES = [ "profile_id": 260, } }, - "entities": [ - "binary_sensor.centralite_3130_77665544_on_off", - "sensor.centralite_3130_77665544_power", - ], + "entities": ["sensor.centralite_3130_77665544_power"], "event_channels": [6, 8], "manufacturer": "CentraLite", "model": "3130", @@ -553,7 +550,6 @@ DEVICES = [ }, "entities": [ "sensor.jasco_products_45856_77665544_smartenergy_metering", - "switch.jasco_products_45856_77665544_on_off", "light.jasco_products_45856_77665544_on_off", ], "event_channels": [6], @@ -1001,10 +997,7 @@ DEVICES = [ "profile_id": -1, }, }, - "entities": [ - "sensor.lumi_lumi_remote_b486opcn01_77665544_power", - "switch.lumi_lumi_remote_b486opcn01_77665544_on_off", - ], + "entities": ["sensor.lumi_lumi_remote_b486opcn01_77665544_power"], "event_channels": [6, 8, 768, 6], "manufacturer": "LUMI", "model": "lumi.remote.b486opcn01", @@ -1054,10 +1047,7 @@ DEVICES = [ "profile_id": None, }, }, - "entities": [ - "sensor.lumi_lumi_remote_b686opcn01_77665544_power", - "switch.lumi_lumi_remote_b686opcn01_77665544_on_off", - ], + "entities": ["sensor.lumi_lumi_remote_b686opcn01_77665544_power"], "event_channels": [6, 8, 768, 6], "manufacturer": "LUMI", "model": "lumi.remote.b686opcn01", @@ -1372,10 +1362,7 @@ DEVICES = [ "profile_id": 260, } }, - "entities": [ - "binary_sensor.osram_lightify_dimming_switch_77665544_on_off", - "sensor.osram_lightify_dimming_switch_77665544_power", - ], + "entities": ["sensor.osram_lightify_dimming_switch_77665544_power"], "event_channels": [6, 8], "manufacturer": "OSRAM", "model": "LIGHTIFY Dimming Switch", @@ -1593,7 +1580,6 @@ DEVICES = [ } }, "entities": [ - "binary_sensor.securifi_ltd_unk_model_77665544_on_off", "sensor.securifi_ltd_unk_model_77665544_electrical_measurement", "sensor.securifi_ltd_unk_model_77665544_power", "switch.securifi_ltd_unk_model_77665544_on_off", @@ -1643,7 +1629,6 @@ DEVICES = [ "sensor.sercomm_corp_sz_esw01_77665544_power", "sensor.sercomm_corp_sz_esw01_77665544_power_2", "sensor.sercomm_corp_sz_esw01_77665544_electrical_measurement", - "switch.sercomm_corp_sz_esw01_77665544_on_off", "light.sercomm_corp_sz_esw01_77665544_on_off", ], "event_channels": [6],