From f9ce315d1b1cf94d5dd1738d131d47fd3d7bba09 Mon Sep 17 00:00:00 2001 From: Tom Harris Date: Tue, 12 Sep 2023 19:10:40 +0000 Subject: [PATCH] Support for Insteon 4 button KeypadLink device (#100132) --- homeassistant/components/insteon/api/properties.py | 12 ++++++++++-- homeassistant/components/insteon/ipdb.py | 4 ++++ homeassistant/components/insteon/light.py | 8 ++++++++ homeassistant/components/insteon/manifest.json | 4 ++-- requirements_all.txt | 4 ++-- requirements_test_all.txt | 4 ++-- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/insteon/api/properties.py b/homeassistant/components/insteon/api/properties.py index 7350ab14743..80a76e482e5 100644 --- a/homeassistant/components/insteon/api/properties.py +++ b/homeassistant/components/insteon/api/properties.py @@ -3,7 +3,12 @@ from typing import Any from pyinsteon import devices -from pyinsteon.config import RADIO_BUTTON_GROUPS, RAMP_RATE_IN_SEC, get_usable_value +from pyinsteon.config import ( + LOAD_BUTTON, + RADIO_BUTTON_GROUPS, + RAMP_RATE_IN_SEC, + get_usable_value, +) from pyinsteon.constants import ( RAMP_RATES_SEC, PropertyType, @@ -75,8 +80,11 @@ def get_schema(prop, name, groups): if name == RAMP_RATE_IN_SEC: return _list_schema(name, RAMP_RATE_LIST) if name == RADIO_BUTTON_GROUPS: - button_list = {str(group): groups[group].name for group in groups if group != 1} + button_list = {str(group): groups[group].name for group in groups} return _multi_select_schema(name, button_list) + if name == LOAD_BUTTON: + button_list = {group: groups[group].name for group in groups} + return _list_schema(name, button_list) if prop.value_type == bool: return _bool_schema(name) if prop.value_type == int: diff --git a/homeassistant/components/insteon/ipdb.py b/homeassistant/components/insteon/ipdb.py index de3ba7d55f2..9e9f987d611 100644 --- a/homeassistant/components/insteon/ipdb.py +++ b/homeassistant/components/insteon/ipdb.py @@ -10,6 +10,7 @@ from pyinsteon.device_types.ipdb import ( DimmableLightingControl_Dial, DimmableLightingControl_DinRail, DimmableLightingControl_FanLinc, + DimmableLightingControl_I3_KeypadLinc_4, DimmableLightingControl_InLineLinc01, DimmableLightingControl_InLineLinc02, DimmableLightingControl_KeypadLinc_6, @@ -55,6 +56,9 @@ DEVICE_PLATFORM: dict[Device, dict[Platform, Iterable[int]]] = { DimmableLightingControl_FanLinc: {Platform.LIGHT: [1], Platform.FAN: [2]}, DimmableLightingControl_InLineLinc01: {Platform.LIGHT: [1]}, DimmableLightingControl_InLineLinc02: {Platform.LIGHT: [1]}, + DimmableLightingControl_I3_KeypadLinc_4: { + Platform.LIGHT: [1, 2, 3, 4], + }, DimmableLightingControl_KeypadLinc_6: { Platform.LIGHT: [1], Platform.SWITCH: [3, 4, 5, 6], diff --git a/homeassistant/components/insteon/light.py b/homeassistant/components/insteon/light.py index 1c12bc794f9..121d8d62c66 100644 --- a/homeassistant/components/insteon/light.py +++ b/homeassistant/components/insteon/light.py @@ -2,6 +2,7 @@ from typing import Any from pyinsteon.config import ON_LEVEL +from pyinsteon.device_types.device_base import Device as InsteonDevice from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity from homeassistant.config_entries import ConfigEntry @@ -51,6 +52,13 @@ class InsteonDimmerEntity(InsteonEntity, LightEntity): _attr_color_mode = ColorMode.BRIGHTNESS _attr_supported_color_modes = {ColorMode.BRIGHTNESS} + def __init__(self, device: InsteonDevice, group: int) -> None: + """Init the InsteonDimmerEntity entity.""" + super().__init__(device=device, group=group) + if not self._insteon_device_group.is_dimmable: + self._attr_color_mode = ColorMode.ONOFF + self._attr_supported_color_modes = {ColorMode.ONOFF} + @property def brightness(self): """Return the brightness of this light between 0..255.""" diff --git a/homeassistant/components/insteon/manifest.json b/homeassistant/components/insteon/manifest.json index ad3fb7bfbe8..5fa45a16fb6 100644 --- a/homeassistant/components/insteon/manifest.json +++ b/homeassistant/components/insteon/manifest.json @@ -17,8 +17,8 @@ "iot_class": "local_push", "loggers": ["pyinsteon", "pypubsub"], "requirements": [ - "pyinsteon==1.4.3", - "insteon-frontend-home-assistant==0.3.5" + "pyinsteon==1.5.1", + "insteon-frontend-home-assistant==0.4.0" ], "usb": [ { diff --git a/requirements_all.txt b/requirements_all.txt index 9b3192459aa..a1a3a598568 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1064,7 +1064,7 @@ influxdb==5.3.1 inkbird-ble==0.5.6 # homeassistant.components.insteon -insteon-frontend-home-assistant==0.3.5 +insteon-frontend-home-assistant==0.4.0 # homeassistant.components.intellifire intellifire4py==2.2.2 @@ -1750,7 +1750,7 @@ pyialarm==2.2.0 pyicloud==1.0.0 # homeassistant.components.insteon -pyinsteon==1.4.3 +pyinsteon==1.5.1 # homeassistant.components.intesishome pyintesishome==1.8.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 656658f254f..4d366125d9f 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -832,7 +832,7 @@ influxdb==5.3.1 inkbird-ble==0.5.6 # homeassistant.components.insteon -insteon-frontend-home-assistant==0.3.5 +insteon-frontend-home-assistant==0.4.0 # homeassistant.components.intellifire intellifire4py==2.2.2 @@ -1302,7 +1302,7 @@ pyialarm==2.2.0 pyicloud==1.0.0 # homeassistant.components.insteon -pyinsteon==1.4.3 +pyinsteon==1.5.1 # homeassistant.components.ipma pyipma==3.0.6