Skip to content

Commit

Permalink
Merge branch 'release/0.0.41'
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed Jun 29, 2020
2 parents 1fbb273 + 531b7d4 commit e183cb1
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 1 deletion.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,28 @@ Please refer to [xbee.md](xbee.md) for details on configuration and usage exampl

- All supported devices report battery level

# Testing new releases

Testing a new release of the zha-quirks package before it is released in Home Assistant.

If you are using Supervised Home Assistant (formerly known as the Hassio/Hass.io distro):
- Add https://github.com/home-assistant/hassio-addons-development as "add-on" repository
- Install "Custom deps deployment" addon
- Update config like:
```
pypi:
- zha-quirks==0.0.38
apk: []
```
where 0.0.38 is the new version
- Start the addon

If you are instead using some custom python installation of Home Assistant then do this:
- Activate your python virtual env
- Update package with ``pip``
```
pip install zha-quirks==0.0.38
# Thanks
- Special thanks to damarco for the majority of the device tracker code
Expand Down
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.40"
VERSION = "0.0.41"


def readme():
Expand Down
39 changes: 39 additions & 0 deletions zhaquirks/legrand/dimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,42 @@ class DimmerWithoutNeutral(CustomDevice):
}
}
}


class DimmerWithoutNeutral2(DimmerWithoutNeutral):
"""Dimmer switch w/o neutral 2."""

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,
],
},
242: {
PROFILE_ID: 41440,
DEVICE_TYPE: 0x0061,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [0x0021],
},
},
}
1 change: 1 addition & 0 deletions zhaquirks/philips/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
"""Module for Phillips quirks implementations."""
PHILLIPS = "Philips"
115 changes: 115 additions & 0 deletions zhaquirks/philips/sml002.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
"""Quirk for Phillips SML002."""
from zigpy.profiles import zha, zll
from zigpy.quirks import CustomCluster, CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import (
Basic,
Groups,
Identify,
LevelControl,
OnOff,
Ota,
PowerConfiguration,
Scenes,
)
from zigpy.zcl.clusters.lighting import Color
from zigpy.zcl.clusters.measurement import (
IlluminanceMeasurement,
OccupancySensing,
TemperatureMeasurement,
)

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


class OccupancyCluster(CustomCluster, OccupancySensing):
"""Phillips occupancy cluster."""

attributes = OccupancySensing.attributes.copy()
attributes.update({0x0030: ("sensitivity", t.uint8_t)})
attributes.update({0x0031: ("sensitivity_max", t.uint8_t)})


class PhilipsSML002(CustomDevice):
"""Phillips SML002 device."""

signature = {
MODELS_INFO: [(PHILLIPS, "SML002")],
ENDPOINTS: {
# <SimpleDescriptor endpoint=1 profile=49246 device_type=0x0850
# device_version=?
# input_clusters=[0]
# output_clusters=[0, 3, 4, 5, 6, 8, 768]>
1: {
PROFILE_ID: zll.PROFILE_ID,
DEVICE_TYPE: zll.DeviceType.ON_OFF_SENSOR,
INPUT_CLUSTERS: [Basic.cluster_id],
OUTPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Color.cluster_id,
],
},
# <SimpleDescriptor endpoint=2 profile=260 device_type=0x0107
# device_version=?
# input_clusters=[0, 1, 3, 1024, 1026, 1030]
# output_clusters=[25]>
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
IlluminanceMeasurement.cluster_id,
TemperatureMeasurement.cluster_id,
OccupancySensing.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
},
}

replacement = {
ENDPOINTS: {
1: {
PROFILE_ID: zll.PROFILE_ID,
DEVICE_TYPE: zll.DeviceType.ON_OFF_SENSOR,
INPUT_CLUSTERS: [Basic.cluster_id],
OUTPUT_CLUSTERS: [
Basic.cluster_id,
Identify.cluster_id,
Groups.cluster_id,
Scenes.cluster_id,
OnOff.cluster_id,
LevelControl.cluster_id,
Color.cluster_id,
],
},
2: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.OCCUPANCY_SENSOR,
INPUT_CLUSTERS: [
Basic.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
IlluminanceMeasurement.cluster_id,
TemperatureMeasurement.cluster_id,
OccupancyCluster,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
}
}
3 changes: 3 additions & 0 deletions zhaquirks/plaid/soil.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class PowerConfigurationClusterMains(PowerConfigurationCluster):
"""Common use power configuration cluster."""

MAINS_VOLTAGE_ATTR = 0x0000
ATTR_ID_BATT_SIZE = 0x0031
ATTR_ID_BATT_QTY = 0x0033
_CONSTANT_ATTRIBUTES = {ATTR_ID_BATT_SIZE: 0x08, ATTR_ID_BATT_QTY: 1}

def _update_attribute(self, attrid, value):
super()._update_attribute(attrid, value)
Expand Down
18 changes: 18 additions & 0 deletions zhaquirks/smartthings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import zigpy.types as t
from zigpy.quirks import CustomCluster
from zigpy.zcl.clusters.security import IasZone

SMART_THINGS = "SmartThings"
MANUFACTURER_SPECIFIC_CLUSTER_ID = 0xFC02 # decimal = 64514
Expand All @@ -24,3 +25,20 @@ class SmartThingsAccelCluster(CustomCluster):

client_commands = {}
server_commands = {}


class SmartThingsIasZone(CustomCluster, IasZone):
"""IasZone cluster patched to support SmartThings spec violations."""

client_commands = IasZone.client_commands.copy()
client_commands[0x0000] = (
"status_change_notification",
(
IasZone.ZoneStatus,
t.bitmap8,
# SmartThings never sends these two
t.Optional(t.uint8_t),
t.Optional(t.uint16_t),
),
False,
)
59 changes: 59 additions & 0 deletions zhaquirks/smartthings/pgc313.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""SmartThings SmartSense Multi Sensor quirk."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, Ota

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

SMARTSENSE_MULTI_DEVICE_TYPE = 0x0139 # decimal = 313


class IasZoneContactSwitchCluster(SmartThingsIasZone):
"""Custom IasZone cluster."""

ZONE_TYPE = 0x0001
CONTACT_SWITCH_TYPE = 0x0015
_CONSTANT_ATTRIBUTES = {ZONE_TYPE: CONTACT_SWITCH_TYPE}


class SmartthingsSmartSenseMultiSensor(CustomDevice):
"""Multipurpose sensor."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=313
# device_version=0 input_clusters=[0] output_clusters=[25]>
MODELS_INFO: [(SMART_THINGS, "PGC313")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: SMARTSENSE_MULTI_DEVICE_TYPE,
INPUT_CLUSTERS: [Basic.cluster_id],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
# <SimpleDescriptor endpoint=2 profile=64513 device_type=313
# device_version=0 input_clusters=[] output_clusters=[]>
2: {
PROFILE_ID: 0xFC01, # decimal = 64513
DEVICE_TYPE: SMARTSENSE_MULTI_DEVICE_TYPE,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [],
},
},
}

replacement = {
ENDPOINTS: {
1: {
INPUT_CLUSTERS: [Basic.cluster_id, IasZoneContactSwitchCluster],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
}
}
59 changes: 59 additions & 0 deletions zhaquirks/smartthings/pgc314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
"""SmartThings SmartSense Motion quirk."""
from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, Ota

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

SMARTSENSE_MOTION_DEVICE_TYPE = 0x013A # decimal = 314


class IasZoneMotionCluster(SmartThingsIasZone):
"""Custom IasZone cluster."""

ZONE_TYPE = 0x0001
MOTION_TYPE = 0x000D
_CONSTANT_ATTRIBUTES = {ZONE_TYPE: MOTION_TYPE}


class SmartthingsSmartSenseMotionSensor(CustomDevice):
"""SmartSense Motion Sensor."""

signature = {
# <SimpleDescriptor endpoint=1 profile=260 device_type=314
# device_version=0 input_clusters=[0] output_clusters=[25]>
MODELS_INFO: [(SMART_THINGS, "PGC314")],
ENDPOINTS: {
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: SMARTSENSE_MOTION_DEVICE_TYPE,
INPUT_CLUSTERS: [Basic.cluster_id],
OUTPUT_CLUSTERS: [Ota.cluster_id],
},
# <SimpleDescriptor endpoint=2 profile=64513 device_type=314
# device_version=0 input_clusters=[] output_clusters=[]>
2: {
PROFILE_ID: 0xFC01, # decimal = 64513
DEVICE_TYPE: SMARTSENSE_MOTION_DEVICE_TYPE,
INPUT_CLUSTERS: [],
OUTPUT_CLUSTERS: [],
},
},
}

replacement = {
ENDPOINTS: {
1: {
INPUT_CLUSTERS: [Basic.cluster_id, IasZoneMotionCluster],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
}
}
Loading

0 comments on commit e183cb1

Please sign in to comment.