Support for Insteon 4 button KeypadLink device (#100132)

This commit is contained in:
Tom Harris 2023-09-12 19:10:40 +00:00 committed by GitHub
parent d417a27c85
commit f9ce315d1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 8 deletions

View File

@ -3,7 +3,12 @@
from typing import Any from typing import Any
from pyinsteon import devices 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 ( from pyinsteon.constants import (
RAMP_RATES_SEC, RAMP_RATES_SEC,
PropertyType, PropertyType,
@ -75,8 +80,11 @@ def get_schema(prop, name, groups):
if name == RAMP_RATE_IN_SEC: if name == RAMP_RATE_IN_SEC:
return _list_schema(name, RAMP_RATE_LIST) return _list_schema(name, RAMP_RATE_LIST)
if name == RADIO_BUTTON_GROUPS: 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) 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: if prop.value_type == bool:
return _bool_schema(name) return _bool_schema(name)
if prop.value_type == int: if prop.value_type == int:

View File

@ -10,6 +10,7 @@ from pyinsteon.device_types.ipdb import (
DimmableLightingControl_Dial, DimmableLightingControl_Dial,
DimmableLightingControl_DinRail, DimmableLightingControl_DinRail,
DimmableLightingControl_FanLinc, DimmableLightingControl_FanLinc,
DimmableLightingControl_I3_KeypadLinc_4,
DimmableLightingControl_InLineLinc01, DimmableLightingControl_InLineLinc01,
DimmableLightingControl_InLineLinc02, DimmableLightingControl_InLineLinc02,
DimmableLightingControl_KeypadLinc_6, DimmableLightingControl_KeypadLinc_6,
@ -55,6 +56,9 @@ DEVICE_PLATFORM: dict[Device, dict[Platform, Iterable[int]]] = {
DimmableLightingControl_FanLinc: {Platform.LIGHT: [1], Platform.FAN: [2]}, DimmableLightingControl_FanLinc: {Platform.LIGHT: [1], Platform.FAN: [2]},
DimmableLightingControl_InLineLinc01: {Platform.LIGHT: [1]}, DimmableLightingControl_InLineLinc01: {Platform.LIGHT: [1]},
DimmableLightingControl_InLineLinc02: {Platform.LIGHT: [1]}, DimmableLightingControl_InLineLinc02: {Platform.LIGHT: [1]},
DimmableLightingControl_I3_KeypadLinc_4: {
Platform.LIGHT: [1, 2, 3, 4],
},
DimmableLightingControl_KeypadLinc_6: { DimmableLightingControl_KeypadLinc_6: {
Platform.LIGHT: [1], Platform.LIGHT: [1],
Platform.SWITCH: [3, 4, 5, 6], Platform.SWITCH: [3, 4, 5, 6],

View File

@ -2,6 +2,7 @@
from typing import Any from typing import Any
from pyinsteon.config import ON_LEVEL 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.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
@ -51,6 +52,13 @@ class InsteonDimmerEntity(InsteonEntity, LightEntity):
_attr_color_mode = ColorMode.BRIGHTNESS _attr_color_mode = ColorMode.BRIGHTNESS
_attr_supported_color_modes = {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 @property
def brightness(self): def brightness(self):
"""Return the brightness of this light between 0..255.""" """Return the brightness of this light between 0..255."""

View File

@ -17,8 +17,8 @@
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["pyinsteon", "pypubsub"], "loggers": ["pyinsteon", "pypubsub"],
"requirements": [ "requirements": [
"pyinsteon==1.4.3", "pyinsteon==1.5.1",
"insteon-frontend-home-assistant==0.3.5" "insteon-frontend-home-assistant==0.4.0"
], ],
"usb": [ "usb": [
{ {

View File

@ -1064,7 +1064,7 @@ influxdb==5.3.1
inkbird-ble==0.5.6 inkbird-ble==0.5.6
# homeassistant.components.insteon # homeassistant.components.insteon
insteon-frontend-home-assistant==0.3.5 insteon-frontend-home-assistant==0.4.0
# homeassistant.components.intellifire # homeassistant.components.intellifire
intellifire4py==2.2.2 intellifire4py==2.2.2
@ -1750,7 +1750,7 @@ pyialarm==2.2.0
pyicloud==1.0.0 pyicloud==1.0.0
# homeassistant.components.insteon # homeassistant.components.insteon
pyinsteon==1.4.3 pyinsteon==1.5.1
# homeassistant.components.intesishome # homeassistant.components.intesishome
pyintesishome==1.8.0 pyintesishome==1.8.0

View File

@ -832,7 +832,7 @@ influxdb==5.3.1
inkbird-ble==0.5.6 inkbird-ble==0.5.6
# homeassistant.components.insteon # homeassistant.components.insteon
insteon-frontend-home-assistant==0.3.5 insteon-frontend-home-assistant==0.4.0
# homeassistant.components.intellifire # homeassistant.components.intellifire
intellifire4py==2.2.2 intellifire4py==2.2.2
@ -1302,7 +1302,7 @@ pyialarm==2.2.0
pyicloud==1.0.0 pyicloud==1.0.0
# homeassistant.components.insteon # homeassistant.components.insteon
pyinsteon==1.4.3 pyinsteon==1.5.1
# homeassistant.components.ipma # homeassistant.components.ipma
pyipma==3.0.6 pyipma==3.0.6