Skip to content

Commit

Permalink
Merge branch 'release/0.0.27'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed Nov 8, 2019
2 parents 178708e + 93f657a commit 47fe8f3
Show file tree
Hide file tree
Showing 13 changed files with 262 additions and 30 deletions.
1 change: 0 additions & 1 deletion script/check_format
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ cd "$(dirname "$0")/.."
black \
--check \
--fast \
--quiet \
zhaquirks tests script *.py
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import find_packages, setup

VERSION = "0.0.26"
VERSION = "0.0.27"


def readme():
Expand Down
29 changes: 13 additions & 16 deletions zhaquirks/centralite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,20 @@ class PowerConfigurationCluster(CustomCluster, PowerConfiguration):
cluster_id = PowerConfiguration.cluster_id
BATTERY_VOLTAGE_ATTR = 0x0020
BATTERY_PERCENTAGE_REMAINING = 0x0021
MIN_VOLTS = 15
MAX_VOLTS = 28
MIN_VOLTS = 21
MAX_VOLTS = 31
VOLTS_TO_PERCENT = {
28: 100,
27: 100,
26: 100,
25: 90,
24: 90,
23: 70,
22: 70,
21: 50,
20: 50,
19: 30,
18: 30,
17: 15,
16: 1,
15: 0,
31: 100,
30: 90,
29: 80,
28: 70,
27: 60,
26: 50,
25: 40,
24: 30,
23: 20,
22: 10,
21: 0,
}

def _update_attribute(self, attrid, value):
Expand Down
1 change: 1 addition & 0 deletions zhaquirks/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
COMMAND_ID = "command_id"
COMMAND_MOVE = "move"
COMMAND_MOVE_ON_OFF = "move_with_on_off"
COMMAND_MOVE_TO_LEVEL_ON_OFF = "move_to_level_with_on_off"
COMMAND_OFF = "off"
COMMAND_OFF_WITH_EFFECT = "off_with_effect"
COMMAND_ON = "on"
Expand Down
39 changes: 39 additions & 0 deletions zhaquirks/lutron/lzl4bwhl01remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,24 @@
from zhaquirks import GroupBoundCluster

from ..const import (
ARGS,
CLUSTER_ID,
COMMAND,
COMMAND_MOVE_TO_LEVEL_ON_OFF,
COMMAND_STEP,
COMMAND_STEP_ON_OFF,
DEVICE_TYPE,
DIM_DOWN,
DIM_UP,
ENDPOINT_ID,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
SHORT_PRESS,
TURN_OFF,
TURN_ON,
)

MANUFACTURER_SPECIFIC_CLUSTER_ID_1 = 0xFF00 # decimal = 65280
Expand Down Expand Up @@ -96,6 +108,33 @@ class LutronLZL4BWHL01Remote(CustomDevice):
}
}

device_automation_triggers = {
(SHORT_PRESS, TURN_ON): {
COMMAND: COMMAND_MOVE_TO_LEVEL_ON_OFF,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [254, 4],
},
(SHORT_PRESS, TURN_OFF): {
COMMAND: COMMAND_MOVE_TO_LEVEL_ON_OFF,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [0, 4],
},
(SHORT_PRESS, DIM_UP): {
COMMAND: COMMAND_STEP_ON_OFF,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [0, 30, 6],
},
(SHORT_PRESS, DIM_DOWN): {
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [1, 30, 6],
},
}


class LutronLZL4BWHL01Remote2(LutronLZL4BWHL01Remote):
"""Custom device representing Lutron LZL4BWHL01 Remote."""
Expand Down
2 changes: 1 addition & 1 deletion zhaquirks/philips/rwl021.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class PhilipsRWL021(CustomDevice):
COMMAND: COMMAND_STEP,
CLUSTER_ID: 8,
ENDPOINT_ID: 1,
ARGS: [1, 56, 9],
ARGS: [1, 30, 9],
},
(LONG_PRESS, DIM_DOWN): {
COMMAND: COMMAND_STEP,
Expand Down
76 changes: 76 additions & 0 deletions zhaquirks/smartthings/moisturev4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""Device handler for smartthings moistureV4 sensor."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, BinaryInput, Identify, Ota, PollControl
from zigpy.zcl.clusters.measurement import TemperatureMeasurement
from zigpy.zcl.clusters.security import IasZone

from zhaquirks.centralite import PowerConfigurationCluster

from . import SMART_THINGS
from ..const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)


class CustomIasZone(IasZone):
"""Custom IasZone cluster."""

MOISTURE_TYPE = 0x002A
ZONE_TYPE = 0x0001

def _update_attribute(self, attrid, value):
if attrid == self.ZONE_TYPE:
super()._update_attribute(attrid, self.MOISTURE_TYPE)
else:
super()._update_attribute(attrid, value)


class SmartThingsMoistureV4(CustomDevice):
"""SmartThingsMoistureV4."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=1026
# device_version=0
# input_clusters=[0, 1, 3, 15, 1026, 1280, 32]
# output_clusters=[25]>
MODELS_INFO: [(SMART_THINGS, "moisturev4")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfigurationCluster.cluster_id,
Identify.cluster_id,
BinaryInput.cluster_id,
PollControl.cluster_id,
TemperatureMeasurement.cluster_id,
IasZone.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
},
}

replacement = {
ENDPOINTS: {
1: {
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfigurationCluster,
Identify.cluster_id,
BinaryInput.cluster_id,
PollControl.cluster_id,
TemperatureMeasurement.cluster_id,
CustomIasZone,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Device handler for smartthings IAS V4 sensors."""
"""Device handler for smartthings motionV4 sensors."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, BinaryInput, Identify, Ota, PollControl
Expand All @@ -18,15 +18,15 @@
)


class SmartThingsIASV4(CustomDevice):
"""SmartThingsIASV4."""
class SmartThingsMotionV4(CustomDevice):
"""SmartThingsMotionV4."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=1026
# device_version=0
# input_clusters=[0, 1, 3, 15, 1026, 1280, 32]
# output_clusters=[25]>
MODELS_INFO: [(SMART_THINGS, "motionv4"), (SMART_THINGS, "moisturev4")],
MODELS_INFO: [(SMART_THINGS, "motionv4")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
Expand Down
Loading

0 comments on commit 47fe8f3

Please sign in to comment.