reptilex / tesla-style-solar-power-card

Home assistant power card mimicking the one tesla provides for the powerwall app.
211 stars 59 forks source link

Browser hangs #125

Open galtamur opened 2 years ago

galtamur commented 2 years ago

Good morning, I have installed and correctly configured the card, and it's working beautifully. The only problem I have is that on Windows if I minimize the browser window (I use Chrome) or the HA app, when I restore the window it remains hung for some 20-30 seconds. I tested back by removing the card and this problem disappears, so looks like it's connected with the card. Any idea on how to solve this?

Here is the configuration of the card, if this can help:

type: custom:tesla-style-solar-power-card
name: Fotovoltaico
generation_to_house_entity: sensor.pv_solar2home_power
generation_to_battery_entity: sensor.pv_battery_charge_power_positive
generation_to_grid_entity: sensor.pv_grid_sold_power
battery_to_house_entity: sensor.pv_battery_discharge_power
grid_to_house_entity: sensor.pv_grid_used_power
grid_consumption_entity: sensor.pv_grid_used_power
battery_extra_entity: sensor.pv_battery_level
house_extra_entity: sensor.pv_daily_home_consumption_energy
generation_extra_entity: sensor.pv_daily_strings_energy
grid_extra_entity: sensor.pv_daily_grid_used_energy
grid_entity: sensor.pv_grid_usage_power
appliance1_consumption_entity: sensor.shelly_em_assorbimento_ch2
appliance1_icon: mdi:silverware-variant
appliance2_consumption_entity: sensor.shellyem_c45bbe77e611_channel_1_power
appliance2_icon: mdi:washing-machine
show_w_not_kw: 0
threshold_in_k: 1
hide_inactive_lines: 1
change_house_bubble_color_with_flow: 1

Thank you in advance, GA

caitotheonlypotato commented 2 years ago

I find the same issue with all browsers and also the HA companion app for android

reptilex commented 1 year ago

never heard of this issue before, sadly I don't possess neither windows nor android. How does this happen on the companion app? I presume you cannot minimize anything. I imagine the main issue with windows is that this app is awfully resource intensive due to the animation, I'm working on that but it will take at least till october. So hopefully the improvements help. Does this also happen with the energy card of HA? I'm going to copy a few concepts from that but if that is also an issue there, then this will not help.

tomcoleman commented 1 year ago

i get the same issue on galaxy tab 8, when you wake it (via walking past) almost freezes for 10-20 seconds then as if its "fetching" data or something then back to normal,

caitotheonlypotato commented 1 year ago

It happens on all of my Windows PCs running either Mozilla FF, Chrome or Edge, all android devices (phones and Tabs). Hang is temporary for me. On windows browsers it only occurs if I switch to another tab or application, it'll be frozen for a few seconds (variable up to 10 sec) on switchback. Likewise on Android devices, if the companion app is backgrounded on a page with this integration running, on returning to the app, the whole app is stuck for a few (up to 10 sec), then it frees up.

On Windows, the browser page can't be refreshed until the hang times out, so maybe it's a socket issue. While hung though, If you right click the tab and duplicate it, a fresh tab will open up and work even while the previous is still stuck. The longer I am switched away from the tab or app with them running in the background, the longer is the hang when returning to HA tab or app.

Since it only is a minor inconvenience, I've never bothered to report it, but since there is a report from another, I can contribute with my experience.

caitotheonlypotato commented 1 year ago

Here's a video

https://user-images.githubusercontent.com/57476695/180584687-ca70d7bd-02b0-477f-94b2-4f324b523035.mp4

reptilex commented 1 year ago

Ok. So by freezing you mean there is no update of the values for a few seconds, right? Well there are two reasons for this. On the video the update of the data happens as intended by HA. I don't get new data earlier therefore it cannot be updated earlier. Second, the card is waaaay too process intensive due to a calculation for the bubbles that happens every 10-30ms depending on your browser. This makes it use A LOT of CPU. I know of the issue and have an idea to make it better, but don't have the time.

twister36 commented 1 year ago

This also freezes my computer browser (Chrome on Windows Desktop) and mobile browser (Android Pixel). On my computer I will get a "wait for this script" prompt after a few seconds. The card causes no issues as long as your active on the tab with the dashboard. However if you go to another tab and come back to the dashboard then the issue will presents it self.

This isn't a refresh of the data elements issue, it causes all dashboard items and actually "all dashboards" with or without the "tesla power card" added to lock up. I had to remove the card completely from HACS to get my all my dashboards to stop freezing. I do really like the card, but I won't be able to add it again until this is resolved.