I am starting on work to create some buttons for my daughter to control her new LED strip. She only needs to change colour with these buttons.
The LED strip works fine inside HA. from the developer tools it has the following attributes
To change the light via HA calling a service via the developer tools look likes this:
service: light.turn_on
data:
rgb_color:
- 216
- 14
- 255
target:
device_id: c3fa823141ba3b79dc9893904d426142
After some research i think the solution is to make a script that can receive the parameters from esphome. so in my script file i have:
set_light_rgb:
alias: 'ESPHome RGB light set'
sequence:
- service: light.turn_on
data_template:
rgb_color:
- '{{ red }}'
- '{{ green }}'
- '{{ blue }}'
target:
device_id: '{{ lightid }}'
and my esphome config looks like this:
binary_sensor:
- platform: gpio
pin:
number: D4
mode:
input: true
pullup: true
name: "set lights"
on_press:
then:
- homeassistant.service:
service: script.set_light_rgb
data:
lightid: 'c3fa823141ba3b79dc9893904d426142'
red: '255'
green: '255'
blue: '255'
However nothing is happening. the esphome log see the button press and shows:
within HA the logbook does not see it. and the logs show this error:
Template variable warning: ‘dict object’ has no attribute ‘tag_name’ when rendering ‘{{ value_json.tag_name }}’
12:17:45 – (WARNING) helpers/template.py
Any help will be hugely appreciated.