Created
December 18, 2021 19:43
-
-
Save ybizeul/a4d5fcb61670951b9e7ff87f9632f8e7 to your computer and use it in GitHub Desktop.
HA picture-element generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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