-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
667 additions
and
266 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"""Module for Legrand devices.""" | ||
LEGRAND = "Legrand" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
"""Device handler for Legrand Dimmer switch w/o neutral.""" | ||
from zigpy.profiles import zha | ||
from zigpy.quirks import CustomCluster, CustomDevice | ||
import zigpy.types as t | ||
from zigpy.zcl.clusters.general import ( | ||
Basic, | ||
BinaryInput, | ||
Groups, | ||
Identify, | ||
LevelControl, | ||
OnOff, | ||
Ota, | ||
Scenes, | ||
) | ||
from zigpy.zcl.clusters.manufacturer_specific import ManufacturerSpecificCluster | ||
|
||
from . import LEGRAND | ||
from ..const import ( | ||
DEVICE_TYPE, | ||
ENDPOINTS, | ||
INPUT_CLUSTERS, | ||
MODELS_INFO, | ||
OUTPUT_CLUSTERS, | ||
PROFILE_ID, | ||
) | ||
|
||
MANUFACTURER_SPECIFIC_CLUSTER_ID = 0xFC01 # decimal = 64513 | ||
|
||
|
||
class LegrandCluster(CustomCluster, ManufacturerSpecificCluster): | ||
"""LegrandCluster.""" | ||
|
||
cluster_id = MANUFACTURER_SPECIFIC_CLUSTER_ID | ||
name = "LegrandCluster" | ||
ep_attribute = "legrand_cluster" | ||
attributes = { | ||
0x0000: ("dimmer", t.data16), | ||
0x0001: ("led_dark", t.Bool), | ||
0x0002: ("led_on", t.Bool), | ||
} | ||
server_commands = {} | ||
client_commands = {} | ||
|
||
|
||
class DimmerWithoutNeutral(CustomDevice): | ||
"""Dimmer switch w/o neutral.""" | ||
|
||
signature = { | ||
# <SimpleDescriptor endpoint=1 profile=260 device_type=256 | ||
# device_version=1 | ||
# input_clusters=[0, 3, 4, 8, 6, 5, 15, 64513] | ||
# output_clusters=[0, 64513, 25]> | ||
MODELS_INFO: [(f" {LEGRAND}", " Dimmer switch w/o neutral")], | ||
ENDPOINTS: { | ||
1: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Groups.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
Scenes.cluster_id, | ||
BinaryInput.cluster_id, | ||
MANUFACTURER_SPECIFIC_CLUSTER_ID, | ||
], | ||
OUTPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
MANUFACTURER_SPECIFIC_CLUSTER_ID, | ||
Ota.cluster_id, | ||
], | ||
} | ||
}, | ||
} | ||
|
||
replacement = { | ||
ENDPOINTS: { | ||
1: { | ||
PROFILE_ID: zha.PROFILE_ID, | ||
DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, | ||
INPUT_CLUSTERS: [ | ||
Basic.cluster_id, | ||
Identify.cluster_id, | ||
Groups.cluster_id, | ||
OnOff.cluster_id, | ||
LevelControl.cluster_id, | ||
Scenes.cluster_id, | ||
BinaryInput.cluster_id, | ||
LegrandCluster, | ||
], | ||
OUTPUT_CLUSTERS: [Basic.cluster_id, LegrandCluster, Ota.cluster_id], | ||
} | ||
} | ||
} |
Oops, something went wrong.