Lovelace: custom sidebar card

Yes I have the same if the top menu is set to true, the sidebar dissappears.

hello
how did you get the message of window open so much and door open so much?

By using Aqara window/door sensors.

You can use my example for your Lovelace dashboard:

{% if states('sensor.current_windows_first_floor_open') | float > 1 %}
    <li>Boven {{states('sensor.current_windows_first_floor_open')}} ramen
    open</li> {% endif %}

Where "sensor.current_windows_first_floor_open is a sensor that functions as a ā€œgroupā€.

You can use my example for multiple window/door sensors in your configuration.yaml like so:

- platform: template
    sensors:
      current_windows_first_floor_open:
        friendly_name: Current Windows First Floor Open
        value_template: >
          {% set total = 0 %}
          {% if is_state('binary_sensor.window_sensor_master_bedroom', 'on') %}
            {% set total = total + 1 %}
          {% endif %}
          {% if is_state('binary_sensor.window_sensor_office', 'on') %}
            {% set total = total + 1 %}
          {% endif %}
          {% if is_state('binary_sensor.window_sensor_walk_in_closet', 'on') %}
            {% set total = total + 1 %}
          {% endif %}
          {{total}}
1 Like

hello,

is there also possibility to set this for a cover wall that i see how many covers are open wall does not come out?

thanks in advance

Issues with installing this. I went to HACS->Add On Store and ā€¦ Repositories and tried to add the following:

getting invalid repository. Any ideas?

You mean you want to see how many covers are open? Well, you can, but it depends on what kind of covers you have and how they are exposed to home assistant

How did you manage setting a background image? Could you share your code?

When using multiple dashboards and the raw editor Iā€™ve found that when hideTopMenu is set to true the javascript is creating an error. Since it has the error it doesnā€™t finish loading and the page gets a 404 not showing it.

Uncaught (in promise) TypeError: root.shadowRoot.querySelector(...) is null
    buildSidebar https://{address}/hacsfiles/sidebar-card/sidebar-card.js:18338
    async* https://{address}/hacsfiles/sidebar-card/sidebar-card.js:18391
sidebar-card.js:18338:33
    buildSidebar https://{address}/hacsfiles/sidebar-card/sidebar-card.js:18388
    InterpretGeneratorResume self-hosted:1483
    AsyncFunctionNext self-hosted:689
    (Async: async)
    <anonymous> https://{address}/hacsfiles/sidebar-card/sidebar-card.js:18391
    InnerModuleEvaluation self-hosted:2381
    evaluation self-hosted:2332

Here is the chunk of code itā€™s pointing to. Stating that the root.shadowRoot.querySelector(ā€˜ch-headerā€™) is Null

async function buildSidebar() {
    let lovelace = await getConfig();
    if (lovelace.config.sidebar) {
        const sidebarConfig = Object.assign({}, lovelace.config.sidebar);
        if (!sidebarConfig.width || (sidebarConfig.width && typeof sidebarConfig.width == 'number' && sidebarConfig.width > 0 && sidebarConfig.width < 100) || (sidebarConfig.width && typeof sidebarConfig.width == 'object')) {
            let root = getRoot();
            if (sidebarConfig.hideTopMenu && sidebarConfig.hideTopMenu === true) {
                root.shadowRoot.querySelector('ch-header').style.display = 'none';
            }

edit: As a short term workaround I used kiosk mode and added the following to my raw configuration before sidebar. You can temporarily disable the mode to make more edits by adding ?disable_km to the end of your URL.

kiosk_mode:
  hide_header: true

how did you get the transparent on the sidebar as a background? Iā€™m going crazy with no resultsā€¦ Thanks

something like this I guess?

changing the colours etc to transparentā€¦ alter the styles to your needs

sidebar:
  title: null
  style: |
    :host {
        --sidebar-background: #1E2022 ;
        --sidebar-text-color: #fff;
        --face-color: #21353E;
        --face-border-color: #21353E;
        --clock-hands-color: #fff;
        --clock-seconds-hand-color: #fff;
        --clock-middle-background: #21353E;
        --clock-middle-border: #21353E;
    }
    #customSidebar {
       z-index: 9999!important;
     }
    .sidebarMenu {
        border: none !important;
        
     }
    .sidebarMenu li {
        line-height: 35px!important;
        color: rgba(255, 255, 255, 0.8)!important;
     }
    .sidebarMenu li ha-icon {
        color: rgba(255, 255, 255, 0.4)!important;
     }
    .sidebarMenu li.active {
        background-color: #2C2E30!important;
        border-radius: 40px!important;
        font-weight: bold!important;
     }
    .sidebarMenu li.active ha-icon {
        color: white!important;
     }
    .digitalClock {
        padding-bottom: 5px;
        padding-top: 50px
    }
    .digitalClock {
        color: rgba(255, 255, 255, 0.7)!important;
        font-size: 5.41vw!important;
        font-weight: 200!important;
        letter-spacing: -0.05vw!important;
        text-align: center;
    }
    .date {
        padding-bottom: 10px;
        color: rgba(255, 255, 255, 0.3);
        font-size: 1.3vw;
        font-weight: 300;
        text-align: center;
        letter-spacing: -0.05vw;
    }

if I have a bottom card that when tapped navigated to a different page that is not listed in the menu that active item does not change

as a side note if I create a menu item for the bottom navigation item, when the bottom card is clicked the active menu item still does not changeā€¦ the url does

How can I make a template a different color than the others?
If it is even possible?

hey @peteywhit I might have messed something up, but I took your JS file and replaced my resource with yours, but the am/pm is still messed up for me? I also tried forking and merging your change to try and add the forked addon through hacs, which also did not resolve the am/pm. Any thoughts? Bonus points if you know how to drop the 0 for 1-9 oā€™clocks.

Hey @marshes, did you use the file from here? peteywhit/sidebar-card

You are a damn saint for posting this. :slight_smile:

disregard, think it was a user error. If I read correctly, hacs defaults to the .gz file if itā€™s present, so suspect it wasnā€™t actually using your file until I removed it. Now working appropriately, but after all that, I disabled your period config anyway as the spacing works better without. Attaching my kiosk view Iā€™m building to run on my phone during the work day. Next up, going to use the layout card to better place the cards, resize the weather card and vertically center everything.

edit: added the view with layout and gap cards that Iā€™ll be rocking until I can take more time to build the Music tab.

Hi,

The sidebar load only after refresh the page,

Even when I using kiosk mode.

As someone manage to solve it ?

1 Like

Same issue for me too

same issue here

Has anyone been able to use an image as the background for the sidebar?