From b909e5823f389586a7c20db4d3b6136d8523fc82 Mon Sep 17 00:00:00 2001 From: trilu2000 Date: Wed, 17 Apr 2019 14:30:54 +0200 Subject: [PATCH] Homematic Lock: state_uncertain attribute, Homematic dimmer: Light service transition attribute (#22928) * STATE_UNCERTAIN for Homematic Lock devices introduced Homematic Lock devices provides an uncertain flag if the lock was opened manually an the lock is uncertain regards the status. The other necassary functionality was implemented in pyhomematic by Daniel earlier... * enabled attribute transition in light service for homematic dimmer devices * Update light.py * Revert "Update light.py" This reverts commit f5565a006d769c4f392390e405b48f12acba177e. * Revert "Revert "Update light.py"" This reverts commit 2c264826efdd7a5cbf374e147bb2cf8b82c31fff. * fix for line too long error * trailing whitespace --- homeassistant/components/homematic/__init__.py | 3 ++- homeassistant/components/homematic/light.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/homematic/__init__.py b/homeassistant/components/homematic/__init__.py index 97c805aa2ac..747b23bb970 100644 --- a/homeassistant/components/homematic/__init__.py +++ b/homeassistant/components/homematic/__init__.py @@ -123,7 +123,8 @@ HM_ATTRIBUTE_SUPPORT = { 'CURRENT': ['current', {}], 'VOLTAGE': ['voltage', {}], 'OPERATING_VOLTAGE': ['voltage', {}], - 'WORKING': ['working', {0: 'No', 1: 'Yes'}] + 'WORKING': ['working', {0: 'No', 1: 'Yes'}], + 'STATE_UNCERTAIN': ['state_uncertain', {}] } HM_PRESS_EVENTS = [ diff --git a/homeassistant/components/homematic/light.py b/homeassistant/components/homematic/light.py index 72aa9a977d4..f9bc785d3f4 100644 --- a/homeassistant/components/homematic/light.py +++ b/homeassistant/components/homematic/light.py @@ -2,8 +2,8 @@ import logging from homeassistant.components.light import ( - ATTR_BRIGHTNESS, ATTR_EFFECT, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS, - SUPPORT_COLOR, SUPPORT_EFFECT, Light) + ATTR_BRIGHTNESS, ATTR_EFFECT, ATTR_HS_COLOR, ATTR_TRANSITION, + SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_EFFECT, Light) from . import ATTR_DISCOVER_DEVICES, HMDevice @@ -75,6 +75,9 @@ class HMLight(HMDevice, Light): def turn_on(self, **kwargs): """Turn the light on and/or change color or color effect settings.""" + if ATTR_TRANSITION in kwargs: + self._hmdevice.setValue('RAMP_TIME', kwargs[ATTR_TRANSITION]) + if ATTR_BRIGHTNESS in kwargs and self._state == "LEVEL": percent_bright = float(kwargs[ATTR_BRIGHTNESS]) / 255 self._hmdevice.set_level(percent_bright, self._channel)