ZHA: Added support for ZigBee Simple Sensor device and Binary Input c… ()

* ZHA: Added support for ZigBee Simple Sensor device and Binary Input cluster

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Alexei Chetroi <lexoid@gmail.com>
pull/55831/head
Witold Sowa 2021-09-06 07:41:57 +02:00 committed by GitHub
parent 523998f8a1
commit 8565821394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 3 deletions
homeassistant/components/zha
tests/components/zha

View File

@ -20,6 +20,7 @@ from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .core import discovery
from .core.const import (
CHANNEL_ACCELEROMETER,
CHANNEL_BINARY_INPUT,
CHANNEL_OCCUPANCY,
CHANNEL_ON_OFF,
CHANNEL_ZONE,
@ -136,6 +137,13 @@ class Opening(BinarySensor):
DEVICE_CLASS = DEVICE_CLASS_OPENING
@STRICT_MATCH(channel_names=CHANNEL_BINARY_INPUT)
class BinaryInput(BinarySensor):
"""ZHA BinarySensor."""
SENSOR_ATTR = "present_value"
@STRICT_MATCH(
channel_names=CHANNEL_ON_OFF,
manufacturers="IKEA of Sweden",

View File

@ -73,6 +73,7 @@ BAUD_RATES = [2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 128000, 2560
BINDINGS = "bindings"
CHANNEL_ACCELEROMETER = "accelerometer"
CHANNEL_BINARY_INPUT = "binary_input"
CHANNEL_ANALOG_INPUT = "analog_input"
CHANNEL_ANALOG_OUTPUT = "analog_output"
CHANNEL_ATTRIBUTE = "attribute"

View File

@ -66,6 +66,7 @@ SINGLE_INPUT_CLUSTER_DEVICE_CLASS = {
VOC_LEVEL_CLUSTER: SENSOR,
zcl.clusters.closures.DoorLock.cluster_id: LOCK,
zcl.clusters.closures.WindowCovering.cluster_id: COVER,
zcl.clusters.general.BinaryInput.cluster_id: BINARY_SENSOR,
zcl.clusters.general.AnalogInput.cluster_id: SENSOR,
zcl.clusters.general.AnalogOutput.cluster_id: NUMBER,
zcl.clusters.general.MultistateInput.cluster_id: SENSOR,

View File

@ -1398,6 +1398,11 @@ DEVICES = [
"entity_class": "ElectricalMeasurement",
"entity_id": "sensor.lumi_lumi_plug_maus01_77665544_electrical_measurement",
},
("binary_sensor", "00:11:22:33:44:55:66:77-100-15"): {
"channels": ["binary_input"],
"entity_class": "BinaryInput",
"entity_id": "binary_sensor.lumi_lumi_plug_maus01_77665544_binary_input",
},
},
"event_channels": ["1:0x0019"],
"manufacturer": "LUMI",
@ -2659,7 +2664,12 @@ DEVICES = [
"channels": ["power"],
"entity_class": "Battery",
"entity_id": "sensor.philips_rwl020_77665544_power",
}
},
("binary_sensor", "00:11:22:33:44:55:66:77-2-15"): {
"channels": ["binary_input"],
"entity_class": "BinaryInput",
"entity_id": "binary_sensor.philips_rwl020_77665544_binary_input",
},
},
"event_channels": ["1:0x0005", "1:0x0006", "1:0x0008", "2:0x0019"],
"manufacturer": "Philips",
@ -2741,7 +2751,7 @@ DEVICES = [
},
("binary_sensor", "00:11:22:33:44:55:66:77-1-64514"): {
"channels": ["manufacturer_specific"],
"entity_class": "BinarySensor",
"entity_class": "BinaryInput",
"entity_id": "binary_sensor.samjin_multi_77665544_manufacturer_specific",
"default_match": True,
},
@ -3099,6 +3109,11 @@ DEVICES = [
"entity_class": "ElectricalMeasurement",
"entity_id": "sensor.smartthings_outletv4_77665544_electrical_measurement",
},
("binary_sensor", "00:11:22:33:44:55:66:77-1-15"): {
"channels": ["binary_input"],
"entity_class": "BinaryInput",
"entity_id": "binary_sensor.smartthings_outletv4_77665544_binary_input",
},
},
"event_channels": ["1:0x0019"],
"manufacturer": "SmartThings",
@ -3122,7 +3137,12 @@ DEVICES = [
"channels": ["power"],
"entity_class": "ZHADeviceScannerEntity",
"entity_id": "device_tracker.smartthings_tagv4_77665544_power",
}
},
("binary_sensor", "00:11:22:33:44:55:66:77-1-15"): {
"channels": ["binary_input"],
"entity_class": "BinaryInput",
"entity_id": "binary_sensor.smartthings_tagv4_77665544_binary_input",
},
},
"event_channels": ["1:0x0019"],
"manufacturer": "SmartThings",