Git Product home page Git Product logo

Comments (13)

jasonacox avatar jasonacox commented on July 2, 2024 1

Ok, the fix is easy! The issue is that pypowerwall proxy caches the responses from the Powerwall, including the setup JS. You just need to restart the pypowerwall proxy server.py and refresh your browser:

# if using a docker container
docker restart pypowerwall

I'll have to look to see if there is an easy way to have the proxy detect version upgrades and flush the cache.

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024 1

Thanks! Hopefully you can be the first to test it! 😄 I pushed the Build t22 to "latest" if you want to upgrade now.

from pypowerwall.

mcbirse avatar mcbirse commented on July 2, 2024 1

Look forward to testing this and providing feedback... whenever my next firmware update happens.

Confirmed no more issues with the Power Flow animation after a FW update for me. 👍

from pypowerwall.

danisla avatar danisla commented on July 2, 2024

I was gonna say, this looks like a caching issue. We might be able to inject some no-cache headers to prevent it from breaking.

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024

Thanks Dan! Did you happen to see this on your dakboard displays? I suspect this is going to be a rare occurrence. I'll see if there is something simple we can do.

from pypowerwall.

danisla avatar danisla commented on July 2, 2024

My powerwalls are offline this week because I'm adding another one so I didn't see it when the firmware update went out. However, I did see this behavior a couple times when I was developing the dashboard and it was a caching issue.

I'll see what my dakboard does when my powerwalls come back online later this week.

from pypowerwall.

danisla avatar danisla commented on July 2, 2024

So I'm still on 20.18.3. I have a first gen gateway. When I check for updated firmware, says I'm up-to-date.

Is there something special I can do to get the newer firmware?

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024

That's interesting! It doesn't seem like Tesla pushes out firmware versions globally. I suspect they have a digital twin of all of our configurations and only apply updates to those systems that need it, or at least the ones they want to "test" with.

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024

Flashing animation due to firmware upgrade raised in jasonacox/Powerwall-Dashboard#112. TODO: Research cause (browser or proxy cache) and solution (no-cache header and/or TTL).

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024

So there are two issues it seems:

  1. The animation and required assets are cached by the browser indefinitely, meaning that a refresh or reload won't fix it.
  2. The pypowerwall proxy caches all the js, css and other assets indefinitely, same problem as above. The fix is to do a pypowerwall proxy restart.

To fix the browser cache, I added the "Cache-Control: no-cache" header to the non-API endpoints (ie. animation css, js, etc).

To fix the local cache, based on some observations from @mcbirse in the discussion jasonacox/Powerwall-Dashboard#112, I made changes to the proxy server to detect when Powerwall Authentication happens (ie. auth token will change during a Firmware update) and then force clear the local cache.

This all seemed to work and I noticed the browser would re-request all the assets when a browser reload was performed (did not happened before). I released Build t20 that contains this update (see diff).

Now, I confess, I tend to over-engineer things. As I watched the debug log during my tests of t20, it occured to me that all the logic I added to provide a local cache was only being used on a browser reload. That is a rare event for a dashboard especially if you are rendering an animation. Removing the local cache removes the need to detect a firmware update. I pulled that code and new logic out and released Build t21 (see diff).

I just need another Firmware upgrade to test this new code. Sadly, a firmware upgrade on my system just happened last night before I made these changes so I won't be able to test this for a while but I'll publish this update so others can report how well it works during firmware updates on their systems. I am going to continue to test the t21 code to ensure I didn't introduce any memory leaks before I update the "latest" tag (currently t19) with this new version (t21).

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024

As part of testing t21, I had an idea. It would be nice to be able to display the Powerwall firmware version or other data using some simple JQ calls. To support the CORS policy, the pypowerwall proxy also needs to set a "Access-Control-Allow-Origin: *" header. I added that and updated the example.html to include firmware version information in Build t22 (see diff):

image

from pypowerwall.

mcbirse avatar mcbirse commented on July 2, 2024

Great solution to this issue! Look forward to testing this and providing feedback... whenever my next firmware update happens. Maybe it won't be too long for me as mine hasn't updated to 22.26.4 yet.

Adding the firmware version to the Power Flow animation is a really nice addition too - love it! ❤️

from pypowerwall.

jasonacox avatar jasonacox commented on July 2, 2024

Thanks @mcbirse ! No issues for me either. Thanks everyone! 🙏

from pypowerwall.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.