Skip to content

Commit

Permalink
Rename attributes and cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJulianJES authored Oct 31, 2024
1 parent 069a408 commit d779286
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions zhaquirks/sonoff/zbminir2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@
from zigpy.zcl.foundation import BaseAttributeDefs, ZCLAttributeDef


class CustomSonoffCluster(CustomCluster):
class SonoffCluster(CustomCluster):
"""Custom Sonoff cluster."""

cluster_id = 0xFC11

class AttributeDefs(BaseAttributeDefs):
"""Attribute definitions."""

ExternalTriggerMode = ZCLAttributeDef(
name="ExternalTriggerMode",
external_trigger_mode = ZCLAttributeDef(
id=0x0016,
type=t.uint8_t,
)

DetachRelay = ZCLAttributeDef(
name="DetachRelay",
detach_relay = ZCLAttributeDef(
id=0x0017,
type=t.Bool,
)

TurboMode = ZCLAttributeDef(name="TurboMode", id=0x0012, type=t.int16s)
turbo_mode = ZCLAttributeDef(
id=0x0012,
type=t.int16s,
)

async def _read_attributes(
self,
Expand Down Expand Up @@ -63,21 +62,21 @@ class SonoffExternalSwitchTriggerType(types.enum8):
QuirkBuilder("SONOFF", "ZBMINIR2")
.replaces(CustomSonoffCluster)
.enum(
CustomSonoffCluster.AttributeDefs.ExternalTriggerMode.name,
SonoffCluster.AttributeDefs.external_trigger_mode.name,
SonoffExternalSwitchTriggerType,
CustomSonoffCluster.cluster_id,
SonoffCluster.cluster_id,
fallback_name="External Trigger Mode",
)
.switch(
CustomSonoffCluster.AttributeDefs.TurboMode.name,
CustomSonoffCluster.cluster_id,
SonoffCluster.AttributeDefs.turbo_mode.name,
SonoffCluster.cluster_id,
off_value=9,
on_value=20,
fallback_name="Turbo Mode",
)
.switch(
CustomSonoffCluster.AttributeDefs.DetachRelay.name,
CustomSonoffCluster.cluster_id,
SonoffCluster.AttributeDefs.detach_relay.name,
SonoffCluster.cluster_id,
off_value=0,
on_value=1,
fallback_name="Detach Relay",
Expand Down

0 comments on commit d779286

Please sign in to comment.