Hi all! New to this community, I decided to attempt something that was bugging me with 3D floorplans - My hue bulbs have color, and the floorplans I saw didn’t seem to do this dynamically. So here it is! My apporach to a floorplan focused minimal UI. This is a work in progress, I hope to add alot more custom gestures etc soon.
Check out a video of the whole UI: https://youtu.be/KcfZc1MXP_A
Features
- Dynamic 3D Floorplan: Hue and Brightness mapped individual lights with custom popup controller.
- Less cluttered interface displaying more information on a long press, inspired by Mattias Persson.
- Custom rain card to display predicted rain in the next 2 hours - seperate repo here
- Custom Xiaomi View for rapid room based zone cleanup
Approach & Picture-Elements Styling
This approach is heavily based on the Picture Elements Card for each view, and does not work in a traditional “Card” based way. Most cards include a heavy amount of styling and positioning. Some of this styling overrides the custom cards to use View Width so that their fonts, widths and heights scale according to the width of the display, so that I can use my interface on any resolution.
I first designed my whole UI in Pixelmator so that I could export the button images and Xiaomi floorplan overlay images.
The image transparent.png is used on state_image picture-elements to hide elements if not needed, though this was used before I realised I could conditionally display elements - will update this soon to clean it up.
The sidebar
Note, the sidebar is repeated across every view in the lovelace.yaml file and includes buttons for the views.
- Control Rooms: Tap a room to turn on or off all lights, hold tap to show custom controls.
- Control Lights: Tap a light icon to turn on or off individual lights, hold tap to show custom controls.
- Cleanup: Direct control of Xiaomi Mi robot and preset zones for room based cleanup
- All Devices: Show all devices in a familiar homekit UI, why not?
- Media: Button shows currently playing media, if playing, view shows relevant views for Plex or Spotify.
- Weather: Shows weather forecast and predicted rain from Buienradar.
Hardware in my Home
- Xgimi H1 PROJECTOR
- Sound system (controlled by an IR Blaster)
- Philips Hue Bulbs
- Osram Garden Poles (used for roof, outdoors)
- Xiaomi Mi Robot
- Philips motion sensors
Individual hue & brightness lights
Map entities to css with config-template-card:
This approach relies on config-template-card. The picture elements card is wrapped inside the config-template-card. All entites used are listed on the config card so that they can be passed to the templates used in CSS. To understand why, check: https://github.com/iantrich/config-template-card
Render Individual Lights:
To have multiple lights overlayed on top of each other, the solution is actually pretty simple. You render an image for each individual light and use the CSS property filter mix-blend-mode: lighten. This will make sure only the “light” part of the image is shown, and will blend together any amount of images on top.
Hue and Opacity
To map one of your light images to the actual live RGB color of the bulb, you can use the following CSS template style which will adjust the hue rotation to the hue of the bulb (in this case, light.table):
style:
filter: '${ "hue-rotate(" + (states[''light.table''].attributes.hs_color ? states[''light.table''].attributes.hs_color[0] : 0) + "deg)"}'
OR, include saturation (I found it buggy):
style:
filter: '${ "hue-rotate(" + (states[''light.table''].attributes.hs_color ? states[''light.table''].attributes.hs_color[0] : 0) + "deg) saturate(" + (states[''light.table''].attributes.hs_color ? states[''light.table''].attributes.hs_color[1] : 100)+ "%)"}'
To map opacity to the entity’s brightness, use this css template:
style:
opacity: '${ states[''light.table''].attributes.brightness / 255 }'
Cleanup
This is a custom screen made up of picture-elements that interact with the xiaomi robot vacuum component. An input text is used to determine the vacuums current state (cleaning, returning home etc) and that is used to conditionally change the picture-elements.
Weather
I built a custom card to display projected rain in the next 2 hours, using Buien Radar (Netherlands service).
For more on this card, check out this repo
Full Config:
Other Resources:
Heavily inspied by Mattias Persson
For a great article on making a 3D floorplan, check this out