Floorplan UI with Color synced lights

Hi,

So what I managed to do is the following. I’m editing a bit, so it doesn’t get too long.

lovelace-ui.yaml:

views:
- title: Lights
  cards:
    - type: 'custom:config-template-card'
      entities:
      ...
      card:
        type: 'custom:state-switch'
        entity: input_select.floorplan_floor
        states:
          Rez:
            !include frontend/lights_rez.yaml
          1er:
            !include frontend/lights_1er.yaml

The custom state switch allows me to switch between ground floor and 1st floor based on the input_select.floorplan_floor which I action via a service call button in the sidebar.

For lights_rez.yaml (same for both files, but with different images and entities):

type: picture-elements
image: /local/ui/floorplan/Rez_nuit.jpg
elements:
  #all images and code above the sidebar goes here
  - !include sidebar.yaml

The last part is in sidebar.yaml:

type: 'custom:group-element'
style:
  height: 100%
  left: 0%
  top: 0%
  width: 23.4765625%
elements:
  - action: none
    hold_action:
      action: none
    image: /local/ui/sidebar/sidebarBG2.png
    style:
      height: 100%
      left: 50%
      top: 50%
      width: 100%
    tap_action:
      action: none
    type: image

#and keep going with the rest of the code for the sidebar, following this indentation.

Beware of the styling in sidebar.yaml as the percentages are now relative to the custom:group-element and will appear quite small if you keep the values from @lukevink.

Two final remarks: I still need to find a way of displaying “On” and “Off” buttons in the sidebar depending on the currently viewed navigation_path. I haven’t found the right solution yet, thinking of using custom:state-switch but I haven’t figured out how to get the current navigation path as a state which would trigger the state switch.

This also does not eliminate the flickering completely, since it is due to the UI reloading. To be honest, I don’t perceive it very much, though.

Thank you for sharing that. Unfortunately both your configuration and my own attempts don’t appear to stop the weather and temperature graph from flashing when other elements change. I have even just tried wrapping those two elements in the group-element card but they still flash when other elements change.

So I’ll have to keep looking into it. Thanks for your time to write up the config.

–Update: It’s nothing to do with the chosen image as ive just changed the entity_id to one that was previously working and it works flawlessly and quick. So it seems theres a problem with just these two entities. They are part of the same shelly 4Pro device (2 of 4 channels - will try the other two channels now to see if they are also reacting slowly)

–Update 2: When the offending entity is pressed, it turns the entity to the correct state almost immediately (seen via developer tools - Im not physically in the room at the moment but programming from upstairs) but changing to another entity from the same device also produces the same results.
I have three of the same devices (Shelly 4Pro) all set up at the same time with the same settings. Two of them are rendering images in lovelace perfectly and one that is not. Any ideas?

PROBLEM

I have a small problem I dont know how to solve…

I have four zones setup inside an open-plan kitchen / dining room

Two of the light entities work fine and render a new image with the light on in about 1second. The other two fail to render the image when clicked, until I click on another light and then they will both render at the same time.

They both have the same config (copy and pasted - then changed all the light.entities manually)

The only thing I can think of it being is the two entities that are not working properly have shiny surfaces with lots of light reflections. one is a glass dining table and the other is the glossy kitchen cabinets.

I have used the above patch to make the rendering quicker (on-off vs dimming the render in and out) which i have pasted below…

opacity: "${states['light.gu10_cupboards_1'].state === 'on' ? (states['light.gu10_cupboards_1'].attributes.brightness / 255) : '0'}"

Does anyone have any suggestions on how i can debug this and get them all rendering at the same speed (<1second would be nice)

My setup uses a Raspberry pi 4 4GB and an apple iPad to render the lovelace.
I’m using 0.114.4
Any more information needed can be supplied.

Many Thanks

No problem! I really think the flashing has to do with the fact that the UI is reloading, because I have very similar behavior. However, I have no idea how to fix this… If you ever do find a solution, I’d be interested as well.

@lukevink everything is working great! thanks for sharing.
i have only one issue, if i enable “panel mode” and “kiosk mode” i do have an annoying top bar, as you can see in the attached photo. is there a way to remove it?

thanks in advance

Hi @lukevink
Thank you for this awesome work. This was a great example. especially the config file in github was very usefull.

I think I have done it, but there seems to be one last issue with refreshing the screen.

If I start chrome for the first time and go to the panel view with the floorplan, the page stays blank. :frowning:

  • When I go to another page, F5, and back to the floorplan again, it does show correctly.
  • When I go to the editor, it does show correctly

This behaviour is on windows OS + Chrome and andriod device the same.

I must be missing one small small think (I hope). But I can’t find it. Could someone please do a short sanity check on the code I have produced?

What am I missing here?
I think the culprit must be somewhere in the first 40 lines, the rest is mainly copy paste. :slight_smile:

Again, many thanks for this awesome work. :slight_smile: And the willingness to put it all up here. Supurb!!!

Dropdown >>> CODE IN HERE <<<
type: 'custom:config-template-card'
entities:
  - input_boolean.dag_of_nacht
  - light.fibaro_system_fgd212_dimmer_2_level_6
  - input_boolean.enable_automation_motion_sensor_snachts
  - switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4
  - switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2
  - light.fibaro_system_fgd212_dimmer_2_level_4
  - light.fibaro_system_fgd212_dimmer_2_level_3
  - switch.fibaro_system_fgs223_double_relay_switch
  - switch.fibaro_system_fgs223_double_relay_switch_2
  - light.tvlamp
  - switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch
  - input_boolean.mechanische_ventilatie_stand_1
card:
  type: picture-elements
  image: /local/temp/bg_alles_uit_nacht_3.png
  style: |
    ha-card:first-child {
      background: rgba(42, 46, 48, 1)
    }
  elements:
    - action: none
      entity: input_boolean.dag_of_nacht
      hold_action:
        action: none
      state_image:
        on: /local/temp/bg_alles_uit_dag_3.png
        off: /local/temp/bg_alles_uit_nacht_3.png
      style:
        height: 100%
        left: 50%
        mix-blend-mode: lighten
        opacity: '${ states[''input_boolean.dag_of_nacht''].state }'
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: input_boolean.dag_of_nacht
      hold_action:
        action: none
      image: /local/temp/bg_alles_uit_dag_3.png
      style:
        filter: >-
          ${ "hue-rotate(" + (states['input_boolean.dag_of_nacht'].attributes.hs_color
	  ? states['input_boolean.dag_of_nacht'].attributes.hs_color[0] : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['input_boolean.dag_of_nacht'].state === 'on' ?
          (states['input_boolean.dag_of_nacht'].attributes.brightness / 255) :
          '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: light.fibaro_system_fgd212_dimmer_2_level_6
      hold_action:
        action: none
      image: /local/temp/bg_wclamp_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['light.fibaro_system_fgd212_dimmer_2_level_6'].attributes.hs_color
          ?
          states['light.fibaro_system_fgd212_dimmer_2_level_6'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['light.fibaro_system_fgd212_dimmer_2_level_6'].state === 'on'
          ?
          (states['light.fibaro_system_fgd212_dimmer_2_level_6'].attributes.brightness
          / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: light.fibaro_system_fgd212_dimmer_2_level_4
      hold_action:
        action: none
      image: /local/temp/bg_plafondlamp_zithoek_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['light.fibaro_system_fgd212_dimmer_2_level_4'].attributes.hs_color
          ?
          states['light.fibaro_system_fgd212_dimmer_2_level_4'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['light.fibaro_system_fgd212_dimmer_2_level_4'].state === 'on'
          ?
          (states['light.fibaro_system_fgd212_dimmer_2_level_4'].attributes.brightness
          / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: light.fibaro_system_fgd212_dimmer_2_level_3
      hold_action:
        action: none
      image: /local/temp/bg_plafondlamp_tv_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['light.fibaro_system_fgd212_dimmer_2_level_3'].attributes.hs_color
          ?
          states['light.fibaro_system_fgd212_dimmer_2_level_3'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['light.fibaro_system_fgd212_dimmer_2_level_3'].state === 'on'
          ?
          (states['light.fibaro_system_fgd212_dimmer_2_level_3'].attributes.brightness
          / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4
      hold_action:
        action: none
      image: /local/temp/bg_traplamp_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4'].attributes.hs_color
          ?
          states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4'].state
          === 'on' ?
          (states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4'].attributes.brightness
          / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: light.tvlamp
      hold_action:
        action: none
      image: /local/temp/bg_tvlamp_3.png
      style:
        filter: >-
          ${ "hue-rotate(" + (states['light.tvlamp'].attributes.hs_color ?
          states['light.tvlamp'].attributes.hs_color[0] : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['light.tvlamp'].state === 'on' ?
          (states['light.tvlamp'].attributes.brightness / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2
      hold_action:
        action: none
      image: /local/temp/bg_staandelamp_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2'].attributes.hs_color
          ?
          states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2'].state
          === 'on' ?
          (states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2'].attributes.brightness
          / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch
      hold_action:
        action: none
      image: /local/temp/bg_nachtlamp_trap_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch'].attributes.hs_color
          ?
          states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 50%
        mix-blend-mode: lighten
        opacity: >-
          ${states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch'].state
          === 'on' ?
          (states['switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch'].attributes.brightness
          / 255) : '0'}
        top: 50%
        width: 100%
      tap_action:
        action: none
      type: image
    - action: none
      entity: input_boolean.mechanische_ventilatie_stand_1
      hold_action:
        action: none
      image: /local/fan_stand_1.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['input_boolean.mechanische_ventilatie_stand_1'].attributes.hs_color
          ?
          states['input_boolean.mechanische_ventilatie_stand_1'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 85%
        mix-blend-mode: lighten
        opacity: >-
          ${states['input_boolean.mechanische_ventilatie_stand_1'].state ===
          'on' ?
          (states['input_boolean.mechanische_ventilatie_stand_1'].attributes.brightness
          / 255) : '0'}
        top: 53%
        width: 4%
      tap_action:
        action: none
      type: image
    - action: none
      entity: switch.fibaro_system_fgs223_double_relay_switch
      hold_action:
        action: none
      image: /local/fan_stand_2.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['switch.fibaro_system_fgs223_double_relay_switch'].attributes.hs_color
          ?
          states['switch.fibaro_system_fgs223_double_relay_switch'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 85%
        mix-blend-mode: lighten
        opacity: >-
          ${states['switch.fibaro_system_fgs223_double_relay_switch'].state ===
          'on' ?
          (states['switch.fibaro_system_fgs223_double_relay_switch'].attributes.brightness
          / 255) : '0'}
        top: 53%
        width: 4%
      tap_action:
        action: none
      type: image
    - action: none
      entity: switch.fibaro_system_fgs223_double_relay_switch_2
      hold_action:
        action: none
      image: /local/fan_stand_3.png
      style:
        filter: >-
          ${ "hue-rotate(" +
          (states['switch.fibaro_system_fgs223_double_relay_switch_2'].attributes.hs_color
          ?
          states['switch.fibaro_system_fgs223_double_relay_switch_2'].attributes.hs_color[0]
          : 0) + "deg)"}
        left: 85%
        mix-blend-mode: lighten
        opacity: >-
          ${states['switch.fibaro_system_fgs223_double_relay_switch_2'].state
          === 'on' ?
          (states['switch.fibaro_system_fgs223_double_relay_switch_2'].attributes.brightness
          / 255) : '0'}
        top: 53%
        width: 4%
      tap_action:
        action: none
      type: image
    - image: /local/0_on.png
      style:
        Left: 6.5%
        Top: 60%
        width: 5%
      tap_action:
        action: none
      title: Knop verdieping 0
      type: image
    - image: /local/1_off.png
      style:
        Left: 6.5%
        Top: 75%
        filter: drop-shadow(3px 3px 3px black)
        width: 5%
      tap_action:
        action: navigate
        navigation_path: /lovelace/Verdieping_1/
      title: Knop verdieping 1
      type: image
    - image: /local/2_off.png
      style:
        Left: 6.5%
        Top: 90%
        filter: drop-shadow(3px 3px 3px black)
        width: 5%
      tap_action:
        action: navigate
        navigation_path: /lovelace/Verdieping_2/
      title: Knop verdieping 2
      type: image
    - entity: input_boolean.woonkamerverlichtingaan
      state_filter:
        'off': blur(2px) opacity(90%)
        'on': blur(2px) opacity(100%)
      state_image:
        'off': /local/knop_grijs.png
        'on': /local/knop_geel.png
      style:
        Left: 7%
        Top: 8%
        border: 0px solid yellow
        border-radius: 10%
        height: 4%
        width: 10%
      tap_action:
        action: none
      title: Verlichting uit
      type: image
    - service: homeassistant.turn_off
      service_data:
        entity_id: input_boolean.woonkamerverlichtingaan
      style:
        width: 8%
        height: 4%
        border: 0px solid yellow
        left: 7%
        padding: 5px
        top: 8.5%
      title: Verlichting uit
      type: service-button
    - entity: input_boolean.enable_automation_motion_sensor_snachts
      state_filter:
        'off': opacity(90%) blur(0px)
        'on': opacity(100%) blur(2px)
      state_image:
        'off': /local/knop_grijs.png
        'on': /local/knop_groen.png
      style:
        Left: 7%
        Top: 20%
        border: 0px solid red
        border-radius: 1%
        height: 4%
        width: 10%
      tap_action:
        action: none
      title: Motionsensor
      type: image
    - service: homeassistant.toggle
      service_data:
        entity_id: input_boolean.enable_automation_motion_sensor_snachts
      style:
        border: 0px solid red
        left: 7%
        top: 20.5%
        width: 8%
        height: 4%
        padding: 5px
      title: Motionsensor
      type: service-button
    - entity: light.fibaro_system_fgd212_dimmer_2_level_3
      icon: 'mdi:lightbulb'
      style:
        '--iron-icon-height': 150%
        '--iron-icon-width': 150%
        left: 40%
        top: 32%
        border: 0px solid red
        border-radius: 50%
        padding: 20px
      tap_action:
        action: toggle
      title: Plafondlamp TV
      type: state-icon
    - entity: light.fibaro_system_fgd212_dimmer_2_level_4
      icon: 'mdi:lightbulb'
      style:
        '--iron-icon-height': 150%
        '--iron-icon-width': 150%
        left: 33%
        top: 59%
        border: 0px solid red
        border-radius: 50%
        padding: 20px
      tap_action:
        action: toggle
      title: Plafondlamp Zithoek
      type: state-icon
    - entity: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_2
      icon: 'mdi:lightbulb'
      style:
        '--iron-icon-height': 150%
        '--iron-icon-width': 150%
        left: 62%
        top: 77%
        border: 0px solid red
        border-radius: 50%
        padding: 20px
      tap_action:
        action: toggle
      title: Staande lamp
      type: state-icon
    - entity: light.tvlamp
      icon: 'mdi:lightbulb'
      style:
        '--iron-icon-height': 150%
        '--iron-icon-width': 150%
        Left: 28%
        Top: 20%
        border: 0px solid red
        border-radius: 50%
        padding: 20px
      tap_action:
        action: toggle
      title: TV Lamp
      type: state-icon
    - entity: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch_4
      icon: 'mdi:lightbulb'
      style:
        '--iron-icon-height': 150%
        '--iron-icon-width': 150%
        Left: 46%
        Top: 22%
        border: 0px solid red
        border-radius: 20%
        padding: 20px
      tap_action:
        action: toggle
      title: Trapkast
      type: state-icon
    - entity: light.fibaro_system_fgd212_dimmer_2_level_6
      hold_action:
        action: more-info
      state_filter:
        'off': opacity(0%)
        'on': opacity(0%)
      state_image:
        'off': /local/1px.png
        'on': /local/1px.png
      style:
        Left: 76%
        Top: 22%
        width: 7%
        border: 0px solid red
        border-radius: 0%
        padding: 0px
      tap_action:
        action: toggle
      title: WC_selectie_vakje
      type: image
    - entity: switch.fibaro_system_fgwpe_f_wall_plug_gen5_switch
      hold_action:
        action: none
      state_filter:
        'off': opacity(0%)
        'on': opacity(0%)
      state_image:
        'off': /local/1px.png
        'on': /local/1px.png
      style:
        Left: 62%
        Top: 24%
        width: 8%
        border: 0px solid red
        border-radius: 0%
        padding: 0px
      tap_action:
        action: toggle
      title: nachtlamp trap
      type: image

This is how it should look. :smiley:

FYI.
What I am working towards in the end, is a big touchscreen UI for a magic mirror interace :slight_smile: Still looking for the best hardware.
Things you see in the picture: Mechanical ventillation status, setting 1/2/3 represented by the number of fans. A motion sensor for the lights, status of the lights.

1 Like

Okay… silly me :face_with_hand_over_mouth:

Found the culprit. I didnt add card-mod.js to my HA install yet ghehehehee…

What are people using as an alternative now that custom_header has been archived and will stop working?

1 Like

The easiest option is to use card-mod along with it’s theme support. The theme cookbook includes recipes to remove the header completely, only show the tab portion of it, etc.

Does that include the ability to show different setups based on specific device/browser? (not based on user)

Yes and no. Not in the way that CH did. I solved it by creating a copy of my theme, editing the header part to what I want on a specific device and then apply said theme on the device. A bit cumbersome, but if you’re not changing things in your theme often, it’ll do for now.

1 Like

Thanks for the quick reply; I rarely change my theme so I’ll take a look and muscle through it.

A little question. I’m making a combination of this dashboard and the one of Mattias. I want to have multiple dashboards like this one but don’t want to copy paste the sidebar.

For this to achieve I used the layout-card with 2 columns and in each a picture-elements card.
For the first picture-element card I then use include for the elements:

title: Home
views:
  - title: Tablet
    panel: true
    theme: tablet
    path: tablet
    cards:
      - type: custom:layout-card
        layout: grid
        # gridrows: 100%
        gridcols: 21.5% 78.5%
        justify_content: left
        cards:
          - type: picture-elements
            gridcol: 1 / 2
            image: /local/sidebar.png
            style:
              {pointer-events: none, border-right: '1.5px solid rgba(58,69,73,0.2)'}
            elements: !include popup/sidebar.yaml
            
          - type: picture-elements
            image: /local/background.png
            gridrow: 1 / 1
            gridcol: 2 / 2
            style: 
              {
                height: 100%
              }
            elements:

This all works perfectly my only problem that both my columns height is too big and now I have a scrollbar:


Anybody with css skills that can help me to get rid off the scrollbar?

Hey everyone! Just updated the whole config for Version: 0.117.1.

2 Likes

Hey! thanks!

Ok so its a bit tricky to do a sanity check of your code from here. Theres so many things it could be. Best thing to do is right click --> Inspect in your browser and check out the console, see if there are any errors when the page is blank.

It is likely to be a javascript file somewhere. Sometimes it will also tell you the offending file or issue. Let me know what you find in the console and ill try to help you with that!

Ah there you go - ignore my other response then! :stuck_out_tongue:
In future, I always right click, inspect, check console. Usually any problems are highlighted there.

1 Like

Good lord, I have no idea… do let me know if you find something :open_mouth:

It’s not so advanced buth for me it seems to do the job for now

1 Like

Hi Luke.
Thank you very much for all your work, and sharing. :slight_smile:

question.
what did you change in the update to 117.1? anything specific I should check or correct? :slight_smile:

Hey nothing drastic… more or less just updating all the versions, moving resources to HACS, updating integrations etc.