Hi,
I would like to send a notification of one of the state attributes of an entity. Basically the below is the entity and I would like to send the daily_yield value in a message.
Tried the below but it didn’t work.
message: ’ {{ states(sensor.sun2000_3_68ktl_l1.attributes[“daily_yield”] }}’
Regards,
Et
Please try this in template
message: '{{state_attr('sensor.sun2000_3_68ktl_l1.attributes', 'daily_yield')}}'
Its being marked red not letting me save as if there is something wrong in syntax. See attached
spacegaier
(Philip Allgaier)
January 24, 2021, 12:47pm
4
You can always test templates in the HA dev tools, to easily spot errors.
Anyway, this would be the correct template to get the attribute:
{{ state_attr("sensor.sun2000_3_68ktl_l1", "daily_yield") }}
You need to either use double quotes outside the curly brackets and single quotes inside or vice versa. And the .attributes
part is incorrect.
message: "{{ state_attr('sensor.sun2000_3_68ktl_l1', 'daily_yield') }}"
As the answer is not clear here and I have been searching for it for hours you need to use this:
state_attr(‘sensor.livingroom’, ‘Battery numeric’)
So do not use states.
1 Like