I recently moved all my Door/Window and Motion Binary sensors into groups. For example:
doorstatus:
name: Door Sensors
entities:
- binary_sensor.aeotec_dsb29_doorwindow_sensor_2nd_edition_back
- binary_sensor.aeotec_dsb29_doorwindow_sensor_2nd_edition_front
Before this move each of these sensors were at the top of the web ui and when a door opened or motion was detected these device(s) showed a nice black check mark. The sensors in a group have different (yellow with white check) icons which I find a bit hard to see.
Is there a way these icons can be changed when contained within a goup? Preferably a black check as before
You can change the icon and state to whatever you want using templates.
Notice in my group below, open doors and windows have the state ‘Open’ and ‘Closed’ instead of ‘On’ and ‘Off’ and their icons change to reflect their current state.
I am trying to implement both ideas here. It took a bit but I got the jest of themes, As for the template example, this works well with any of my door/window sensors ‘included’ into HA. What I am having problems with is how to do the same with my (zigbee) “virtual sensors” which are not part of HA and I update these sensors externally.
These -vsensors are defined as:
Obviously HA does not like if states.sensor.sumppumproom_door.state
Is there a means I can get this approach to work or do I have to define 2 sensors such as:
Just set device_class in your binary sensors correctly and you get the correct icons and correct wording automatically. No need for extra templates and crap.
Examples:
exit_doors_stuck:
friendly_name: Exit Door Stuck
device_class: door
value_template: "{{ is_state('group.exit_doors', 'on') }}"
delay_on:
minutes: 5
garage_doors_stuck:
friendly_name: Garage Door Stuck
device_class: garage_door
value_template: "{{ is_state('group.garage_doors', 'on') }}"
delay_on:
minutes: 10
family_room_tv:
friendly_name: Family Room TV
device_class: power
value_template: "{{not is_state('media_player.family_room_tv', 'off') }}"
Thanks for this information! By setting the device_class for my 4 door sensors, they now show the proper statuses and icons!
One follow up question though: in my config the 4 binary sensors sit in a group called ‘all_windows’. The overall status of this group is still ‘on’ or ‘off’. Is it possible to have the group status use the same ‘open’ and ‘closed’ statuses as the individual sensors?
This is a good question. I am convinced it used to work that way; but sometime around 0.9x it changed. I’ve not found confirmation of that; but did have to change some automations that use a group to on/off to work.
I found that going into Configuration on the left, then customization then choosing my entity , then “pick attribute” which is device_class, I can do this without editing any files
“device_class” doesn’t seem to work for binary_sensor when the platform is “remote_rpi_gpio”. HASS (v0.96.5) gives me an error that device_class isn’t supported. Am I doing something wrong?
thanks
delay_on and delay_off do exactly what the name means; they wait to set on or off by the amount of time specified so work well to debounce noisy templates. Like the “for” in automations.