frablaser
(Frablaser)
1
Hi guys! I’m trying to do a presence simulator for Vacations (I can’t believe that it is not a part of HA already…)
I try to work with the input_text to store the value of a random group entities as:
action:
- service: input_text.set_value
data_template:
entity_id: input_text.light_to_switch
value: "{{ state_attr('group.simulation_lights','entity_id') | random }}"
- service: persistent_notification.create
data:
message: "{{ states('input_text.light_to_switch') }}"
But when I try to see it in the notifications, by:
- service: persistent_notification.create data: message: ‘{{states.input_text.light_to_switch.state}}’
I get…
Notification {{ state_attr(‘group.simulation_lights’,‘entity_id’) random }}
Why the text_input value is filled with the literal of the template and not with the value it supposed to return?
Because you need data_template and not data when you have data with a template.
There are many people that already did this with different approaches, just search the forum.
frablaser
(Frablaser)
3
I tried data and data_template, and the both have the same result…
I searched in the forum, I fond a couple of topic, and I try one of those approaches, but when I use the template:
action:
- data:
entity_id: '{{ state_attr(''group.simulation_lights'',''entity_id'') | random }}'
service: homeassistant.toggle
It works, but if I try to store it in a input_text, that where it bumping into…
frablaser
(Frablaser)
4
I have found my mistake…
When you edit your Automation in the Configurator, you should Reload the automatization after…
Thanks anyway Burningstone for your help…
Can you please try this:
action:
- service: input_text.set_value
data_template:
entity_id: input_text.light_to_switch
value: "{{ state_attr('group.simulation_lights','entity_id') | random }}"
- service: persistent_notification.create
data_template:
message: "{{ states('input_text.light_to_switch') }}"
frablaser
(Frablaser)
7
Yes it works… I had to reload the damned automatization…