Skip to content

Instantly share code, notes, and snippets.

@ybizeul
Created December 18, 2021 19:43
Show Gist options
  • Save ybizeul/a4d5fcb61670951b9e7ff87f9632f8e7 to your computer and use it in GitHub Desktop.
Save ybizeul/a4d5fcb61670951b9e7ff87f9632f8e7 to your computer and use it in GitHub Desktop.
HA picture-element generator
#!/bin/bash
for file in `ls -r $1-*.png`; do
entity=`echo $file | sed -E 's/.+-.+-(.*).png/\1/'`
if [ "$entity" == "off" ]
then
continue
fi
path="v2/$file"
cat << EOF
- type: image
entity: $entity
tap_action:
action: none
state_image:
'on': /local/floorplan/$path
'off': /local/floorplan/1x1.png
style:
left: 50%
top: 50%
width: 100%
EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment