Enable transition time for HmIP-BSL - HomematicIP Cloud (#28201)
* Enable transition time for HmIP-BSL - HomematicIP Cloud harden ACP fix hao device name * update test, initalize instance var
This commit is contained in:
1 parent
b7296c61bc
commit
33c8cba30d
4 files changed
+56
-21
No files matched your search
@@ -312,7 +312,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
||||
device_registry = await dr.async_get_registry(hass)
|
||||
home = hap.home
|
||||
# Add the HAP name from configuration if set.
|
||||
hapname = home.label if not home.name else f"{home.label} {home.name}"
|
||||
hapname = home.label if not home.name else f"{home.name} {home.label}"
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=home.id,
|
||||
identifiers={(DOMAIN, home.id)},
|
||||
|
||||
@@ -52,11 +52,13 @@ class HomematicipAlarmControlPanel(AlarmControlPanel):
|
||||
"""Initialize the alarm control panel."""
|
||||
self._home = hap.home
|
||||
self.alarm_state = STATE_ALARM_DISARMED
|
||||
self._internal_alarm_zone = None
|
||||
self._external_alarm_zone = None
|
||||
|
||||
for security_zone in security_zones:
|
||||
if security_zone.label == "INTERNAL":
|
||||
self._internal_alarm_zone = security_zone
|
||||
else:
|
||||
elif security_zone.label == "EXTERNAL":
|
||||
self._external_alarm_zone = security_zone
|
||||
|
||||
@property
|
||||
@@ -110,8 +112,10 @@ class HomematicipAlarmControlPanel(AlarmControlPanel):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Register callbacks."""
|
||||
self._internal_alarm_zone.on_update(self._async_device_changed)
|
||||
self._external_alarm_zone.on_update(self._async_device_changed)
|
||||
if self._internal_alarm_zone:
|
||||
self._internal_alarm_zone.on_update(self._async_device_changed)
|
||||
if self._external_alarm_zone:
|
||||
self._external_alarm_zone.on_update(self._async_device_changed)
|
||||
|
||||
def _async_device_changed(self, *args, **kwargs):
|
||||
"""Handle device state changes."""
|
||||
@@ -146,7 +150,7 @@ class HomematicipAlarmControlPanel(AlarmControlPanel):
|
||||
|
||||
|
||||
def _get_zone_alarm_state(security_zone) -> bool:
|
||||
if security_zone.active:
|
||||
if security_zone and security_zone.active:
|
||||
if (
|
||||
security_zone.sabotage
|
||||
or security_zone.motionDetected
|
||||
|
||||
@@ -16,6 +16,7 @@ from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_COLOR_NAME,
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
Light,
|
||||
@@ -225,13 +226,28 @@ class HomematicipNotificationLight(HomematicipGenericDevice, Light):
|
||||
# Minimum brightness is 10, otherwise the led is disabled
|
||||
brightness = max(10, brightness)
|
||||
dim_level = brightness / 255.0
|
||||
transition = kwargs.get(ATTR_TRANSITION, 0.5)
|
||||
|
||||
await self._device.set_rgb_dim_level(self.channel, simple_rgb_color, dim_level)
|
||||
await self._device.set_rgb_dim_level_with_time(
|
||||
channelIndex=self.channel,
|
||||
rgb=simple_rgb_color,
|
||||
dimLevel=dim_level,
|
||||
onTime=0,
|
||||
rampTime=transition,
|
||||
)
|
||||
|
||||
async def async_turn_off(self, **kwargs):
|
||||
"""Turn the light off."""
|
||||
simple_rgb_color = self._func_channel.simpleRGBColorState
|
||||
await self._device.set_rgb_dim_level(self.channel, simple_rgb_color, 0.0)
|
||||
transition = kwargs.get(ATTR_TRANSITION, 0.5)
|
||||
|
||||
await self._device.set_rgb_dim_level_with_time(
|
||||
channelIndex=self.channel,
|
||||
rgb=simple_rgb_color,
|
||||
dimLevel=0.0,
|
||||
onTime=0,
|
||||
rampTime=transition,
|
||||
)
|
||||
|
||||
|
||||
def _convert_color(color) -> RGBColorState:
|
||||
|
||||
Reference in new issue
Block a user