Really nice Corey. Great work.
Just a quick update. To support just about any type of HA entity, I’ve done a bit of a rewrite. I’ve been learning quite a bit along the way myself, so always looking to improve it.
I have the new version running on my machine, but want to do some more testing before putting it up on GitHub. With this new version, you will be able to configure just about everything yourself. Below is an example showing what I have in my setup:
binary_sensor.floorplan:
custom_ui_state_card: floorplan
image: /local/custom_ui/floorplan/floorplan.svg
password: <some_password_here>
stylesheet: /local/custom_ui/floorplan/floorplan.css
last_motion_entity: sensor.template_last_motion
groups:
- name: Sensors
entities:
- sensor.melbourne_now
- name: Switches
entities:
- switch.doorbell
states:
- state: 'on'
fill: '#F8D2B9'
- state: 'off'
fill: '#B9BFF8'
- name: Binary sensors
entities:
- binary_sensor.front_hallway
- binary_sensor.hair_salon
- binary_sensor.back_hallway
- binary_sensor.kitchen
states:
- state: 'on'
fill: '#F8B9BE'
- state: 'off'
fill: '#C4EDB1'
state_transitions:
- name: On to off
from_state: 'on'
to_state: 'off'
duration: 10
- name: Cameras
entities:
- camera.hallway
- camera.driveway
- camera.front_yard
- camera.front_door
As you can see, the new style of config lets you create groups of entities, so you can define bahviours at a group level. You can create as many groups as you want, and split up your entities into whichever groups you want, as long you want them to share the same colours, transitions, etc. I have my binary sensors in the same group, as I want them all to show the same ‘on’ and ‘off’’ colours, but you can easily split them into multiple groups to have different colouring schemes.
Also, the new version supports SVG <text>
elements, so you can now display any textual information on your floorlplan (i.e. weather, as in my example).
Below is what my floorplan looks like, using the new version and the config I showed above:
Will let you know when this is on GitHub, and when I’ve updated the documentation, etc.
BTW, on more thing I would like to add to the new version is the ability to (optionally) specify which CSS classes to apply to different states. Currently, the code changes the fill colour based on an entity’s state, but it would be good to use CSS to change the appearance, as you can do a lot more with it, and you have plenty of flexibility in managing this yourself.
And another nice thing with the new version. The same HTML file can be reused for both custom panels and state cards, so no need to copy it and make those few changes. A single file is now used, for those who want to display the floorplan in both places.