Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power Wheels disappears randomly in 0.116.1 #64

Open
bluemantwo opened this issue Oct 9, 2020 · 11 comments
Open

Power Wheels disappears randomly in 0.116.1 #64

bluemantwo opened this issue Oct 9, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@bluemantwo
Copy link

0.116.1 of HA
0.1.4 of Power Wheel

The Power Wheel will often no appear until I refresh the screen numerous times. This started immediately after install of 0.116.1 (from 0.115.6).

No debug info shows up in log.

@gurbyz
Copy link
Owner

gurbyz commented Oct 10, 2020

I could reproduce this behavior for a minute when I switched to 0.116.2 myself. Maybe HA was using some cached frontend components, because after some time/refreshes it didn't happen again.

Is it still happening for you? If so, what version of the frontend do you use? (See /config/info.)

@bluemantwo
Copy link
Author

bluemantwo commented Oct 10, 2020

It is random. But if you refresh enough, it will return. But then go away later when opening up that tab again. I am using the latest front end: Frontend version: 20201001.2. I find the same result on 2 different PCs and 2 different Android phones. More an annoyance than anything, since I can eventually get it to populate on the screen. I have not yet noticed any other cards having this behavior. Here are my settings for the card:

cards:
  - active_arrow_color: green
    auto_toggle_view_period: 2
    energy_decimals: 2
    grid_energy_consumption_entity: sensor.grid_energy_consumption
    grid_energy_production_entity: sensor.grid_energy_production
    grid_power_entity: sensor.power_now_meter_w_sensor
    home_power_entity: sensor.power_now_usage_w_sensor
    initial_auto_toggle_view: false
    power_decimals: 0
    production_is_positive: false
    solar_energy_entity: sensor.solar_energy
    solar_power_entity: sensor.power_now_solar_w_sensor
    title_energy: Solar Energy Today
    title_power: Solar Power
    type: 'custom:power-wheel-card'

I was trying to go into Developer Tools in Chrome to see what is happening, but when I do that, the card pops up again! Strange behavior. I can also reproduce in FireFox was well. And, as I mentioned, on my Android phone in the HA mobile app.

@gurbyz gurbyz added the bug Something isn't working label Oct 11, 2020
@gurbyz
Copy link
Owner

gurbyz commented Oct 11, 2020

I can reproduce it now. (In my first response I also said that I could reproduce, but I saw a partial rendered card there, and never saw that again.)

I can get the same behavior, when I play with an extra parameter (v in my example) in the resources: part of Lovelace configuration. That (if you change the value) mimics the situation where you get to see a new version of the card the first time after upgrading.

  resources:
    - url: /local/custom-cards-lovelace/power-wheel-card.js?v=20201008b
      type: module

When I click 'Reload resources' and 'Refresh' in the UI and then refresh the browser, the issue occurs. The card doesn't show up. If I open the dev console, the card appears.

@GroenZoom
Copy link

Same here Hassio on PI.
Card does not show at all even after repeated refreshing.
No errors when checking config and no errors reported.
regards martin

@Appesteijn
Copy link

Appesteijn commented Oct 20, 2020

Same problem here with Home Assistant 0.116.4 on HassOS 4.14 with Firefox on MacOS

A force reload CMD+Shift+R shows it again.

In the source I see
Screenshot 2020-10-20 at 08 18 30

@gurbyz
Copy link
Owner

gurbyz commented Oct 20, 2020

I'm trying to solve this issue, but it's hard (for me at least ;-) ). (First I thought it was caused by putting the power-wheel-card inside other cards and that I had to use https://github.com/thomasloven/lovelace-hui-element. But that didn't help.)

Next I was triggered by this and maybe HA got improved in lazy loading cards and power-wheel-card is impacted by that. I tried the hint there to preload a card. But I can't tell if the situation did improve. Maybe now its 1 out of 10 instead of 3 out of 10? For sure I had to disable some testing for config errors in the card itself before the card even could be preloaded.

Not sure where to look now. I will put a version on the dev branch (with the extra resource and the disabled config error testing). I had to put preload-cards.js in the same folder as power-wheel-card.js and added this to resources:. Maybe others can check if there is some improvement for certain cases.

    - url: /local/<A FOLDER>/preload-cards.js?v=20201020j
      type: module
    - url: /local/<THE SAME FOLDER>/power-wheel-card.js?v=20201020n
      type: module

Please note the 'v' parameter that I had to upgrade every time to make HA load the latest version and not an old cached version. Please add debug: true to the setup of power-wheel-card to be able to check which version of the card is loaded. You will see this in the dev console:

image

To help, could the three of you:

  1. Switch on debug mode and post a image like above? I can compare browser versions and a lot of other things.
  2. Check if the above change to (hard) preload the card did something for you?
  3. Post here how 'nested' your card is inside which other cards?

@bluemantwo
Copy link
Author

bluemantwo commented Oct 20, 2020

Interesting. I have not tried loading the dev version yet, but I did do a test by adding PowerWheel to another existing tab. Doing that, it appears to work fine and does not 'disappear' even after numerous refreshes. However, oddly, that causes the 3rd card in the Tab to randomly disappear!

  - badges: []
    cards:
      - active_arrow_color: green
        auto_toggle_view_period: 2
        energy_decimals: 2
        grid_energy_consumption_entity: sensor.grid_energy_consumption
        grid_energy_production_entity: sensor.grid_energy_production
        grid_power_entity: sensor.power_now_meter_w_sensor
        home_power_entity: sensor.power_now_usage_w_sensor
        initial_auto_toggle_view: false
        power_decimals: 0
        production_is_positive: false
        solar_energy_entity: sensor.solar_energy
        solar_power_entity: sensor.power_now_solar_w_sensor
        title_energy: Solar Energy Today
        title_power: Solar Power
        type: 'custom:power-wheel-card'
      - entities:
          - entity: sensor.bbc_bat_volts_sensor
          - entity: sensor.bbc_cabin_temp_sensor
          - entity: sensor.bbc_load_watts_sensor
          - entity: sensor.bbc_pv_watts_sensor
          - entity: sensor.bbc_signal
        title: BBC Status
        type: entities
      - entity: sensor.rpi_monitor_bbc
        name: BBC Raspberry Pi Status
        name_prefix: RPi
        show_error: false
        temp_scale: F
        type: 'custom:rpi-monitor-card'
    icon: 'mdi:tent'

@bluemantwo
Copy link
Author

bluemantwo commented Oct 20, 2020

Wait, did something change? For some reason, I cannot get the PowerWheel card to disappear anymore. I did not update any parts of HA that I know of, and did not update Chrome that I know of. But for now, the Power Wheel is rock solid.

EDIT 1:
All I did was copy the Power Wheel card from one Tab to another Tab. This created a duplicate 2nd copy of Power Wheel. But now, the Power Wheel is working fine on both my PC Chrome browser and Android app. The Tab I added it to (listed above in prior post) does still have an issue where the 3rd card (rpi-monitor-card) does sometimes disappear. But both copies of the Power Wheel card seem just fine now.

EDIT 2:
After further testing, it appears that adding a 2nd Power Wheel copy in a different Tab of HA caused both copies to be rock solid now. I cannot get either one to disappear. Before, it would disappear ~50% of the time. Now after 20 or 30 refreshes, it always shows up.

@gurbyz
Copy link
Owner

gurbyz commented Oct 21, 2020

Thx for the extra info.

Maybe, by placing another instance of the power-wheel-card in your setup, the order of loading cards changes and this solves the issue. Or maybe this does trigger the lazy loading of custom cards in a different way. I got the feeling that this isn't specifically an issue for the power-wheel-card but could be an issue for all (custom?) cards in HHOME ASSISTANT Maybe the complexity/size/performance of power-wheel-card makes it more vulnerable, I don't know yet.

@bluemantwo
Copy link
Author

@gurbyz, I tend to agree. It is not an issue with just Power Wheel. After a full day of use and many, many restarts, Power Wheel is solid. But there is another custom card (rpi-monitor-card) that is now doing the disappearing act.

gurbyz added a commit that referenced this issue Oct 25, 2020
@greglearns
Copy link

@bluemantwo I wonder if the problems you were seeing are build-tool or service-worker caching related. Which build tool are you using (webpack, parceljs, etc.) when you had the problem? And where you using a service worker that was caching things?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants