With markdown cards we can write HTML and Templating to output a list of values given some constraints. In this tutorial we are going to create a light report.
Quick steps:
Go to dashboards, add card and search for markdown card. Copy and paste the code below and then use the Youtube video below to understand that the code does and how to change it to fit your own needs.
<h2> <ha-icon icon='mdi:lightbulb'></ha-icon> Light report</h2>
<h3>Number of Lights ON: {% set reject = [ 'coloured_lights', 'first_floor_lights','inspiration_room_lights','second_floor_lights' ] %}
{{ states.light | rejectattr('object_id', 'in', reject) | selectattr('state','equalto','on')| list | length }}
</h3>
{% for state in states.light | rejectattr('object_id', 'in', reject) | selectattr('state','equalto','on') %}
<hr> <table><tr> <td>
{{state.entity_id}}
</td></tr></table>
{%- endfor %}
What to learn more? Join my templating course 30% off (10 slots) open –> https://courses.leonardosmarthomemakers.com/enroll/1764277?price_id=2347656