@Mariusthvdb wrote:
have a set of 6 binary_sensors like this:
birthday_marijn: friendly_name: Marijn jarig value_template: >- {{ is_state('sensor.birthday_marijn','0')}} device_class: 'presence' entity_picture_template: > {{ state_attr('sensor.birthday_marijn','entity_picture')}} attribute_templates: days: > {{ states('sensor.birthday_marijn')}} years: > {{ state_attr('sensor.birthday_marijn','years')}} original_date: > {{ state_attr('sensor.birthday_marijn','original_date')}} type: > {{ state_attr('sensor.birthday_marijn','type')}} name: > {{ state_attr('sensor.birthday_marijn','persoon')}} event: "{{'jarig'}}"
unfortunately they dont update on startup, which is surprising, because the entity_id (sensor.birthday_marijn in this case) on which they are based is clear at all times. Why do I need to add the sensor in the entity_id field of the main config to make them update on startup?
secondly, as you can see I template a few attributes off off the same sensor. Wouldn’t it be nice to be able to set the id in a variable and reference that in the attribute_templates? Since it is one big template, I would have hoped that to be allowed/possible?
attribute_templates: {% set id = 'sensor.birthday_marijn' %} days: > {{ states(id)}} years: > {{ state_attr(id,'years')}} original_date: > {{ state_attr(id,'original_date')}} type: > {{ state_attr(id,'type')}} name: > {{ state_attr(id,'persoon')}} event: "{{'jarig'}}"
@petro, I promised you a tag…
Posts: 2
Participants: 2