Skip to content

Commit 956db90

Browse files
AtokulusMarkus Wegmann
andauthored
Add initial support for Siglis zigfred plus smart switch (#1594)
* WIP zigfred support * Change cluster id to 0xFC42 for zigfred support (requires firmware 28) * Add support for custom button event command * Fix device automations not showing up for zigfred * Some linting * Remove commented out code in Siglis zigfred integration * Initial support for Siglis zigfred plus smart switch * Do some linting * Fix import of WindowCovering * Reorder imports Co-authored-by: Markus Wegmann <[email protected]>
1 parent a54b2c7 commit 956db90

File tree

1 file changed

+275
-0
lines changed

1 file changed

+275
-0
lines changed

zhaquirks/siglis/zigfred.py

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from zigpy.quirks import CustomCluster, CustomDevice
77
import zigpy.types as t
88
from zigpy.zcl import foundation
9+
from zigpy.zcl.clusters.closures import WindowCovering
910
from zigpy.zcl.clusters.general import (
1011
Basic,
1112
GreenPowerProxy,
@@ -261,3 +262,277 @@ def __init__(self, *args, **kwargs):
261262
(LONG_RELEASE, BUTTON_3): {COMMAND: f"{BUTTON_3}_{LONG_RELEASE}"},
262263
(LONG_RELEASE, BUTTON_4): {COMMAND: f"{BUTTON_4}_{LONG_RELEASE}"},
263264
}
265+
266+
267+
class ZigfredPlus(CustomDevice):
268+
"""zigfred plus device handler."""
269+
270+
def __init__(self, *args, **kwargs):
271+
"""Init."""
272+
_LOGGER.info("Initializing zigfred plus")
273+
super().__init__(*args, **kwargs)
274+
275+
signature = {
276+
MODELS_INFO: [("Siglis", "zigfred plus")],
277+
ENDPOINTS: {
278+
5: {
279+
# Front Module LED
280+
# SizePrefixedSimpleDescriptor(endpoint=5,
281+
# profile=260, device_type=258,
282+
# device_version=1,
283+
# input_clusters=[0, 3, 4, 5, 6, 8, 768, 837],
284+
# output_clusters=[])
285+
PROFILE_ID: zha.PROFILE_ID,
286+
DEVICE_TYPE: zha.DeviceType.COLOR_DIMMABLE_LIGHT,
287+
INPUT_CLUSTERS: [
288+
Basic.cluster_id,
289+
Identify.cluster_id,
290+
Groups.cluster_id,
291+
Scenes.cluster_id,
292+
OnOff.cluster_id,
293+
LevelControl.cluster_id,
294+
Color.cluster_id,
295+
ZigfredCluster.cluster_id,
296+
],
297+
OUTPUT_CLUSTERS: [],
298+
},
299+
7: {
300+
# Dimmable Light 1
301+
# SizePrefixedSimpleDescriptor(endpoint=7,
302+
# profile=260, device_type=257,
303+
# device_version=1,
304+
# input_clusters=[0, 3, 5, 4, 6, 8],
305+
# output_clusters=[])
306+
PROFILE_ID: zha.PROFILE_ID,
307+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
308+
INPUT_CLUSTERS: [
309+
Basic.cluster_id,
310+
Identify.cluster_id,
311+
Groups.cluster_id,
312+
Scenes.cluster_id,
313+
OnOff.cluster_id,
314+
LevelControl.cluster_id,
315+
],
316+
OUTPUT_CLUSTERS: [],
317+
},
318+
8: {
319+
# Dimmable Light 2
320+
# SizePrefixedSimpleDescriptor(endpoint=8,
321+
# profile=260, device_type=257,
322+
# device_version=1,
323+
# input_clusters=[0, 3, 5, 4, 6, 8],
324+
# output_clusters=[])
325+
PROFILE_ID: zha.PROFILE_ID,
326+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
327+
INPUT_CLUSTERS: [
328+
Basic.cluster_id,
329+
Identify.cluster_id,
330+
Groups.cluster_id,
331+
Scenes.cluster_id,
332+
OnOff.cluster_id,
333+
LevelControl.cluster_id,
334+
],
335+
OUTPUT_CLUSTERS: [],
336+
},
337+
9: {
338+
# Dimmable Light 3
339+
# SizePrefixedSimpleDescriptor(endpoint=9,
340+
# profile=260, device_type=257,
341+
# device_version=1,
342+
# input_clusters=[0, 3, 5, 4, 6, 8],
343+
# output_clusters=[])
344+
PROFILE_ID: zha.PROFILE_ID,
345+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
346+
INPUT_CLUSTERS: [
347+
Basic.cluster_id,
348+
Identify.cluster_id,
349+
Groups.cluster_id,
350+
Scenes.cluster_id,
351+
OnOff.cluster_id,
352+
LevelControl.cluster_id,
353+
],
354+
OUTPUT_CLUSTERS: [],
355+
},
356+
10: {
357+
# Dimmable Light 4
358+
# SizePrefixedSimpleDescriptor(endpoint=10,
359+
# profile=260, device_type=257,
360+
# device_version=1,
361+
# input_clusters=[0, 3, 5, 4, 6, 8],
362+
# output_clusters=[])
363+
PROFILE_ID: zha.PROFILE_ID,
364+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
365+
INPUT_CLUSTERS: [
366+
Basic.cluster_id,
367+
Identify.cluster_id,
368+
Groups.cluster_id,
369+
Scenes.cluster_id,
370+
OnOff.cluster_id,
371+
LevelControl.cluster_id,
372+
],
373+
OUTPUT_CLUSTERS: [],
374+
},
375+
11: {
376+
# Window Cover 1
377+
# SizePrefixedSimpleDescriptor(endpoint=11,
378+
# profile=260, device_type=514,
379+
# device_version=1,
380+
# input_clusters=[0, 3, 5, 4, 258],
381+
# output_clusters=[])
382+
PROFILE_ID: zha.PROFILE_ID,
383+
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
384+
INPUT_CLUSTERS: [
385+
Basic.cluster_id,
386+
Identify.cluster_id,
387+
Groups.cluster_id,
388+
Scenes.cluster_id,
389+
WindowCovering.cluster_id,
390+
],
391+
OUTPUT_CLUSTERS: [],
392+
},
393+
12: {
394+
# Window Cover 1
395+
# SizePrefixedSimpleDescriptor(endpoint=12,
396+
# profile=260, device_type=514,
397+
# device_version=1,
398+
# input_clusters=[0, 3, 5, 4, 258],
399+
# output_clusters=[])
400+
PROFILE_ID: zha.PROFILE_ID,
401+
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
402+
INPUT_CLUSTERS: [
403+
Basic.cluster_id,
404+
Identify.cluster_id,
405+
Groups.cluster_id,
406+
Scenes.cluster_id,
407+
WindowCovering.cluster_id,
408+
],
409+
OUTPUT_CLUSTERS: [],
410+
},
411+
242: {
412+
# SizePrefixedSimpleDescriptor(endpoint=242,
413+
# profile=41440, device_type=97,
414+
# device_version=0,
415+
# input_clusters=[],
416+
# output_clusters=[33])
417+
PROFILE_ID: 41440,
418+
DEVICE_TYPE: 97,
419+
INPUT_CLUSTERS: [],
420+
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
421+
},
422+
},
423+
}
424+
425+
replacement = {
426+
ENDPOINTS: {
427+
5: {
428+
PROFILE_ID: zha.PROFILE_ID,
429+
DEVICE_TYPE: zha.DeviceType.COLOR_DIMMABLE_LIGHT,
430+
INPUT_CLUSTERS: [
431+
Basic.cluster_id,
432+
Identify.cluster_id,
433+
Groups.cluster_id,
434+
Scenes.cluster_id,
435+
OnOff.cluster_id,
436+
LevelControl.cluster_id,
437+
Color.cluster_id,
438+
ZigfredCluster,
439+
],
440+
OUTPUT_CLUSTERS: [],
441+
},
442+
7: {
443+
PROFILE_ID: zha.PROFILE_ID,
444+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
445+
INPUT_CLUSTERS: [
446+
Basic.cluster_id,
447+
Identify.cluster_id,
448+
Groups.cluster_id,
449+
Scenes.cluster_id,
450+
OnOff.cluster_id,
451+
LevelControl.cluster_id,
452+
],
453+
},
454+
8: {
455+
PROFILE_ID: zha.PROFILE_ID,
456+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
457+
INPUT_CLUSTERS: [
458+
Basic.cluster_id,
459+
Identify.cluster_id,
460+
Groups.cluster_id,
461+
Scenes.cluster_id,
462+
OnOff.cluster_id,
463+
LevelControl.cluster_id,
464+
],
465+
},
466+
9: {
467+
PROFILE_ID: zha.PROFILE_ID,
468+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
469+
INPUT_CLUSTERS: [
470+
Basic.cluster_id,
471+
Identify.cluster_id,
472+
Groups.cluster_id,
473+
Scenes.cluster_id,
474+
OnOff.cluster_id,
475+
LevelControl.cluster_id,
476+
],
477+
},
478+
10: {
479+
PROFILE_ID: zha.PROFILE_ID,
480+
DEVICE_TYPE: zha.DeviceType.DIMMABLE_LIGHT,
481+
INPUT_CLUSTERS: [
482+
Basic.cluster_id,
483+
Identify.cluster_id,
484+
Groups.cluster_id,
485+
Scenes.cluster_id,
486+
OnOff.cluster_id,
487+
LevelControl.cluster_id,
488+
],
489+
},
490+
11: {
491+
PROFILE_ID: zha.PROFILE_ID,
492+
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
493+
INPUT_CLUSTERS: [
494+
Basic.cluster_id,
495+
Identify.cluster_id,
496+
Groups.cluster_id,
497+
Scenes.cluster_id,
498+
WindowCovering.cluster_id,
499+
],
500+
},
501+
12: {
502+
PROFILE_ID: zha.PROFILE_ID,
503+
DEVICE_TYPE: zha.DeviceType.WINDOW_COVERING_DEVICE,
504+
INPUT_CLUSTERS: [
505+
Basic.cluster_id,
506+
Identify.cluster_id,
507+
Groups.cluster_id,
508+
Scenes.cluster_id,
509+
WindowCovering.cluster_id,
510+
],
511+
},
512+
242: {
513+
PROFILE_ID: 41440,
514+
DEVICE_TYPE: 97,
515+
INPUT_CLUSTERS: [],
516+
OUTPUT_CLUSTERS: [GreenPowerProxy.cluster_id],
517+
},
518+
},
519+
}
520+
521+
device_automation_triggers = {
522+
(SHORT_PRESS, BUTTON_1): {COMMAND: f"{BUTTON_1}_{SHORT_PRESS}"},
523+
(SHORT_PRESS, BUTTON_2): {COMMAND: f"{BUTTON_2}_{SHORT_PRESS}"},
524+
(SHORT_PRESS, BUTTON_3): {COMMAND: f"{BUTTON_3}_{SHORT_PRESS}"},
525+
(SHORT_PRESS, BUTTON_4): {COMMAND: f"{BUTTON_4}_{SHORT_PRESS}"},
526+
(DOUBLE_PRESS, BUTTON_1): {COMMAND: f"{BUTTON_1}_{DOUBLE_PRESS}"},
527+
(DOUBLE_PRESS, BUTTON_2): {COMMAND: f"{BUTTON_2}_{DOUBLE_PRESS}"},
528+
(DOUBLE_PRESS, BUTTON_3): {COMMAND: f"{BUTTON_3}_{DOUBLE_PRESS}"},
529+
(DOUBLE_PRESS, BUTTON_4): {COMMAND: f"{BUTTON_4}_{DOUBLE_PRESS}"},
530+
(LONG_PRESS, BUTTON_1): {COMMAND: f"{BUTTON_1}_{LONG_PRESS}"},
531+
(LONG_PRESS, BUTTON_2): {COMMAND: f"{BUTTON_2}_{LONG_PRESS}"},
532+
(LONG_PRESS, BUTTON_3): {COMMAND: f"{BUTTON_3}_{LONG_PRESS}"},
533+
(LONG_PRESS, BUTTON_4): {COMMAND: f"{BUTTON_4}_{LONG_PRESS}"},
534+
(LONG_RELEASE, BUTTON_1): {COMMAND: f"{BUTTON_1}_{LONG_RELEASE}"},
535+
(LONG_RELEASE, BUTTON_2): {COMMAND: f"{BUTTON_2}_{LONG_RELEASE}"},
536+
(LONG_RELEASE, BUTTON_3): {COMMAND: f"{BUTTON_3}_{LONG_RELEASE}"},
537+
(LONG_RELEASE, BUTTON_4): {COMMAND: f"{BUTTON_4}_{LONG_RELEASE}"},
538+
}

0 commit comments

Comments
 (0)