"""Philips ROM001 device.""" from zigpy.profiles import zha from zigpy.quirks import CustomDevice from zigpy.zcl.clusters.general import ( Basic, Groups, Identify, LevelControl, OnOff, Ota, PowerConfiguration, Scenes, ) from zigpy.zcl.clusters.lightlink import LightLink from zhaquirks.const import ( COMMAND_HOLD, COMMAND_ON, DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, LONG_PRESS, LONG_RELEASE, MODELS_INFO, OUTPUT_CLUSTERS, PROFILE_ID, TURN_ON, ) from zhaquirks.philips import ( PHILIPS, SIGNIFY, Button, PhilipsBasicCluster, PhilipsRemoteCluster, PressType, ) DEVICE_SPECIFIC_UNKNOWN = 64512 class PhilipsRom001RemoteCluster(PhilipsRemoteCluster): """Philips remote cluster for ROM001.""" BUTTONS = { 1: Button(COMMAND_ON, TURN_ON, COMMAND_ON), } PRESS_TYPES: dict[int, PressType] = { # We omit "short_press" and "short_release" on purpose, so it # won't interfere with simulated multi-press events. We emit # them in the multi-press code later on. # 0: SHORT_PRESS, 1: PressType(LONG_PRESS, COMMAND_HOLD), # 2: SHORT_RELEASE, 3: PressType(LONG_RELEASE, "long_release", "hold_release"), } class PhilipsROM001(CustomDevice): """Philips ROM001 device.""" signature = { # MODELS_INFO: [ (PHILIPS, "ROM001"), (SIGNIFY, "ROM001"), (SIGNIFY, "RDM003"), (SIGNIFY, "RDM005"), ], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.NON_COLOR_SCENE_CONTROLLER, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, Identify.cluster_id, DEVICE_SPECIFIC_UNKNOWN, LightLink.cluster_id, ], OUTPUT_CLUSTERS: [ Ota.cluster_id, Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, Scenes.cluster_id, LightLink.cluster_id, ], } }, } replacement = { ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.NON_COLOR_SCENE_CONTROLLER, INPUT_CLUSTERS: [ PhilipsBasicCluster, PowerConfiguration.cluster_id, Identify.cluster_id, PhilipsRom001RemoteCluster, LightLink.cluster_id, ], OUTPUT_CLUSTERS: [ Ota.cluster_id, Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, Scenes.cluster_id, LightLink.cluster_id, ], } } } device_automation_triggers = ( PhilipsRom001RemoteCluster.generate_device_automation_triggers() )