indeed , and yes those 2 would suffice. Good to understand why there is no updating.
But since we successfully use the endswith filter now, I thought it might be possible to use it in this sensor value_template too somehow. I thought that might be an option since we’re not using a loop here, and, since you’ve successfully created a value_template using the endswith in the automation’s condition:
value_template: >
{{ trigger.event.data.entity_id.startswith('sensor.') and
trigger.event.data.entity_id.endswith('actueel') }}
totaal_actueel_sensors:
friendly_name: Totaal actueel
unit_of_measurement: 'Watt'
value_template: >
{{ states.sensor|selectattr( 'entity_id','endswith','actueel')
|map(attribute='state')|map('int')|sum }}
unfortunately this errors out: Error rendering template: TemplateRuntimeError: no test named 'endswith'
would be cool…probably my imagination taking the better of me again…?
or:
{{ states.sensor |map(endswith='actueel')|map(attribute='state')|map('int')|sum }}
error: Error rendering template: FilterArgumentError: map requires a filter argument
or take the endswith out of the filter mappings and try it as a condition:
{% if states.entity_id.endswith('actueel') %}
{{ states.sensor |map(attribute='state')|map('int')|sum }}
{%endif%}
would be nice too… but nothing happens (of course…) anyways, you get my drift…
something else:
this is a very nice template:
map_totaal_actueel_sensors:
friendly_name: Overzicht sensors actueel
unit_of_measurement: 'Watt'
value_template: >
{%-for state in states.sensor
if state.entity_id.endswith('actueel') and state.state >'0' %}
{{state.name}} : {{state.state}}
{%-endfor%}
{{ '-'.ljust(30, '-') }} {{ '-'.ljust(30, '-') }}
based on @skalavala 's nrs 1 and 4 jinja, but there no way I can get it to show in the frontend (max 255 character count), and even with the custom-ui state card value_only, which i use in other places with sensors or log file like this, it doesn’t show up, either giving the Unknown, or stopping the system in a permanent loop it seems.
Could you see why that is?