Comments (15)
Updated to 0.8.1 and everything is working nicely. Thanks to all.
from pypowerwall.
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.
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.
@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.
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.
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.
Hi @jasonacox TeslaPy is at 2.8.0.
from pypowerwall.
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.
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.
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.
Hi @jasonacox
It works.
READ: Current Battery Reserve Setting: 25% for 1 Powerwalls
Cheers
Stephen
from pypowerwall.
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.
Thanks @Stephen2615 ! 🙏
from pypowerwall.
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.
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)
- set-reserve ERROR gives Missing access token parameter. Auth token expired? HOT 3
- Ran upgrade.sh but it does not pull all new files HOT 2
- New PW firmware seems to break vitals - 23.44.0 HOT 17
- INFO: Alerts displayed when one Powerwall is defective HOT 1
- Critical Bug - 404 HTTP Status Code Handling
- Missing ? energy_sites/grid_import_export HOT 3
- Powerwall not reachable ever since January 26th HOT 1
- Set Reserve via Proxy API HOT 8
- pyPowerwall [0.8.3] Proxy Server [t53] testing HOT 28
- Change the path .auth & .site files are saved to HOT 2
- Slow charge speed from grid? HOT 2
- Cannot set reserve lower than 5% HOT 14
- Changing Battery Configuration State Via GET HOT 2
- PyPowerwall stopped connecting HOT 9
- Extra connection created? HOT 4
- Issues with POST HOT 3
- Possible FleetAPI bug in __main__.py HOT 1
- Powerwall 3 Local Access via TEDAPI HOT 30
- FleetAPI Setup Bug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypowerwall.