I am new to HA and can’t figure out how to automate this thing. I copied some holiday light code from youtube which integrated well with HA. The light has multiple effects and I want to loop thru those say every 15 mins. Tried automation and scripts but nothing worked as expected. I am able to turn on the light but it always turn on to the last effect it had. Below is the configuration.yaml config for the light. Would appreciate any help you can provide. TIA!
configuration.yaml
#Already replaced [MQTT_CLIENT_ID] with LightMCU in actual config.
sensor:
platform: mqtt
name: “Current LED”
state_topic: “[MQTT_CLIENT_ID]/locator”
light:
platform: mqtt
name: “Holiday Lights”
command_topic: “[MQTT_CLIENT_ID]/power”
state_topic: “[MQTT_CLIENT_ID]/powerState”
brightness_command_topic: “[MQTT_CLIENT_ID]/brightness”
brightness_state_topic: “[MQTT_CLIENT_ID]/brightnessState”
brightness_scale: 255
white_value_command_topic: “[MQTT_CLIENT_ID]/modifier”
white_value_state_topic: “[MQTT_CLIENT_ID]/modifierState”
white_value_scale: 500
effect_command_topic: “[MQTT_CLIENT_ID]/effect”
effect_state_topic: “[MQTT_CLIENT_ID]/effectState”
effect_list:
Color_Chase
Color_Glitter
Single_Race
Double_Crash
Rainbow
Blocked_Colors
BPM
Twinkle
Fire
Fill_Solid
Spooky_Eyes
LED_Locator
retain: true
platform: mqtt
name: “Color 1”
command_topic: “[MQTT_CLIENT_ID]/ColorPower”
state_topic: “[MQTT_CLIENT_ID]/powerState”
rgb_command_topic: “[MQTT_CLIENT_ID]/color1”
rgb_state_topic: “[MQTT_CLIENT_ID]/color1State”
retain: true
platform: mqtt
name: “Color 2”
command_topic: “[MQTT_CLIENT_ID]/ColorPower”
state_topic: “[MQTT_CLIENT_ID]/powerState”
rgb_command_topic: “[MQTT_CLIENT_ID]/color2”
rgb_state_topic: “[MQTT_CLIENT_ID]/color2State”
retain: true
platform: mqtt
name: “Color 3”
command_topic: “[MQTT_CLIENT_ID]/ColorPower”
state_topic: “[MQTT_CLIENT_ID]/powerState”
rgb_command_topic: “[MQTT_CLIENT_ID]/color3”
rgb_state_topic: “[MQTT_CLIENT_ID]/color3State”
retain: true
platform: mqtt
name: “Glitter”
state_topic: “[MQTT_CLIENT_ID]/glitter/state”
command_topic: “[MQTT_CLIENT_ID]/addEffects”
payload_on: “Glitter On”
payload_off: “Glitter Off”
rgb_command_topic: “[MQTT_CLIENT_ID]/glitterColor”
rgb_state_topic: “[MQTT_CLIENT_ID]/glitterColorState”
white_value_command_topic: “[MQTT_CLIENT_ID]/glitterChance”
white_value_state_topic: “[MQTT_CLIENT_ID]/glitterChanceState”
white_value_scale: 255
retain: true
platform: mqtt
name: “Lightning”
state_topic: “[MQTT_CLIENT_ID]/lightning/state”
command_topic: “[MQTT_CLIENT_ID]/addEffects”
payload_on: “Lightning On”
payload_off: “Lightning Off”
white_value_command_topic: “[MQTT_CLIENT_ID]/lightningChance”
white_value_state_topic: “[MQTT_CLIENT_ID]/lightningChanceState”
white_value_scale: 500
retain: true
nickrout
(Nick Rout)
November 14, 2019, 7:35am
2
I did it from my cell phone last night hoping it would be in correct format. Here is the actual entry from configuration.yaml. There is also the automation at the end I tried which was able to turn on the light but was never able to set the effect.
sensor:
- platform: mqtt
name: "Current LED"
state_topic: "LightMCU/locator"
light:
- platform: mqtt
name: "Holiday Lights"
command_topic: "LightMCU/power"
state_topic: "LightMCU/powerState"
brightness_command_topic: "LightMCU/brightness"
brightness_state_topic: "LightMCU/brightnessState"
brightness_scale: 255
white_value_command_topic: "LightMCU/modifier"
white_value_state_topic: "LightMCU/modifierState"
white_value_scale: 500
effect_command_topic: "LightMCU/effect"
effect_state_topic: "LightMCU/effectState"
effect_list:
- Color_Chase
- Color_Glitter
- Single_Race
- Double_Crash
- Rainbow
- Blocked_Colors
- BPM
- Twinkle
- Fire
- Fill_Solid
- Spooky_Eyes
- LED_Locator
retain: true
- platform: mqtt
name: "Color 1"
command_topic: "LightMCU/ColorPower"
state_topic: "LightMCU/powerState"
rgb_command_topic: "LightMCU/color1"
rgb_state_topic: "LightMCU/color1State"
retain: true
- platform: mqtt
name: "Color 2"
command_topic: "LightMCU/ColorPower"
state_topic: "LightMCU/powerState"
rgb_command_topic: "LightMCU/color2"
rgb_state_topic: "LightMCU/color2State"
retain: true
- platform: mqtt
name: "Color 3"
command_topic: "LightMCU/ColorPower"
state_topic: "LightMCU/powerState"
rgb_command_topic: "LightMCU/color3"
rgb_state_topic: "LightMCU/color3State"
retain: true
- platform: mqtt
name: "Glitter"
state_topic: "LightMCU/glitter/state"
command_topic: "LightMCU/addEffects"
payload_on: "Glitter On"
payload_off: "Glitter Off"
rgb_command_topic: "LightMCU/glitterColor"
rgb_state_topic: "LightMCU/glitterColorState"
white_value_command_topic: "LightMCU/glitterChance"
white_value_state_topic: "LightMCU/glitterChanceState"
white_value_scale: 255
retain: true
- platform: mqtt
name: "Lightning"
state_topic: "LightMCU/lightning/state"
command_topic: "LightMCU/addEffects"
payload_on: "Lightning On"
payload_off: "Lightning Off"
white_value_command_topic: "LightMCU/lightningChance"
white_value_state_topic: "LightMCU/lightningChanceState"
white_value_scale: 500
retain: true
##############AUTOMATION###############
- alias: Holiday Lights Theme
trigger:
- at: '16:44'
platform: time
condition:
- after: '16:30'
before: '19:00'
condition: time
action:
- data:
effect: blocked_colors
entity_id: light.holiday_lights
service: light.turn_on
- timeout: 00:00:20
wait_template: ''
- data:
effect: double_Crash
entity_id: light.holiday_lights
service: light.turn_on
dashdrum
(Dan)
November 8, 2020, 12:56am
4
I was hoping to see a solution for this question. Did you make any progress? Thanks!
nickrout
(Nick Rout)
November 8, 2020, 2:59am
5
See here: https://www.home-assistant.io/integrations/light
Call service light.turn_on
with the effect you want.
There’s just a hint that you could set an effect if switching the light on, however there’s no code example for how to cycle through the effect list. I tried the same and fail as soon I reach the “None” entry in the list. No problem setting “None” directly, but programatically leads to an exception. Maybe a bug in Jinja2?