diff --git a/README.md b/README.md index 7c37d5b..42eb4f2 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ media_lights_sync: | `ha_url` | True | string | `None` | The URL to your Home Assistant. Only useful if `photo_attribute` is a relative URL[1](#ha-url-note). Examples: `https://my-ha.duckdns.org`, `http://192.168.1.123:8123`. | | `use_saturated_colors` | True | string | `False` | Increase the saturation and brightness of the colors. | | `use_current_brightness` | True | string | `False` | Do not change lights brightness. If `False`, it will always sets all lights to maximum brightness. | +| `transition` | True | number | `None` | Number that represents the time (in seconds) the light should take to transition to the new state. | | `condition` | True | object | | Sync lights only if the state of the condition entity is valid. | | `condition.entity` | False | string | | The entity_id of the condition. | | `condition.state` | False | string | | The state to match in order for the lights to sync. | diff --git a/apps/media_lights_sync/media_lights_sync.py b/apps/media_lights_sync/media_lights_sync.py index 8a69eee..8c2ded3 100644 --- a/apps/media_lights_sync/media_lights_sync.py +++ b/apps/media_lights_sync/media_lights_sync.py @@ -18,6 +18,7 @@ def initialize(self): self.ha_url = self.args.get("ha_url", None) self.use_current_brightness = self.args.get("use_current_brightness", False) self.condition = self.args.get("condition") + self.transition = self.args.get("transition", None) self.lights = self.args["lights"] self.use_saturated_colors = self.args.get("use_saturated_colors", False) @@ -42,6 +43,8 @@ def set_light_rgb(self, light, color): light_kwargs["rgb_color"] = self.get_saturated_color(color) if not self.use_current_brightness: light_kwargs["brightness"] = 255 + if self.transition is not None: + light_kwargs["transition"] = self.transition self.turn_on(light, **light_kwargs) def get_saturated_color(self, color): diff --git a/info.md b/info.md index 9afca3d..8f53beb 100644 --- a/info.md +++ b/info.md @@ -25,6 +25,7 @@ media_lights_sync: | `ha_url` | True | string | `None` | The URL to your Home Assistant. Only useful if `photo_attribute` is a relative URL[1](#ha-url-note). Examples: `https://my-ha.duckdns.org`, `http://192.168.1.123:8123`. | | `use_saturated_colors` | True | string | `False` | Increase the saturation and brightness of the colors. | | `use_current_brightness` | True | string | `False` | Do not change lights brightness. If `False`, it will always sets all lights to maximum brightness. | +| `transition` | True | number | `None` | Number that represents the time (in seconds) the light should take to transition to the new state. | | `condition` | True | object | | Sync lights only if the state of the condition entity is valid. | | `condition.entity` | False | string | | The entity_id of the condition. | | `condition.state` | False | string | | The state to match in order for the lights to sync. |