Jokerigno
(Jokerigno)
December 31, 2020, 2:59pm
1
Hi all,
I’ve tried to setup a light template to best manage a light rgbw strip with a zigbee controller.
This is what I’ve done so far:
- platform: template
lights:
led_cucina_test:
friendly_name: "LED Cucina"
level_template: >
{% if is_state('light.striscia_led_cucina_rgb' , 'on') %}
{{ state_attr('light.striscia_led_cucina_rgb', 'brightness')|int }}
{% elif is_state('light.striscia_led_cucina_bianco' , 'on') %}
{{ state_attr('light.striscia_led_cucina_bianco', 'brightness')|int }}
{% else %}
0
{% endif %}
value_template: >
{% if is_state('light.striscia_led_cucina_rgb' , 'on') %}
{{ states('light.striscia_led_cucina_rgb') }}
{% elif is_state('light.striscia_led_cucina_bianco' , 'on') %}
{{ states('light.striscia_led_cucina_bianco') }}
{% else %}
off
{% endif %}
white_value_template : "{{states('light.striscia_led_cucina_bianco') | int}}"
color_template: "{{states('light.striscia_led_cucina_rgb') | int}}"
turn_on:
- service: light.turn_on
data:
entity_id: light.striscia_led_cucina_bianco
brightness: 255
turn_off:
- service: light.turn_off
entity_id: light.striscia_led_cucina_bianco
- service: light.turn_off
entity_id: light.striscia_led_cucina_rgb
set_level:
service: light.turn_on
data_template:
entity_id: >
{% if is_state('light.striscia_led_cucina_rgb' , 'on') %}
light.striscia_led_cucina_rgb
{% elif is_state('light.striscia_led_cucina_bianco' , 'on') %}
light.striscia_led_cucina_bianco
{% else %}
0
{% endif %}
brightness: "{{ brightness }}"
set_white_value:
- service: light.turn_on
data_template:
entity_id: light.striscia_led_cucina_bianco
white_value: "{{ white_value }}"
set_color:
- service: light.turn_on
data_template:
entity_id: light.striscia_led_cucina_rgb
rgb_color: "{{ rgb_color }}"
When I try to simply turn it on I see an error message
“Fallita chiamata a servizio light/turn_on . ‘int’ object is not iterable”
Of course light.striscia_led_cucina_bianco involved in the turn on call is working as expected.
Any hint?
KTibow
(Kendell R)
December 31, 2020, 3:14pm
2
Lights can only be off, on, or unavailable.
Jokerigno
(Jokerigno)
January 2, 2021, 5:05pm
3
Great!
After that I still can’t handle how to set color o brightness.
It seems that there are error too. I was wondering why I cannot find any good example on the net.
KTibow
(Kendell R)
January 2, 2021, 5:30pm
4
I’m confused about your situation here. Do you have two separate light entities that control one strip?
Jokerigno
(Jokerigno)
January 2, 2021, 5:32pm
5
No I have a RGBW Strip controlled by a device that exposes 2 entities. One for white and the other for RGB
Jokerigno
(Jokerigno)
January 2, 2021, 6:49pm
6
For example I cannot undestand why this doesn’t work:
set_color:
- service: light.turn_on
data_template:
entity_id: light.striscia_led_cucina_rgb
hs_color: "{{ hs_color }}"
KTibow
(Kendell R)
January 2, 2021, 6:50pm
7
It’s well documented that the only things expsoed are h
and s
in color. Try hs_color: {{[h, s]}}
.
Jokerigno
(Jokerigno)
January 2, 2021, 7:42pm
8
KTibow:
hs_color: {{[h, s]}}
No changes:
2021-01-02 20:41:51 ERROR (MainThread) [homeassistant.helpers.script.led_cucina] LED Cucina: Error executing script. Invalid data for call_service at pos 1: None for dictionary value @ data[‘hs_color’]
2021-01-02 20:41:51 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139724710657808] None for dictionary value @ data[‘hs_color’]
KTibow
(Kendell R)
January 2, 2021, 7:51pm
9
What about if you quote it?
Jokerigno
(Jokerigno)
January 2, 2021, 7:53pm
10
Sorry forgot to mention.
In my yaml I already quoted it:
- service: light.turn_on
data_template:
entity_id: light.striscia_led_cucina_rgb
hs_color: "{{[h, s]}}"
KTibow
(Kendell R)
January 2, 2021, 7:55pm
11
And you still get the same error?
KTibow
(Kendell R)
January 2, 2021, 11:13pm
13
If you remove quotes, same error? Also as of recent releases just use data
not data_template
.
Jokerigno
(Jokerigno)
January 3, 2021, 10:18am
14
yes same result with or without quotes
Jokerigno
(Jokerigno)
February 20, 2021, 11:11pm
15
I’m still struggling with this. Maybe something is changed in how templates are managed.
Still need support
KTibow
(Kendell R)
February 23, 2021, 8:31pm
16
Some other people have had a similar problem. Try searching around on the forums.
Jokerigno
(Jokerigno)
February 23, 2021, 10:56pm
17
I noticed that seems that something is broken and I found also issues on github but seems that this integration is not loved.
Jokerigno
(Jokerigno)
February 28, 2021, 3:05pm
18
ok, let’s change approach.
I tried also to create a template light only for 1 light changing brightness .
light:
- platform: template
lights:
led_cucina:
friendly_name: "LED Cucina"
level_template: "{{ state_attr('light.dimmable_light_10', 'brightness')|int }}"
value_template: "{{ states('light.dimmable_light_10') }}"
white_value_template: "{{ state_attr('light.dimmable_light_10', 'brightness')|int }}"
turn_on:
service: light.turn_on
entity_id: light.dimmable_light_10
turn_off:
service: light.turn_off
entity_id: light.dimmable_light_10
set_level:
service: light.turn_on
entity_id: light.dimmable_light_10
data:
brightness: "{{ brightness }}"
set_white_value:
service: light.turn_on
entity_id: light.dimmable_light_10
data:
white_value: "{{ brightness }}"
in logs i see error for set white color. It asks me hue value but in docs I read for white_value
Integer between 0 and 255 for how bright a dedicated white LED should be.
Why I see this?