Instantly share code, notes, and snippets.
Created
October 15, 2022 11:13
-
Star
(1)
1
You must be signed in to star a gist -
Fork
(0)
0
You must be signed in to fork a gist
-
Save spidgorny/db1f01bc1b1009577fc5bab3ad37dff0 to your computer and use it in GitHub Desktop.
Silver Crest ( Lidl) smart Button Home Assistant Quirks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Lidl TS004F Smart Button SSBM A1""" | |
from zigpy.profiles import zha | |
from zigpy.quirks import CustomDevice | |
from zigpy.zcl.clusters.general import ( | |
Basic, | |
Groups, | |
Identify, | |
LevelControl, | |
OnOff, | |
Ota, | |
PowerConfiguration, | |
Scenes, | |
Time, | |
) | |
from zigpy.zcl.clusters.lightlink import LightLink | |
from zhaquirks.const import ( | |
BUTTON, | |
BUTTON_1, | |
BUTTON_2, | |
BUTTON_3, | |
BUTTON_4, | |
CLUSTER_ID, | |
COMMAND, | |
COMMAND_MOVE, | |
COMMAND_MOVE_SATURATION, | |
COMMAND_OFF, | |
COMMAND_ON, | |
COMMAND_STEP, | |
COMMAND_STOP, | |
COMMAND_STOP_MOVE_STEP, | |
COMMAND_TOGGLE, | |
DEVICE_TYPE, | |
DIM_DOWN, | |
DIM_UP, | |
DOUBLE_PRESS, | |
ENDPOINT_ID, | |
ENDPOINTS, | |
INPUT_CLUSTERS, | |
LEFT, | |
LONG_PRESS, | |
LONG_RELEASE, | |
MODEL, | |
MODELS_INFO, | |
OUTPUT_CLUSTERS, | |
PARAMS, | |
PROFILE_ID, | |
RIGHT, | |
SHORT_PRESS, | |
TURN_OFF, | |
TURN_ON, | |
) | |
from zhaquirks.tuya import TuyaZBOnOffAttributeCluster, TuyaZBExternalSwitchTypeCluster | |
class LidlSmartRemote004F(CustomDevice): | |
"""Lidl one button smart remote - model SSBM A1""" | |
signature = { | |
# "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)", | |
# SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=2080, device_version=1, input_clusters=[0, 1, 3, 4, 4096, 57345], output_clusters=[3, 4, 5, 6, 8, 10, 25, 4096]) | |
MODEL: "TS004F", | |
ENDPOINTS: { | |
1: { | |
PROFILE_ID: zha.PROFILE_ID, | |
DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH, | |
INPUT_CLUSTERS: [ | |
Basic.cluster_id, | |
PowerConfiguration.cluster_id, | |
Identify.cluster_id, | |
Groups.cluster_id, | |
OnOff.cluster_id, | |
LightLink.cluster_id, | |
TuyaZBExternalSwitchTypeCluster.cluster_id, | |
], | |
OUTPUT_CLUSTERS: [ | |
Ota.cluster_id, | |
Time.cluster_id, | |
Identify.cluster_id, | |
Groups.cluster_id, | |
Scenes.cluster_id, | |
OnOff.cluster_id, | |
LevelControl.cluster_id, | |
LightLink.cluster_id, | |
], | |
}, | |
}, | |
} | |
replacement = { | |
ENDPOINTS: { | |
1: { | |
PROFILE_ID: zha.PROFILE_ID, | |
DEVICE_TYPE: zha.DeviceType.NON_COLOR_CONTROLLER, | |
INPUT_CLUSTERS: [ | |
Basic.cluster_id, | |
PowerConfiguration.cluster_id, | |
Identify.cluster_id, | |
Groups.cluster_id, # Is needed for adding group then binding is not working. | |
LightLink.cluster_id, | |
TuyaZBExternalSwitchTypeCluster, | |
], | |
OUTPUT_CLUSTERS: [ | |
Ota.cluster_id, | |
Time.cluster_id, | |
Identify.cluster_id, | |
Groups.cluster_id, | |
Scenes.cluster_id, | |
TuyaZBOnOffAttributeCluster, | |
LevelControl.cluster_id, | |
LightLink.cluster_id, | |
], | |
}, | |
}, | |
} | |
device_automation_triggers = { | |
(SHORT_PRESS, BUTTON): {COMMAND: COMMAND_ON, ENDPOINT_ID: 1}, | |
(DOUBLE_PRESS, BUTTON): {COMMAND: COMMAND_OFF, ENDPOINT_ID: 1}, | |
(LONG_PRESS, BUTTON): {COMMAND: COMMAND_STEP, ENDPOINT_ID: 1}, | |
(LONG_RELEASE, BUTTON): {COMMAND: COMMAND_STOP, ENDPOINT_ID: 1}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment