"""Philips first generation RWL devices.""" from zigpy.profiles import zha, zll from zigpy.quirks import CustomDevice from zigpy.zcl.clusters.general import ( Basic, BinaryInput, Groups, Identify, LevelControl, OnOff, Ota, PowerConfiguration, Scenes, ) from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.philips import ( PHILIPS, SIGNIFY, PhilipsBasicCluster, PhilipsRwlRemoteCluster, ) DEVICE_SPECIFIC_UNKNOWN = 64512 class PhilipsRWLFirstGen(CustomDevice): """Philips updated RWL020 and RWL021 devices.""" signature = { # MODELS_INFO: [ (PHILIPS, "RWL020"), (SIGNIFY, "RWL020"), (PHILIPS, "RWL021"), (SIGNIFY, "RWL021"), ], ENDPOINTS: { 1: { PROFILE_ID: zll.PROFILE_ID, DEVICE_TYPE: zll.DeviceType.SCENE_CONTROLLER, INPUT_CLUSTERS: [Basic.cluster_id], OUTPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, Scenes.cluster_id, ], }, # 2: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.SIMPLE_SENSOR, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, Identify.cluster_id, BinaryInput.cluster_id, DEVICE_SPECIFIC_UNKNOWN, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, }, } replacement = { ENDPOINTS: { 1: { INPUT_CLUSTERS: [Basic.cluster_id], OUTPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, Scenes.cluster_id, ], }, 2: { INPUT_CLUSTERS: [ PhilipsBasicCluster, PowerConfiguration.cluster_id, Identify.cluster_id, BinaryInput.cluster_id, PhilipsRwlRemoteCluster, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, } } device_automation_triggers = ( PhilipsRwlRemoteCluster.generate_device_automation_triggers() ) class PhilipsRWLFirstGen2(CustomDevice): """Philips older RWL020 and RWL021 devices.""" signature = { # MODELS_INFO: [ (PHILIPS, "RWL020"), (SIGNIFY, "RWL020"), (PHILIPS, "RWL021"), (SIGNIFY, "RWL021"), ], ENDPOINTS: { 1: { PROFILE_ID: zll.PROFILE_ID, DEVICE_TYPE: zll.DeviceType.CONTROLLER, INPUT_CLUSTERS: [Basic.cluster_id], OUTPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, ], }, # 2: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.SIMPLE_SENSOR, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, Identify.cluster_id, BinaryInput.cluster_id, DEVICE_SPECIFIC_UNKNOWN, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, }, } replacement = { ENDPOINTS: { 1: { INPUT_CLUSTERS: [Basic.cluster_id], OUTPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, ], }, 2: { INPUT_CLUSTERS: [ PhilipsBasicCluster, PowerConfiguration.cluster_id, Identify.cluster_id, BinaryInput.cluster_id, PhilipsRwlRemoteCluster, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, } } device_automation_triggers = ( PhilipsRwlRemoteCluster.generate_device_automation_triggers() )