Anashost / MY-HA-DASH

81 stars 8 forks source link

Roomcards dissaper after F5 or CTRL + F5 #9

Closed AarvdH closed 7 months ago

AarvdH commented 7 months ago

Hi, me again, I startet 3 times all over again, but it doesn't seems to work I have your wunderfull dashboard and now I put only two roomcards to it. Plain simpel your code with my entities. It is all workeing and no errors. So I have the 3 input_select, rooms, More, devices. No on the page of the Rooms I have two rooms, devices I left a bit alone for now and More I have 4 cards. But the are nothing yet. If I close the editing everything is working just fine. But if I press F5 ore CTRL+F5 the both cards are not loaded. I switch between more and device and all the cards are there, If I go back to rooms my two cards are gone. If I then go into edit mode the cards are there and I can close the editing mode again and all is fine again, until again the F5 is pressed. I tried it with 3 browsers, Edge, Chrome, Vivaldi. All the same. I took your code from Living room and Kitchen. So just two cards. Any idea why this happends? There are no errors or what so ever. Hope you can help me with this strange thing. Greetings, Hans.

Anashost commented 7 months ago

Thats kinda strange, i don't have this problem now but i think i had similar issues a while ago.

For now, if you have person cards in the main view of your dashboard, then try to move them to other view and check if this will help loading the main view correctly.

Doing so might release some load from the main view and make it load faster and in time.

Anashost commented 7 months ago

If that helped then, do the following for your persons card.

Screenshot_20231125_202127_Home Assistant

Anashost commented 7 months ago

Lastly, this dashboard was meant to be used on phones, as it is not well optimized for browsers, so that might contribute to the issue you have.

AarvdH commented 7 months ago

I have two person cards but they are completly out of this view. And, if I chose the More view I don't have the problem and at the bottom are those person cards. That would be not the issue. And I am making this for my phone but I must create it on a browser. :-)
But the problem is also on the companion app, And that app is also a browser undone all the other browser stuff. But I think I have something, If I wait long enough, so 5 minutes then it all appears, I didn't configure the swipe card completely, so maybe It's looking for entities that aren't there. But then is it still curious that the More view doesn't have those problem at all. Thanks for your suggestions. I will work on it. Do you have your beautiful Plugs card anywhere on GitHub? Nice evening, Hans.

Anashost commented 7 months ago

I didn't configure the swipe card completely, so maybe It's looking for entities that aren't there.

This might be the issue, i hope it fixes it.

Here's the plug card:

type: custom:mushroom-entity-card
entity: switch.plug_2_local
tap_action:
  action: more-info
double_tap_action:
  action: none
hold_action:
  action: more-info
name: Plug 2 - Heater
icon: mdi:radiator
icon_color: orange
card_mod:
  style:
    mushroom-shape-icon$: |
      .shape {
        --shape-animation:
        {%- set sensor = states('sensor.p2_consumption_in_watt') %}
        {%- if sensor == '0.0' %} ping 0s infinite;
        {%- elif sensor == 'unknown' %} ping 0s infinite;
        {%- elif sensor == 'unavailable' %} ping 0s infinite;
        {%- else %} ping 1s infinite;
        {%- endif %}
      }
      @keyframes ping {
        0% { box-shadow: 0 0 1px 1px rgba(var(--rgb-{{ config.icon_color }}), 0.7); }
        100% { box-shadow: 0 0 5px 15px transparent; }
      }
    .: |
      mushroom-shape-icon {
        --icon-size: 65px;
        display: flex;
        margin: -22px 0px 0px -22px !important;
      }
      ha-card {
        clip-path: inset(0 0 0 0 round var(--ha-card-border-radius, 12px));
      }
AarvdH commented 7 months ago

Cool! Thank you. Hope in the future you will place more of those beutifull cards, Really like your work. Will buy you some coffee. :-)

Anashost commented 7 months ago

You're welcome. Will definitely post more in the future, once i got the time.

AarvdH commented 7 months ago

Hi, I have a question, I place it here but if you want that I start a new issue then I will do that. Yhe following, You have a fan for instance in the livingroom. If it is on it turns blue and start ti rotate. I have something simulair myslef but cant place it in your code, Becuase mu code for that is not based on a switch but on power usage. So if power drain is above 25% then on. I will place the code at the bottom. Is it possible to change your code to achieve this? Or is it a idea to make a binary sensor onder templates so that I have a on or off and put that answer in your code, and if so, wher do I put that? In the 'operator' section? My code:


primary: Ventilatie
icon: mdi:fan
icon_color: >-

  {% if states("sensor.mechanische_ventilatie_power_consumption") | float(0) >
  25 %}
    yellow
  {% endif %}
secondary: >-
  {{ "on" if states("sensor.mechanische_ventilatie_power_consumption") |
  float(0) > 25 else "off" }}
entity: sensor.mechanische_ventilatie_power_consumption
layout: vertical
multiline_secondary: false
fill_container: true
card_mod:
  style:
    mushroom-shape-icon$: |
      ha-icon {
            {{ '--icon-animation: spin 1s linear infinite;' if states('sensor.mechanische_ventilatie_power_consumption') | float > 25 }}
          }
      .shape {
        {{ '--shape-animation: ping 2s infinite;' if states('sensor.mechanische_ventilatie_power_consumption') | float > 25 }}
      }
      @keyframes ping {
        0% { box-shadow: 0 0 1px 1px rgba(var(--rgb-yellow), 0.7); }
        100% { box-shadow: 0 0 5px 15px transparent; }
      }
    .: |
      mushroom-shape-icon {
        {{ 'animation: blink 1s ease-in-out infinite;' if states('sensor.mechanische_ventilatie_power_consumption') | float > 25 }}
      }
      @keyframes blink {
        50% {opacity: 0.5;}
      }   ```
      The bottom of my code is I think fuhrter not needed, I only want the your blue fan is spinning blue If the power drain is above the 25 
      Thanks
      Hans
AarvdH commented 7 months ago

Yeah Got it, It was actually very simple. Made a binary_sensor of the template above and put it in your code as entity. Thats enough.