Skip to content

Commit

Permalink
Update switch.py to match device-handler PR
Browse files Browse the repository at this point in the history
  • Loading branch information
claudegel authored Nov 18, 2023
1 parent 31bad03 commit 335ded4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@
)
from zigpy.zcl.clusters.homeautomation import Diagnostic, ElectricalMeasurement
from zigpy.zcl.clusters.lightlink import LightLink
from zigpy.zcl.clusters.measurement import RelativeHumidity, TemperatureMeasurement, FlowMeasurement
from zigpy.zcl.clusters.measurement import (
RelativeHumidity,
TemperatureMeasurement,
FlowMeasurement,
)
from zigpy.zcl.clusters.security import IasZone
from zigpy.zcl.clusters.smartenergy import Metering

from zigpy.zcl.foundation import Array

from zhaquirks.const import (
Expand Down Expand Up @@ -66,18 +69,18 @@ class AlarmAction(t.enum8):
Close_notify = 0x03

class PowerSource(t.uint32_t):
"""Valve power souce types."""
"""Valve power source types."""

Battery = 0x00000000
ACUPS_01 = 0x00000001
DC_power = 0x0001d4c0
DC_power = 0x0001d4C0

class EmergencyPower(t.uint32_t):
"""Valve emergency power souce types."""
"""Valve emergency power source types."""

Battery = 0x00000000
ACUPS_01 = 0x00000001
Battery_ACUPS_01 = 0x0000003c
Battery_ACUPS_01 = 0x0000003C

class AbnormalAction(t.bitmap16):
"""Action in case of abnormal flow detected."""
Expand Down Expand Up @@ -203,15 +206,15 @@ class CustomDeviceTemperatureCluster(CustomCluster, DeviceTemperature):

def _update_attribute(self, attrid, value):
if attrid == 0x0000:
super()._update_attribute(attrid, value*100)
super()._update_attribute(attrid, value * 100)


class CustomFlowMeasurementCluster(CustomCluster, FlowMeasurement):
"""Custom FlowMeasurement Cluster."""

def _update_attribute(self, attrid, value):
if attrid == 0x0000:
super()._update_attribute(attrid, value/10)
super()._update_attribute(attrid, value / 10)


class SinopeTechnologiesSwitch(CustomDevice):
Expand Down

0 comments on commit 335ded4

Please sign in to comment.