Git Product home page Git Product logo

Comments (15)

Stephen2615 avatar Stephen2615 commented on July 18, 2024 1

Updated to 0.8.1 and everything is working nicely. Thanks to all.

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024 1

Interesting use case! I run the cron.sh every 5 minutes using this crontab entry:

*/5 * * * * /home/tesla/cron/cron-powerwall.sh > /dev/null 2>&1

You can edit your crontab with crontab -e.

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024 1

@jasonacox

The vagaries of Bash has struck. Us plebs in the Southern Hemisphere means that we can't use the test in cron.sh:
if (( "${MONTH}" == "06" )) || (( "${MONTH}" == "07")) || (( "${MONTH}" == "08" )); then

as "08" isn't read properly.
((: 04 == 08: value too great for base (error token is "08")

I had to change it to Jun or Jul or Aug with the MONTH being MONTH=date +%b
if (( "${MONTH}" == "Jun" )) || (( "${MONTH}" == "Jul")) || (( "${MONTH}" == "Aug" )); then
Crazy eh?

Cheers

Stephen

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024 1

@jasonacox Many years ago, I once did a IT contract and found someone had wrote a 25k line shell script to do scheduling. The only comment was the second line where he had his name. It wasn't working and someone told me to fix it. I think I quit at that stage.

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024

I just made sure that the tesla info is recent as I had to enter my password to get the token so it wasn't using any cached version.

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024

Hi @Stephen2615 can you check to see what version of TeslaPy you have? You will need 2.8.0.

import teslapy
print(teslapy.__version__)

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024

Hi @jasonacox TeslaPy is at 2.8.0.

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024

Thanks! I found the bug. I'll submit the fix.

I was testing on a dashboard rig which must have had an older cached version of TeslaPy. At some point they dropped support for the .get_site_info() function in favor of the .api() function. Pull the latest and let me know if this fixes it for you too.

wget https://raw.githubusercontent.com/jasonacox/pypowerwall/main/tools/set-reserve.py

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024

Hi @jasonacox, Thanks for your help. I used the set-reserve.py you offered and it didn't fix it. The error is the same.

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024

Try running this script (or run interactively with python3):

import teslapy

# Set variables
TAUTH="set-reserve.auth"
email="[email protected]" # replace with your real email you use with Tesla

retry = teslapy.Retry(total=2, status_forcelist=(500, 502, 503, 504), backoff_factor=10)
tesla = teslapy.Tesla(email, retry=retry, cache_file=TAUTH)

# Get site info
battery=tesla.battery_list()[0]
config = battery.api("SITE_CONFIG")["response"]
site = battery.api("SITE_SUMMARY")["response"]
data = {**config, **site}
level = data["backup_reserve_percent"]
pw_count = data["battery_count"]

print(f"READ: Current Battery Reserve Setting: {level}% for {pw_count} Powerwalls")

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024

Hi @jasonacox

It works.

READ: Current Battery Reserve Setting: 25% for 1 Powerwalls

Cheers

Stephen

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024

That's great! That's basically what is in set-reserve.py so I suspect you have a cached older version. In any case, you can use that one. :)

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024

Thanks @Stephen2615 ! 🙏

from pypowerwall.

Stephen2615 avatar Stephen2615 commented on July 18, 2024

@jasonacox.

A bit off topic but how does the cron.sh work? When I use cron, it runs at specific times but yours doesn't give an example. Eg, every 10 minutes of every hour? I haven't used it as we get a lot of fog here in Winter and "clouds" doesn't really give an indication of fog. I was trying to figure out some way of saying yes, we have fog. The Tesla algorithm won't charge the battery when it is foggy here as it doesn't recognise fog equals clouds. I don't want to force the battery to charge if it doesn't need it but its almost mandatory with fog.

Cheers

Stephen

from pypowerwall.

jasonacox avatar jasonacox commented on July 18, 2024

Great fix @Stephen2615 ! I actually like your approach better in general. It is more readable. I don't know why I went with numerics.

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.