good evening, all, I am semi new to HA (started in mid November 24’), I finally got around to making dashboards, working on my mobile dashboard right now and stumped a bit.
I am using chip cards at the very top of the Mobile Dashboard, call them ‘at a glance’, meaning I have one setup so far and working to simply show the number of lights on. the second chip card I am working on is to show the number of doors open, which is 21 right now . I use templates for both of these so far, and have text pasted into my configuration.yaml. The problem is my door contacts are binary sensor entity’s so when I setup the template it also shows in the door open count, active presence sensors, temperature motion sensors, etc (since they are all binary sensors as well), which is why mobile dashboard shows 21 open doors right
. I see from the text I paste, I am able to right in to exclude binary sensors, but since I need to exclude like 15+ at least, that is too messy. There has to be a a smarter way, but I do not know it yet.
please help and I am semi understanding HA since I have been using for around 5 months/
below is the exact text I am pasting into my configuration.yaml for templates of lights and doors (lights is working fine). Also, attached is a screenshot of the top of my mobile dashboard showing my current chip cards.
thanks in advance!
template:
- sensor:
- name: "lights on"
unique_id: lights_on
icon: mdi:lightbulb-on
state: "{{ states.light |selectattr('state','eq','on') | rejectattr('entity_id', 'search', 'light.ENTITY_YOU_DO_NOT_WANTED_COUNTED') | rejectattr('entity_id', 'search', 'light.ENTITY_YOU_DO_NOT_WANTED_COUNTED') | map(attribute='entity_id') | list | length}}"
- sensor:
- name: "doors open"
unique_id: doors_open
icon: mdi:mdi:door-open
state: "{{ states.binary_sensor |selectattr('state','eq','on') | rejectattr('entity_id', 'search', 'binary_sensor.driveway_camera_motion', 'binary_sensor.charlotte_s_bedroom_human_presence_sensor_aqara_presence') | rejectattr('entity_id', 'search', 'binary_sensor.driveway_camera_motion', 'binary_sensor.charlotte_s_bedroom_human_presence_sensor_aqara_presence') | map(attribute='entity_id') | list | length}}"