From 523c3089f7aaab51edaad157989b109d97b88095 Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Mon, 7 Nov 2022 14:54:43 +0100 Subject: [PATCH] Add TI router transmit power config entity to ZHA (#81520) Make TI Router Transmit Power configurable in ZHA --- .../components/zha/core/channels/general.py | 6 ++++++ homeassistant/components/zha/number.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/homeassistant/components/zha/core/channels/general.py b/homeassistant/components/zha/core/channels/general.py index de68ed7d8ef..3756e3c1233 100644 --- a/homeassistant/components/zha/core/channels/general.py +++ b/homeassistant/components/zha/core/channels/general.py @@ -161,6 +161,12 @@ class BasicChannel(ZigbeeChannel): self.ZCL_INIT_ATTRS.copy() ) self.ZCL_INIT_ATTRS["trigger_indicator"] = True + elif ( + self.cluster.endpoint.manufacturer == "TexasInstruments" + and self.cluster.endpoint.model == "ti.router" + ): + self.ZCL_INIT_ATTRS = self.ZCL_INIT_ATTRS.copy() + self.ZCL_INIT_ATTRS["transmit_power"] = True @registries.ZIGBEE_CHANNEL_REGISTRY.register(general.BinaryInput.cluster_id) diff --git a/homeassistant/components/zha/number.py b/homeassistant/components/zha/number.py index 1776cabf125..853ab189bbf 100644 --- a/homeassistant/components/zha/number.py +++ b/homeassistant/components/zha/number.py @@ -19,6 +19,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from .core import discovery from .core.const import ( CHANNEL_ANALOG_OUTPUT, + CHANNEL_BASIC, CHANNEL_COLOR, CHANNEL_INOVELLI, CHANNEL_LEVEL, @@ -585,6 +586,20 @@ class FilterLifeTime(ZHANumberConfigurationEntity, id_suffix="filter_life_time") _attr_name = "Filter life time" +@CONFIG_DIAGNOSTIC_MATCH( + channel_names=CHANNEL_BASIC, + manufacturers={"TexasInstruments"}, + models={"ti.router"}, +) +class TiRouterTransmitPower(ZHANumberConfigurationEntity, id_suffix="transmit_power"): + """Representation of a ZHA TI transmit power configuration entity.""" + + _attr_native_min_value: float = -20 + _attr_native_max_value: float = 20 + _zcl_attribute: str = "transmit_power" + _attr_name = "Transmit power" + + @CONFIG_DIAGNOSTIC_MATCH(channel_names=CHANNEL_INOVELLI) class InovelliRemoteDimmingUpSpeed( ZHANumberConfigurationEntity, id_suffix="dimming_speed_up_remote"