Allow MQTT json light floating point transition (#27253)

* MQTT json light: allow floating point transition

Allow to use floating point values for the transition time of the MQTT json light.
In this way transitions shorter than 1s can be used (0.5 seconds for instance) if the MQTT light supports it.

* Always sent a float
pull/27613/head
starkillerOG 2019-10-13 20:29:14 +02:00 committed by Erik Montnemery
parent 1774a1427b
commit 2acd3f9e98
1 changed files with 2 additions and 2 deletions

View File

@ -463,7 +463,7 @@ class MqttLightJson(
message["flash"] = self._flash_times[CONF_FLASH_TIME_SHORT]
if ATTR_TRANSITION in kwargs:
message["transition"] = int(kwargs[ATTR_TRANSITION])
message["transition"] = kwargs[ATTR_TRANSITION]
if ATTR_BRIGHTNESS in kwargs and self._brightness is not None:
message["brightness"] = int(
@ -521,7 +521,7 @@ class MqttLightJson(
message = {"state": "OFF"}
if ATTR_TRANSITION in kwargs:
message["transition"] = int(kwargs[ATTR_TRANSITION])
message["transition"] = kwargs[ATTR_TRANSITION]
mqtt.async_publish(
self.hass,