Hi,
I was wondering what the icons for the different binary_sensor classes look like, so I made a minimalistic shell script that generates two sensors for each class, one with state “on” and one “off”:
#!/bin/sh
echo -e "name: 'Binary Sensor Classes and Icons\nentities:"
for class in cold connectivity heat light moisture motion moving occupancy opening power safety smoke sound vibration
do
for state in ON OFF; do
echo -e "platform: command_line\nname: ${class} ${state}\ncommand: echo ${state}\nsensor_class: ${class}" >${class}_${state}.yaml
echo " - binary_sensor.${class}_${state}"
done
done
This generates a bunch of files like motion_ON.yaml
, motion_OFF.yaml
etc. in the current directory and outputs what can be copied&pasted into a group configuration file:
name: 'Binary Sensor Classes and Icons
entities:
- binary_sensor.cold_ON
- binary_sensor.cold_OFF
- binary_sensor.connectivity_ON
- binary_sensor.connectivity_OFF
[...]
I have a directory for binary sensor configuration called binary_sensors
that is included like this in my configuration.yaml:
binary_sensor: !include_dir_list binary_sensors
The script is intended to be run from inside this (binary_sensors
) directory.
Then copy&paste the output into a group configuration file and - if needed - add that group to your default_view.
Restart HA and you’ll see a group with all the possible binary sensors in both states.
Not a big deal, but maybe someone else finds this useful…
Sebastian