Skip to content

Commit

Permalink
Merge branch 'release/0.0.39'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed May 8, 2020
2 parents fe754af + ce2d590 commit 63f7209
Show file tree
Hide file tree
Showing 20 changed files with 667 additions and 266 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/dmulcahey/zha-device-handlers.svg?branch=master)](https://travis-ci.org/dmulcahey/zha-device-handlers)
[![Build Status](https://travis-ci.org/zigpy/zha-device-handlers.svg?branch=master)](https://travis-ci.org/zigpy/zha-device-handlers)

# ZHA Device Handlers For Home Assistant

Expand Down
1 change: 1 addition & 0 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ disable=
not-context-manager,
redefined-variable-type,
too-few-public-methods,
too-many-ancestors,
too-many-arguments,
too-many-branches,
too-many-instance-attributes,
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ pytest-timeout==1.3.3
pytest==5.1.2
requests_mock==1.6.0

zigpy-homeassistant==0.8.0
zigpy-homeassistant==0.18.1
homeassistant
4 changes: 2 additions & 2 deletions 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.38"
VERSION = "0.0.39"


def readme():
Expand All @@ -24,6 +24,6 @@ def readme():
keywords="zha quirks homeassistant hass",
packages=find_packages(exclude=["*.tests"]),
python_requires=">=3",
install_requires=["zigpy-homeassistant>=0.8.0"],
install_requires=["zigpy>=0.20.0"],
tests_require=["pytest"],
)
13 changes: 8 additions & 5 deletions tests/test_ctrl_neutral1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import zigpy.application
from zigpy.device import Device

from zhaquirks.xiaomi.aqara.ctrl_neutral1 import CtrlNeutral1
from zhaquirks.xiaomi.aqara.ctrl_neutral import CtrlNeutral


# zigbee-herdsman:controller:endpoint Command 0x00158d00024be541/2 genOnOff.on({},
Expand All @@ -24,7 +24,7 @@
# zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,13,36,1,31,255,2,1,6,0,16,0,30,3,1,7,0,198]


def test_ctrl_neutral1():
def test_ctrl_neutral():
"""Test ctrl neutral 1 sends correct request."""
sec = 8
ieee = 0
Expand All @@ -41,10 +41,13 @@ def test_ctrl_neutral1():
rep = Device(app, ieee, nwk)
rep.add_endpoint(1)
rep.add_endpoint(2)
rep.add_endpoint(3)

dev = CtrlNeutral(app, ieee, nwk, rep)
dev.request = mock.MagicMock()

dev = CtrlNeutral1(app, ieee, nwk, rep)
dev[2].in_clusters[cluster].command(1)

assert app.request.call_args == call(
dev, 260, cluster, src_ep, dst_ep, sec, data, expect_reply=True
assert dev.request.call_args == call(
260, cluster, src_ep, dst_ep, sec, data, expect_reply=True
)
33 changes: 33 additions & 0 deletions zhaquirks/centralite/ias.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,36 @@ class CentraLiteIASSensorV2(CustomDevice):
}

replacement = CentraLiteIASSensor.replacement


class CentraLiteIASSensorV3(CustomDevice):
"""Custom device representing centralite ias sensors."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=1026
# device_version=0
# input_clusters=[0, 1, 3, 32, 1026, 1280, 2821]
# output_clusters=[25]>
MODELS_INFO: CentraLiteIASSensor.signature[MODELS_INFO],
ENDPOINTS: {
1: CentraLiteIASSensor.signature[ENDPOINTS][1],
# <SimpleDescriptor endpoint=2 profile=49887 device_type=12
# device_version=0
# input_clusters=[0, 1, 3, 15, 2821]
# output_clusters=[3]>
2: {
PROFILE_ID: MANUFACTURER_SPECIFIC_PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.SIMPLE_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
BinaryInput.cluster_id,
PowerConfigurationCluster.cluster_id,
Identify.cluster_id,
DIAGNOSTICS_CLUSTER_ID,
],
OUTPUT_CLUSTERS: [Identify.cluster_id],
},
},
}

replacement = CentraLiteIASSensor.replacement
2 changes: 1 addition & 1 deletion zhaquirks/konke/temp.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class KonkeTempHumidity(CustomDevice):
# device_version=0
# input_clusters=[0, 1, 3, 1026, 1029]
# output_clusters=[3]>
MODELS_INFO: [(KONKE, "3AFE140103020000")],
MODELS_INFO: [(KONKE, "3AFE140103020000"), (KONKE, "3AFE220103020000")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
Expand Down
2 changes: 2 additions & 0 deletions zhaquirks/legrand/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Module for Legrand devices."""
LEGRAND = "Legrand"
95 changes: 95 additions & 0 deletions zhaquirks/legrand/dimmer.py
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],
}
}
}
Loading

0 comments on commit 63f7209

Please sign in to comment.