I have a bit of a problem here. I want to have a buttonmatrix with lights in it.
And then I want to change
checked
disabled
recolor
But when I try to do this with a lambda, it does not work.
This is what I do:
- platform: homeassistant
id: ts_taklampe_stua
entity_id: light.taklampe_2_gang
on_value:
then:
- lvgl.matrix.button.update:
id: ceiling_light_symbol
control:
checked: !lambda return (0 == x.compare(std::string{"on"}));
disabled: !lambda return ((0 == x.compare(std::string{"unavailable"})) or (0 == x.compare(std::string{"unknown"})));
and
- buttonmatrix:
align: CENTER
pad_all: 0
outline_width: 0
border_color: black
border_width: 0
border_opa: TRANSP
x: 0
y: 40
width: 300
height: 50
bg_color: black
text_color: 0xD3D3D3
id: btnmtx_lights
text_font: mdi_42
items:
shadow_opa: TRANSP
bg_color: black
text_color: 0xD3D3D3
border_color: black
border_width: 0
border_opa: TRANSP
rows:
- buttons:
- id: ceiling_light_symbol
text: "\U000F17C7"
Leads to:
Failed config
text_sensor.homeassistant: [source /config/esphome/esp-screen-kitchen.yaml:620]
platform: homeassistant
id: ts_taklampe_stua
entity_id: light.taklampe_2_gang
on_value:
then:
- lvgl.matrix.button.update:
id: ceiling_light_symbol
control:
This option is not templatable!.
checked: !lambda |-
return (0 == x.compare(std::string{"on"}));
This option is not templatable!.
disabled: !lambda |-
return ((0 == x.compare(std::string{"unavailable"})) or (0 == x.compare(std::string{"unknown"})));
Is there another way to do this?