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 f5565a006d.

* Revert "Revert "Update light.py""

This reverts commit 2c264826ef.

* fix for line too long error

* trailing whitespace
This commit is contained in:
trilu2000
2019-04-17 14:30:54 +02:00
committed by Pascal Vizeli
parent 37ca9cabd1
commit b909e5823f
2 changed files with 7 additions and 3 deletions

View File

@@ -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 = [

View File

@@ -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)