I’m trying to get a RGB to change color based on weather forecast.
I’m using Openweather and a BRUH RGB light on ESP8266 controlled via MQTT.
my automation code is having an error and I’m stuck without a clue
2017-07-14 19:35:04 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: None for dictionary value @ data[‘rgb_color’]. Got ‘{% if is_state(“sensor.openw_forecast”, “Clear”) %}[0,0,255] {%-elif is_state(“sensor.openw_forecast”, “Clouds”) %}[0,255,0] {%-elif is_state(“sensor.openw_forecast”, “Rain”) %}[255,0,0] {%-elif is_state(“sensor.openw_forecast”, “Snow”) %}[255,0,255] {% endif %}\n’’
my automation code is:
alias: ‘galo’
trigger:
platform: state
entity_id: sensor.openw_forecast
action:
tried that and now gives a diferent error but not working as well
new error with data_template
2017-07-14 20:15:53 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: None for dictionary value @ data[‘rgb_color’]. Got ‘[0,0,255]’
changing the rgb_color to rgb as on BRUH code for the ESP , gives also error:
2017-07-14 20:23:10 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: extra keys not allowed @ data[‘rgb’]. Got ‘[0,0,255]’
any thoughts ? I’m sure there is someone using color automations but i’m clued.
I’m doing something that sounds similar to what you’re after, but less elegantly, and only hitting one condition. I’ve got an LED small strip on an ESP8266 with the BRUH code in it behind the TV in my gym as an ambient light. It turns on to a solid color at 4:50. At 4:51, if the predicted maximum rain intensity is over 0.01, it switches to the fire animation, then at 7:15 it turns off.
####Turn off Morning LED
- alias: "Morning LED off"
initial_state: True
hide_entity: False
trigger:
platform: time
at: '07:15'
action:
service: homeassistant.turn_off
entity_id: light.test_leds
## Turn on Morning LED each morning
- alias: "Morning LED on Solid"
initial_state: True
hide_entity: False
trigger:
platform: time
at: '04:50'
action:
service: homeassistant.turn_on
entity_id: light.test_leds
## If rainfall is predicted, set Morning LED to animated mode
- alias: "Morning LED fire - high predicted precipitation"
initial_state: True
hide_entity: False
trigger:
platform: time
at: '04:51'
condition:
condition: numeric_state
entity_id: sensor.dark_sky_daily_max_precip_intensity
above: 0.01
action:
- service: mqtt.publish
data_template:
topic: "test/mqttstrip/seteffect"
payload: "Fire"
- service: mqtt.publish
data_template:
topic: "test/mqttstrip/setanimationspeed"
payload: 11
HI,
thank you for the guidance. It’s now working as it should
the forecast the weather and updates the RGB led.
the final code needed to change as the mqtt topic was incorrect
working version is:
alias: ‘galo’
trigger:
platform: state
entity_id: sensor.openw_forecast
action:
thank you for the help.
BTW : there is a old fashioned way to see colors for the weather based on a quimical substance that when painted it changed colors as blue good weather and pink it would rain.
now i have the weather for tomorrow