soo
(soo)
1
Hello
I need to log random number that runs in automation
I have automation
service: light.turn_on
data:
effect: |
{{ states.light.cololight_hive_yaml.attributes.effect_list | random }}
entity_id: light.cololight_hive_yaml
cololight_hive_yaml.attributes.effect_list - is a list of entries
i need to log somewhere - system log, status log value that selected randomally
how to do that?
petro
(Petro)
4
You can use persistent notifications to notify yourself.
EDIT or you can use the System log service, like @samnewman86 said above.
But to do that you’ll need to create a variable in your automation otherwise it won’t be the number that’s used in the automation.
Here’s an example:
- alias:
trigger:
...
condition:
...
variable:
my_effect: |
{{ states.light.cololight_hive_yaml.attributes.effect_list | random }}
action:
- service: light.turn_on
data:
effect: "{{ my_effect }}"
entity_id: light.cololight_hive_yaml
- service: system_log.write
data:
message: "my effect is: {{ my_effect }}"
level: info
- service: persistent_notification.create
data:
message: "my effect is: {{ my_effect }}"
title: "My Effect"
1 Like