Introducing the Powerwall Manager SmartApp for SmartThings and Hubitat Hubs
Update 1-Jan-2023: This app is still fully operational on the Hubitat Hub platform, however due to recent changes on the SmartThings platform to eliminate the hosted Groovy application capability, this app is no longer supported on the SmartThings hub.
After 6 months of operation, I’ve been quite pleased with the new Tesla Powerwall II. The Powerwall coupled with our home solar has almost completely squashed our electric utility peak demand charges and has eliminated all net electric usage during peak hours.
While the Tesla mobile app’s Advanced Time Control settings do a decent job working with my electric utility’s rate structure, I wanted the ability to further monitor and automate the Powerwall’s operation.
I wrote this SmartThings smart app so that I could not only monitor and control the Powerwall through the SmartThings Hub, but could also fully leverage SmartThings to send mobile notifications and to automatically command smart devices and Powerwall functions based on the current status of the Powerwall and other smart devices.
In addition to basic SmartThings integration hooks, the app provides a simple menu for receiving mobile push notifications or text messages based on Powerwall state changes and battery level conditions. The app supports custom schedules for operational mode changes (Backup-Only/Self Powered/Advanced Time Controls) and battery reserve level % settings. The app also provides the option to select devices that should automatically be turned off in the event that a grid/power outage is detected by the Powerwall.
A description of application features and installation instructions are included below.
If you have comments, issues, questions, enhancement suggestions, or wish to provide general feedback, please comment below or use the contact menu selection above.
Powerwall Manager SmartApp Features
- Monitor and View Status:
- Battery % level & Reserve % Level
- Current power readings for Solar, Grid, Home, & Powerwall
- Operational Mode Status (Backup-Only/Self Powered/Advanced Time Controls)
- Optimization Strategy (Cost-Saving/Balanced)
- Stormwatch Standby Enabled Status
- Grid/Power Outage Status
- Control:
- Set Reserve % Level
- Set Operational Mode Status (Backup-Only/Self Powered/Advanced Time Controls)
- Set Optimization Strategy (Cost-Saving/Balanced)
- Off-Grid Status (Hubitat only)
- Define Schedules and Automations:
- Schedule the following Powerwall configuration changes to occur at specified times and days of the week:
- Operational Mode (Backup-Only/Self Powered/Advanced Time Controls)
- Reserve %
- Stormwatch Standby enable/disable
- Off-Grid Status (Hubitat only)
- Select smart devices to automatically turn off in the event of a grid outage
- Schedule the following Powerwall configuration changes to occur at specified times and days of the week:
- Customize Built-in Notification Options (receive push and/or text notifications) when:
- Powerwall battery level approaches the reserve level or a user-defined notification % value
- Modes change
- Grid/Power outage status changes
- Firmware version changes
- Integrates Powerwall status and controls with the SmartThings Hub and ecosystem
- Supports additional sophisticated monitoring rules and automated control of Powerwall functions through SmartThings/Hubitat scripting and rule engines such as WebCoRE and Rule Machine.
Mobile SmartThings app UI Images
Installation Instructions
The instructions below assume you have basic familiarity with Hubitat or SmartThings Groovy IDE custom code installation techniques.
- Powerwall Manager Smart App Code (required)
- Powerwall Manager Device Handler Code (required)
Instructions for installing on SmartThings
Install the Powerwall Manager Smart App
- Open the Powerwall Manager Smart App code and select edit->select all” followed by “edit -> copy”.
- Navigate to the SmartThings IDE “My Smart Apps” tab
- Select “+ New Smart App” (upper right)
- Select “From Code”
- Paste in the Powerwall Manager Smart App code and select “Create” at the bottom
- Select “the Publish” button and select “For Me”
Installing the Powerwall Device Handler
- Open the Powerwall Manager Device Handler Code, and select “edit->select all” followed by “edit -> copy”.
- Navigate to the SmartThings IDE “My Device Handlers” tab
- Select “+Create New Device Handler” (upper right)
- On the “Create New Device Handler” page, select the tab “From Code”.
- Paste in the code for the Powerwall Manager Dashboard Device Handler code and click the “Create” button at the bottom
- Click the “Publish” button and select “For Me”.
Activate the Powerwall Manager Smart App from the SmartThings Mobile App
- From the SmartThings mobile app on your phone or tablet device, select “+” -> “Add Routine” -> “Discover”
- Scroll to the bottom and select “My Apps”
- Select “Tesla Powerwall Manager” from the list
- Scroll through each of the setting options and menus and select “Save” when done. You can always go back and add/change your settings.
- The Powerwall Manager is now operational and its status can be viewed from the Tesla Powerwall Device on the SmartThings Clmobile app “Things” tab.
Instructions for installing on Hubitat
The Powerwall Manager can be installed directly from Hubitat Package Manager (keyword Tesla or Powerwall), or may be installed manually by copying the code from the repository as outlined below:
Install the Powerwall Manager App
- Open the Powerwall Manager App code and select edit->select all” followed by “edit -> copy”.
- Navigate to your Hubitat “<> Apps Code” tab
- Select “+ New App” (upper right)
- Paste in the Powerwall Manager Smart App code and select “Save” at the upper right
Installing the Powerwall Device Driver
- Open the Powerwall Manager Driver Code, and select “edit->select all” followed by “edit -> copy”.
- Navigate to your Hubitat “<> Drivers Code” tab
- Select “+ New Driver” (upper right)
- Paste in the code for the Powerwall Manager Dashboard Device Handler code and click the “Save” button at the upper right
Activate the Powerwall Manager App
- Navigate to your Hubitat Apps tab
- Select “+ Add User App” at the upper right
- Select “Tesla Powerwall Manager” from the list
- Scroll through each of the setting options and menus and select “Done” when finished. You can always go back and add/change your settings later by selecting the Tesla Powerwall Manager again on the Hubitat Apps tab.
- The Powerwall Manager is now operational and its status can be viewed on the Current States section of Tesla Powerwall device on the Hubitat Devices Tab
Configuring the App
Once installed, the Powerwall Manager can be configured from the SmartThings mobile UI “SmartApps” tab (or Apps -> Tesla Powerwall Manager on Hubitat). Current configuration options include Powerwall mode and reserve % change schedules, notification preferences for device, battery level, and state changes, as well as actions that should be performed during a grid/power outage.
Credentials are currently required to be entered into the app’s preferences to allow interfacing with the Tesla servers. Due to a current limitation with SmartThings support of self-signed certificates, this SmartThings app cannot interface directly with the local Powerwall gateway’s interface at this time.
Changes to Powerwall settings made from this app may not immediately take effect at the time they are commanded. While settings from this app are reflected almost immediately in the Powerwall server settings (and the Tesla native app) after being sent, they are subject to the same Powerwall processing delays as changes made from the Tesla native app.
Warnings and Disclaimer
****** WARNING ****** USE AT YOUR OWN RISK!
This software was developed for my personal use and is provided here in the hopes that it will be useful to others, however, it is beta software and use of this software may result in unforeseen side effects to your equipment and related accounts.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Tesla referral code: ERIC78022
Hi!
Does this system delete the Utility Rate plan? I set the rate plan up on the Tesla app and the following morning it appears to have been deleted and is asking me to set it up again. I was just wondering if changing the backup setting with the Hubitat would affect it as I was not aware of it being an issue prior to using the Hubitat to control the Backup reserves.
I look forward to your reply.
Regards
Bob.
It’s certainly possible – although I haven’t been able to recreate the issue on my end. Several years ago, the app was required to re-issue the Time Based Control schedule when commanding a TBC Cost-Saving/Balanced strategy (back when that was an option) so I can imagine a bug where this could happen.
If you’re able to recreate this, or anyone else is seeing the issue, please send me the steps and I’ll definitely look into it.
Hi!
I changed the time base Strategy from ‘Cost Saving’ to ‘No Action’ and now the Utility Rate Plan is staying as set in the Tesla app. Thank you for the pointer.
I have attached a picture of the schedules to show the settings. All works fine like this.
Ah – that makes sense. I’ll remove the ‘Strategy’ option from scheduling since it’s no longer supported by Tesla.
I’m getting a new error today.
com.hubitat.app.exception.limitexceededexception:%20App%20101%0Agenerates%20excessive%20hub%20load%20on%20line%201699%20(method%20processSiteLiveStatusResponse)
I haven’t seen this one before (limitexceededexception). Are you consistently seeing this? A couple of things to look at that may help diagnose:
Thank you for the update.
Much appreciated.
Powerwall Manager V0.3.81 is now available with a workaround for the recent Tesla API auth change (for now at least). This update also adds commands to enable/disable grid charging and to set energy export mode (“solar only” or “everything”), The energy export mode control is untested since I don’t currently have export mode control for my Powerwall, so let me know if there are issues.
I’ll look at some of the other enhancement requests out there and also look at the new Fleet API to see what options there might be to keep this app operational going forward
Is there a way to incorporate “grid charging” into scheduling section of the app? I.e to be able to trigger grid charging at night on ToU plan and disable during the day?
Not currently. I’ll put that on the to do list. In the meantime, you can use Rule Machine (or similar separate app) to run a custom actuator action on the this app’s Tesla Powerwall device. You can create a single “Days of Week Schedule” trigger event to run each enable/disable command. If you haven’t used it before, Rule Machine unfortunately doesn’t have the most intuitive UI out there, but once you get the hang of it, it only takes a few steps to add a schedule.
From what i read when Tesla made the change, i thought it was non-fixable and i would have to go back on the Powerwall crappy algorithm. I didn’t expect such a quick fix, thanks for your effort. I sent you a coffee (or beer).
Thanks! I will have that beer tonight. I was expecting the same when I first dug into the issue. This update from Tesla appeared to be in support of handling different agents/apps in preparation for the bigger changes ahead.
Hi,
Thanks for all your work on this. I sent a minor feature request by email (along with the code) to pull out the current battery capacity in to a device attribute, to assist with monitoring battery degradation. I’ve been making the change myself the last couple of releases but it would be great if you’d consider incorporating it in to releases. The changes are trivial and stand-alone so should have no impact on any other part of the app.
Kind regards,
Dennis
Hi Dennis. Thank you for the code updates – that definitely makes it easy. I’ll get this added in the next release. Hopefully within a week or so.
Just wanted to thank you for the update to allow changing export mode. Seems to work well from the limited testing I’ve done! This will greatly help with automating my demand response program.
I will try the grid charging function also, but not sure it’ll work for me anyway as it was always locked out for me anyway.
I heard a rumor that Tesla was going to be shutting down the API used to control the Powerwalls. My requests to change reserve setting via this app started throwing http 401 errors recently. I think they may have killed access and I haven’t heard of a workaround yet.
I believe Tesla will still have the API but you will need to register for an account and point the API calls to a different endpoint and developers of other solutions such as teslapy may need to update their libraries.
Also, Tesla and Smartthings announced a collaboration which should allow control much easier in Smartthings than the complicated process I had to come up with when Darwin moved on to supporting Hubitat only (no offense intended, very much appreciated the efforts while it lasted!).
This is Samsung’s announcement: https://news.samsung.com/global/samsung-announces-collaboration-with-tesla-at-ces-2024-for-smartthings-energy
My convoluted process is here and doesn’t allow control of reserve percent but does get battery level and grid/solar/battery input/output at 5 minutes intervals into Smartthings : https://community.smartthings.com/t/tesla-powerwall-ii-project-2023/265663
I have been thinking about spinning up a HomeAssistant instance at home to schedule some mode/reserve changes but if the Samsung/Tesla integration comes soon enough I wouldn’t have to do it just for that (though probably still will in the future):
https://community.home-assistant.io/t/getting-serious-on-power-automation-with-tesla-powerwall/449781/9
Thanks for the info. The issue for integrations like this is that Tesla doesn’t seem to be allowing access to the new Fleet API without a complicated setup process that requires you have a company, a web site, and your own OAuth setup. For controlling my cars I’ve moved to Tessie (paid subscription) who have their own API that will relay to Tesla’s API. I checked with them yesterday and they will be adding energy products ‘as soon as Tesla gives them access’. So even businesses with access to the new API don’t have access to the energy products yet.
Hi!
Please advise if the app will work on Hubitat C4 ?
Could you give us the capability of reading the total pack energy? It’d be nice to be able to track this overtime! Thank you
anyone know how to create an event in hubitat such as “Weather” when weather is predicted to be rainy the next day , switch the powerwall from using up to 20% for self powered to 100% backup only?
And then an event when the weather is either sunny/cloudy or any event that will charge the powerwall and set the powerwall to self powered 20%?
Finally got this working in Hubitat. Where is the PowerFlow Tile? I see a PW tile but it doesnt seem produce anything. all the other tile attributes work.
Hi Darwin, this app is wonderful!
Do you know if there is a way to query the Virtual Power Plant Status? In case you are not familiar, some states/power companies have programs to pull power from your Powerwall when there is high demand. When this happens, I usually shut down the high power consumers (AC/Heat Pump, Dehu, Etc.) to optimize the power draw. After the event is over, or the powerwall reaches the lower limit / threshold, I turn the comfort devices back on.
It would be great to simply see if there is an event scheduled, when the event starts, and when it stops. From there I can create the rules to do everything else.
Thanks in advance any consideration.
-Walt
Powerwall Manager V0.3.80 is now available with updates to correct for the recent Tesla API change.
Thanks for fixing the errors! Do you think there is something you could do to add in control for the export mode? I posted something about this below, so not sure you saw this.
I’ll take a look! I’ve added a Github issue for this. I’m not seeing an Energy Export option on my app, so it may be difficult for me to test this, but I’ll look for an existing API. I also started looking at the option to allow/disallow grid charging, but I may not be able to get to these until after the holidays.
Thanks, I’ve heard some people don’t get the export feature or the grid charging for some reason, and perhaps it need to be recommissioned to see it. Let me know if I can help in any way. It would be great to enable or disable the export feature, since I use it with a demand response program and sometimes forget to switch it on when needed.
A way to control grid charging would be much appreciated.
Something happened to the Tesla API and now Im getting a recurring warning in my logs, “Powerwall response error after 2 attempts: 410 Gone.” This started to happen 4 days ago. There is a thread with the same error on HA.
I am seeing a similar error, but error 404 instead of 410.
“Powerwall response error after 2 attempts: 404 Not Found.”
I am getting it every 10 minutes which is my Tesla Server Polling Interval. The Powerwall device still seems to be updating on the Hubitat and I can still control it.
I think the HA fix is documented here, but I don’t have any idea how to extract the changes in that python code to make the Hubitat groovy work: https://github.com/zabuldon/teslajsonpy/commit/c501dcc8e1c633fc64908116e46c1e9ac2c31efc
Sorry about that – I’ve been away on travel and haven’t been able to look at the Tesla API changes in detail. I should be able to get a fix out for this in a few days or so. Based on what I’m seeing, PW commands to the Tesla server and reading values from the local gateway should still work, so hopefully everyone is at least limping along for now. In the meantime, If you set the log level in the app (General Preferences) to “Error”, it should mute the warning logging.
Is it possible to update the code to be able to control the export setting from either Solar, or Everything? This has an iOS app control, and I believe is also in the API? Likewise, there is also an option for grid charging on and off.
I’m using this on a Hubitat C7 hubmesshed to a C8. Is there any chance of adding an option to turn of a/c in the event of a grid outage? this is a great thing to maximize the reserve of my powerwall, and it would be great to have this be an automatic acion available through the powerwall manager
This can be done pretty easily already. One way would be to create a rule in Rule Machine with:
You might want to click the “and stays” switch to have it only trigger when it stays off grid for a few minutes.
I’m using this app/driver on my Hubitat C7 and it has been working (nearly) flawlessly. However I was expecting that turning on descriptive text logging on a child device would log the values each time they change. I have ‘descriptive text logging’ enabled for the child devices but nothing is written to the Hubitat logs. I have the log level set to ‘Info’ in the app, and I don’t see anything else that seems to control the logging function. Am I missing something, or is the device not supposed to log value updates when they change?
I am not well versed in how parent/child devices work, but I just tried adding “log.info(desc)” just after “dev.sendEvent(evt)” in the “sendEventIfChanged” section of the device driver and that seems to now have it logging the values. It isn’t logging the values under each child device, but rather under the parent device, which is fine for my purposes, but doesn’t make sense with the logging on/off toggle being on the child devices.
It seems like that should be wrapped inside of a condition like (pseudo code) “if ( child device logging is on ) { log.info(desc) }” and that the logging should be done under each child device. Or the logging could be done under the parent, but the logging on/off toggle should be moved from the child devices to the parent device.
Hi Alan. The child devices use the standard Hubitat library Generic Component drivers, so I unfortunately am unable to view the code for these and have no control over how they function. It is interesting that the values aren’t being displayed in the logs when descriptive text logging is turned on though. I’ll investigate to see if there is something I can change on my end to make that work. The Powerwall Manager main app will log all values when set to verbose logging, but that also includes quite a bit of other information that you’re probably not interested in. To log the values, in addition to the code change that you made, you could also create a simple rule in Rule Machine that triggers off a changed value from all the child devices with event logging and display current values turned on.
Fantastic app, thanks so much , not sure why Tesla didn’t include some of these features.
This app is so good now I have switched back from Rule Machine. It may not meet everyone’s needs, but for me, right now, it is a perfect fit.
I’m now running the 0.3.71 version.
It ran without issue last night charging my Powerwall and i can see the token has automatically refreshed several times.
So far it is looking good to me.
Thanks for the feedback. 0.3.71 appears to be stable for me as well so far.
I just loaded the new 0.3.70 version (Thanks)
Prior to upgrading I had loaded an access and refresh token from the IOS Authla app and the refresh token was showing as “Not Validated”.
After upgrading i rebooted the hubitat and both tokens are now showing as validated!
I will run this tonight and will update.
I too would love to know the answer to this question. I have gone from loving this 100% to abandoning this 🙁
I’m running the latest app version 0.3.61.20220315
All 3rd party token refresh apps i try now have the access token limited to 7 hours (previously it was 45days).
When i try installing a refresh token instead of an access token it shows as “Not validated”.
Is there a process to follow to load a refresh token or is there a problem?
I haven’t had any issues at all..look for an app named tesla tokens
There was a change to how refresh tokens get used as of a few weeks ago; there will need to be an updated version to continue refreshing tokens.
Powerwall Manager V0.3.70 is now available as a quick patch update until we can get a little more information as to what has changed. This update should work around the issue for now and keep the access token refreshed as needed. This has very limited testing, so any additional feedback would be greatly appreciated.
The two changes that I found:
The new tokens have a much shorter lifetime; I haven’t seen any data on the longevity of the refresh token itself, but as long as you’re continuing to refresh it, I would assume it keeps getting extended.
Thanks. Hadn’t seen this – and bummer. It was only through that intermediate jwt-bearer grant type step that we were able to get the 45 day lifetimes instead of the 8 hour. The updated code here now still tries the intermediate step in case it starts working again, but if it fails, will fall back to using the access token as-is – and hopefully deal with the shorter lifetime appropriately.
I just noticed I had an integer overflow issue with 0.3.70 patch which could cause the access token to not refresh appropriately before it expires in the next 8 hours. If you applied the 0.3.70 update (and had also gone into the Tesla server menu), you’ll need to update again to 0.3.71 and go into the Tesla server menu again and hit ‘done’ to re-schedule the token refresh.
After months of every working fine , my token isn’t verifying. I’ve upgraded to the latest version of the app and handler and tried both Auth for Tesla and Authla apps for new tokens but still not working any pointers would be appreciated (downloaded the windows auth mentioned below but no idea how to run it)?
Sorted now it was a problem between the access and refresh tokens
Hi, I’m using 02/2022 on ST with 3 PWs.
I’m trying to set up simple automation to announce Grid status on my Alexa speakers.
The simplest approach would be if the Alexa device imported from ST was type contact sensor and was the grid status.
Else need grid status linked to some value that ST automation can access so can create a linked virtual contact sensor that can trigger an Alexa.routine to announce grid status
Love this app and really appreciate all the hard work that you and others have put into it. Great job!
Thanks! Version 0.3.6.1 is now available and adds the contact sensor capability to the Powerwall device type to indicate grid status (closed=on-grid/open=off-grid). This should allow direct association for Alexa grid status related routines.
When my PW charges from solar during the day some of the time the power is split between the PW and home when in fact I prefer to completely charge up the PW before sending power to home or grid. Is there any setting to force this behavior to always charge the PW from solar to it’s reserve energy level first? I’m thinking it may be better for battery longevity to more slowly charge the PW and that may be the reason for it operating in this manner? I’m just thinking of days with little solar generation where my preference is to make sure the PW is fully charged as much as possible.
I was actually able to get it to sorta work for some reason with no changes from my end but it would only execute schedule number 1 and not execute schedule number 2. Schedule number 1 turned off the grid at 6am but schedule 2 did not execute at 9am to turn the grid back on so I had to do that through the Devices Commands. I then did a 15 minute test leaving the grid status unchanged and setting mode to self-powered at 20% reserve. Again schedule 1 executed but not schedule 2 to change back to backup-only at 100% reserve. Below is a snapshot of my 4 scheduled events which shows my test in schedule 1 and 2. For the Tesla App I had Tim-Based control selected with no custom rates and 100% backup reserve. After executing schedule 1 the Tesla App changed to show Self-Powered with 20% backup reserve. Any ideas what else I can try? Thank you.
Schedule 1: Winter morning off gridSelect Powerwall actions to apply:Mode: Self-Powered
Reserve: 20%
Stormwatch: Enable
Select when to perform these actions:01:00 PM [Monday, Tuesday, Wednesday, Thursday, Friday]
Months: [January, February, December]
Schedule 2: Winter morning on gridSelect Powerwall actions to apply:Mode: Backup-Only
Reserve: 100%
Stormwatch: Enable
Select when to perform these actions:01:15 PM [Monday, Tuesday, Wednesday, Thursday, Friday]
Months: [January, November, December]
Schedule 3: Winter afternoon off gridSelect Powerwall actions to apply:Mode: Self-Powered
Reserve: 20%
Stormwatch: Enable
Select when to perform these actions:06:00 PM [Monday, Tuesday, Wednesday, Thursday, Friday]
Months: [January, February, March, April, May, June, July, August, September, October, November, December]
Schedule 4: Winter afternoon on gridSelect Powerwall actions to apply:Mode: Backup-Only
Reserve: 100%
Stormwatch: Enable
Select when to perform these actions:09:00 PM [Monday, Tuesday, Wednesday, Thursday, Friday]
Months: [January, February, March, April, May, June, July, August, September, October, November, December]
Ah – looks like your schedule 2 does not include the month of February. Months are optional, but once you have at least one month selected for a particular schedule, the schedule will not execute for non-selected months.
Yes thanks Darwin I think that’s it. It seems the other 3 schedules work fine.
This has happened to me before as well – and I wrote the thing. I’ll update the UI to have the app show the next date and time the schedule will execute. Maybe that will help make it a little more obvious when the schedule entered is not as intended.
I’ve installed first on SmartThings and then on Hubitat with a hub when I couldn’t get SmartThings to work. The install and configurations went fine but no changes were made to my Powerwalls at the designated times. I setup two self-powered periods with 4 scheduled events. I wasn’t sure how to setup the Tesla app so I just left it in self-powered mode with 100% reserve energy but I tried several combinations but nothing seems to cause the trigger into the self-powered mode. I turned on debugging and what follows are some trace lines if you can see anything out of the ordinary with a quick glance at my activity. I am very excited about this app and thank you very much for your work in making it available with excellent instructions for both automation implementations.
app:32022-02-09 12:48:17.001 am debugprocessing server site live status response
app:32022-02-09 12:48:16.981 am debugprocessing server site data response
app:32022-02-09 12:48:07.734 am debugprocessing server powerwall response
app:32022-02-09 12:48:06.082 am debugScheduling token refresh for Fri Mar 11 00:48:06 EST 2022.
app:32022-02-09 12:47:10.595 am debugInput Access Token Valid: true
app:32022-02-09 12:47:10.065 am debugbattery found: STE20220130-00030 site_name: My Home energy_site_id: 283189290108
app:32022-02-09 12:47:09.528 am debugInput Access Token Valid: true
app:32022-02-09 12:47:08.469 am debugToken expires on Sat Mar 26 01:47:08 EDT 2022.
app:32022-02-09 12:47:08.400 am debugRefresh Access Token Request Status Code: 200
app:32022-02-09 12:47:07.491 am debugGetting updated access token and expiry
app:32022-02-09 12:47:07.490 am debugSuccessfully updated refresh token and bearer token for access token
app:32022-02-09 12:47:07.467 am debugRefresh Bearer Token Request Status Code: 200
app:32022-02-09 12:44:23.569 am debugMode setting: Backup-Only, Reserve: 100, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go On Grid
app:32022-02-09 12:44:23.564 am debugMode setting: Backup-Only, Reserve: 100, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go On Grid
app:32022-02-09 12:44:23.559 am debugMode setting: Self-Powered, Reserve: 20, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go Off Grid
app:32022-02-09 12:44:23.554 am debugMode setting: Self-Powered, Reserve: 20, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go Off Grid
app:32022-02-09 12:44:23.550 am debugMode setting: Backup-Only, Reserve: 100, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go On Grid
app:32022-02-09 12:44:23.545 am debugMode setting: Backup-Only, Reserve: 100, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go On Grid
app:32022-02-09 12:44:23.537 am debugMode setting: Self-Powered, Reserve: 20, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go Off Grid
app:32022-02-09 12:44:23.505 am debugMode setting: Self-Powered, Reserve: 20, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go Off Grid
app:32022-02-09 12:44:23.475 am debugScheduling index: 4 num: 4 for time 2022-02-09T21:00:00.000-0500
app:32022-02-09 12:44:23.472 am debugMode setting: Backup-Only, Reserve: 100, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go On Grid
app:32022-02-09 12:44:23.451 am debugScheduling index: 3 num: 3 for time 2022-02-09T18:00:00.000-0500
app:32022-02-09 12:44:23.448 am debugMode setting: Self-Powered, Reserve: 20, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go Off Grid
app:32022-02-09 12:44:23.426 am debugScheduling index: 2 num: 2 for time 2022-02-09T09:00:00.000-0500
app:32022-02-09 12:44:23.424 am debugMode setting: Backup-Only, Reserve: 100, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go On Grid
app:32022-02-09 12:44:23.346 am debugScheduling index: 1 num: 1 for time 2022-02-09T06:00:00.000-0500
app:32022-02-09 12:44:23.340 am debugMode setting: Self-Powered, Reserve: 20, Stormwatch: Enable Stormwatch, Strategy: null, devicesToControl: null, Grid Status: Go Off Grid
app:32022-02-09 12:44:16.911 am debugLocal gateway connection verified
app:32022-02-09 12:44:16.769 am debugGateway response status code: 200
app:32022-02-09 12:44:15.947 am debugConnecting to local gateway…
app:32022-02-09 12:44:15.941 am debugbattery found: STE20220130-00030 site_name: My Home energy_site_id: 283189290108
app:32022-02-09 12:44:15.348 am debugInput Access Token Valid: true
app:32022-02-09 12:41:16.512 am debugprocessing gateway SOE response
app:32022-02-09 12:41:16.505 am debugprocessing gateway grid status response
app:32022-02-09 12:41:16.498 am debugprocessing gateway sitename response
app:32022-02-09 12:41:13.425 am debugprocessing gateway meter aggregate response
app:32022-02-09 12:41:11.144 am debugrequesting data from gateway
app:32022-02-09 12:41:11.139 am debugProcessing processGatewayMain
app:32022-02-09 12:38:17.166 am debugprocessing server site live status response
app:32022-02-09 12:38:16.815 am debugprocessing server site data response
app:32022-02-09 12:38:08.104 am debugprocessing server powerwall response
app:32022-02-09 12:31:16.311 am debugprocessing gateway SOE response
app:32022-02-09 12:31:16.307 am debugprocessing gateway sitename response
app:32022-02-09 12:31:16.304 am debugprocessing gateway grid status response
app:32022-02-09 12:31:13.341 am debugprocessing gateway meter aggregate response
app:32022-02-09 12:31:11.048 am debugrequesting data from gateway
app:32022-02-09 12:31:11.043 am debugProcessing processGatewayMain
<..>
app:32022-02-09 12:08:06.117 am debugScheduling token refresh for Fri Mar 11 00:08:06 EST 2022.
app:32022-02-09 12:05:38.986 am debugInput Access Token Valid: true
app:32022-02-09 12:05:38.455 am debugbattery found: STE20220130-00030 site_name: My Home energy_site_id: 283189290108
app:32022-02-09 12:05:37.904 am debugInput Access Token Valid: true
app:32022-02-09 12:05:37.151 am debugToken expires on Sat Mar 26 01:05:37 EDT 2022.
app:32022-02-09 12:05:37.102 am debugRefresh Access Token Request Status Code: 200
app:32022-02-09 12:05:36.324 am debugGetting updated access token and expiry
app:32022-02-09 12:05:36.322 am debugSuccessfully updated refresh token and bearer token for access token
app:32022-02-09 12:05:36.293 am debugRefresh Bearer Token Request Status Code: 200
app:32022-02-09 12:05:03.262 am debugLocal gateway connection verified
app:32022-02-09 12:05:03.128 am debugGateway response status code: 200
app:32022-02-09 12:05:02.374 am debugConnecting to local gateway…
app:32022-02-09 12:05:02.151 am debugGateway ping results: PingData(rttAvg: 60.557, rttMin: 7.79, rttMax: 98.398, packetsTransmitted: 3, packetsReceived: 3, packetLoss: 0)
app:32022-02-09 12:04:37.851 am debugLocal gateway connection verified
app:32022-02-09 12:04:37.716 am debugGateway response status code: 200
app:32022-02-09 12:04:36.975 am debugConnecting to local gateway…
app:32022-02-09 12:04:36.971 am debugbattery found: STE20220130-00030 site_name: My Home energy_site_id: 283189290108
app:32022-02-09 12:04:36.418 am debugInput Access Token Valid: true
app:32022-02-09 12:01:24.854 am debugbattery found: STE20220130-00030 site_name: My Home energy_site_id: 283189290108
Hi Ed – Your basic set-up looks good to me at first glance so far based on the logs. It looks like your 4 scheduled events are for 6am, 9am, 6pm, and 9pm EST. Can you capture logs that cover the time your events are scheduled to fire?
Powerwall Manager v0.3.60 is now available if for no other reason than to have a release date of 2/2/22. This update requires both app and device driver to be updated, and includes the following changes:
@psmedley, the SmartThings Automation capability allows for the creation of routines that will only run once at a given time over the next 24 hours and then will be deleted (by de-selecting all days in the routine), so although maybe not ideal, items 3 & 4 provide at least one option to perform one time schedules using SmartThings.
I just noticed that load/solar power only appears to update at the cloud polling interval, even though these values are available via the local interface. Is there a reason these aren’t pulled from the local interface?
I had a bug with the delta check update logic, and power values weren’t always being sent for both gateway and server updates. V0.3.51 is out now with a fix for this. Let me know if this update doesn’t fix this for you.
All power updates only change if the delta from the last recorded value is at least 100W to minimize hub and dashboard performance ripple effects of frequent data changes. It’s always been this way, but this bug would often make them update less often. I can make this 100W delta value a preference option if anyone is interested.
Update fixes it — thanks! I was also wondering if there are any plans to expose whether Storm Watch is currently active? That’s not available from the gateway that I’m aware of, but it is from the Cloud API.
I’d be happy to add it. Do you know what the cloud API looks like for an active Storm Watch event? I’ve had maybe one Storm Watch event in the last 3 years, so I haven’t had many opportunities to catch it.
The energy site API
/live_status
has astorm_mode_active
boolean. I’m in Storm Watch now; I can grab a full dump of live_status if you need.My live_status shows:
This is the right answer. I use Rule Machine to adjust the reserve based on the current/next day’s weather.
Is this with hubitat or smartthings?
Hi. This is with Hubitat.
I still haven’t had a chance to try adding my 2nd powerwall yet, but another feature idea…
it would be nice to be able to set a one time schedule – perhaps schedule for a given date.
Example is that normally, I set reserver to 25% at 1am when the offpeak rate starts. I know that when this tariff ends at 6am, 25% will usually get me through until the solar cranks up. Tomorrow, I know it’s going to be warm, humid and cloudy – and I’ll get bugger all solar – so on a one off basis, would like to charge as much as possible during the off peak tariff.
You could use Hubitat Rule Machine to run at a certain time, then set the action like this:
“Set Variable, Mode or File, Custom Action “
Choose “Run Custom Action” from the drop down.
Set “Select capability of action device” to “Switch” and choose the Tesla Powerwall.
Then select the customer command from the drop down you want to set.
I personally just trigger “setBackupOnlyMode” with no parameter to charge as much as possible, then setup a separate rule to change it back to “setSelfPoweredMode” when done.
Works perfectly.
Hi,
Any chance you could add this to Hubitat Package Manager? This would make installing and updating far easier.
https://github.com/dcmeglio/hubitat-packagemanager
Appreciate the awesome work!
Thanks,
Shane.
Hi Shane,
The Powerwall Manager is now available in Hubitat Package Manager. Thank you for the suggestion. I probably should have done this a while ago.
Thanks this is awesome!
Just matched it and it installed perfectly. So easy!
Thanks – I still had the branch selected, not master 🙁 I’ll setup the second PW2 when I get a change and let you know
Powerwall Manager version v0.3.40 is now available. This adds the option to choose between multiple Powerwall sites when available. I’m not able to fully test this functionality since I only have one site, so please let me know of any issues. This also includes the fix for on-grid actions. Thank you Chinto for the find/fix. This is an app only update from v0.3.30 – no device handler/driver updates required.
I’ve updated to this build now, assuming it’s different to the one you sent me previously. I’ll let you know how it goes 🙂
As I mentioned, it would be nice to allowed scheduled rules/changes to apply to one or both Powerwalls.
I certainly agree. Right now, the only option for control of two different sites is to install two unique instances of the Powerwall Manager – one for each Powerwall site. It will take an sizeable infrastructure change to have the same instance update both sites, but admittedly this would be a better object oriented design. I’ll certainly keep this in mind as the architecture goal as I make updates.
After a bit more testing, I made a small v0.3.41 update not long after posting the v0.3.40 change. This fixes what could be a refresh token reliability issue in a few cases and I would recommend updating to this latest version, if you’re not already on it.
Hi Darwin – if it’s possible to run two unique instances of the PWM, that would work for me.
re: 0.3.41 – the latest I see in https://github.com/DarwinsDen/SmartThingsPublic/commit/81e23061ccafdd7a70ae01c71e9d24db4b11aa72 is still marked 0.3.40?
Two unique instances of the app should work, but let me know if you run into issues.
Try this link for the current/latest app: https://github.com/DarwinsDen/SmartThingsPublic/blob/master/smartapps/darwinsden/tesla-powerwall-manager.src/tesla-powerwall-manager.groovy
Hi All.. On smartthings… you may have notice that the app DOES notify when going Off Grid, but NOT when returning to On Grid.
Look at line 1874
child = getPwDevice()
change it to def child = getPwDevice()
Save and publish for me
Your set
PS I found this bug since v0.3.0e.20210325
Thank you. This fix will be in the next update.
Hi All… as of three PW2 versions back, TESLA eliminated the BACKUP ONLY option and replaced it with Self Powered 100% slide bar… IF you place BACKUP ONLY, the PW2 will automatically switch to SP 100%
Does the new updated version still support the old app v3 backup mode?
The option to set ‘Backup-Only’ still appears for me with the latest version.
Thanks for confirming
Hi – I have two Powerwalls installed at different sites. Is there a way to specify which Powerwall gateway to use? At the moment, it’s picking the Powerwall which not on Time Based tariffs, not the one that is :/
Hi Paul, I’ll look into adding an option to select between multiple Powerwalls when more than one are present. In the meantime, can you see if changing line 1305 in the latest app from this:
if (product.resource_type == "battery") {
to this:
if (product.resource_type == "battery" && !foundPowerwall) {
lets you work around the issue for now?
This should (hopefully) change the behavior to pick the 1st Powerwall in the list instead of the last in the list, and will tell me if I’m on the right track for implementation, since I don’t have a multi-site system to test with.
Hi there – yes your fix works for me.
My workaround was to change that line to:
if (product.energy_site_id == “1406xxxxxxxx” || !foundPowerwall) {
Where 1406xxxxxxxx is the energy site id of the Powerwall I want to use.
More than happy to do any testing required for multisite.
FWIW, in my app, I have an optional `siteID` setting. If it’s absent and more (or less) than one Powerwall are encountered, I throw an error; otherwise, blank assumes the only Powerwall on the account.
Powerwall Manager Version v0.3.30 is now available. This update includes the option to specify a refresh token instead of an access token, eliminating the need to enter a token every 45 days. The update also includes the ability to command and schedule off-grid operation. Off-grid commanding is only available on the Hubitat platform right now since it currently requires a local control interface. Both app and device handler/driver should be updated for this change. Thank you @x10send for providing these great updates.
As always, thanks for your work on this. I upgraded and added the refresh token. It reports connected without any issues so far.
Hi,
My access token is expiring after one day at the moment. Is there any way this can be changed to use the refresh token?
I’m using the Auth for Tesla app to generate.
Thanks,
Shane.
I used the windows app from Eveque Fou suggested by Hogler. It’s 5 days now and still ok.
Mike
I just used a different iOS app (https://apps.apple.com/us/app/authla/id1546597644) which seems to generate a 45 day access token, previously I was using Auth for Tesla which is only generating 8 hour access tokens for me.
Thanks all. Auth is not the way. Used the Windows app and all good so far.
I noticed that the auth for Tesla app produced weird access codes, and yes expired after 8 hours. The windows app from Eveque Fou still produced correct access codes, and so far so good. Have gone past 8 hours, but not yet past 8 days.
Delighted to hear it’s working for you!
Thanks for the update Darwin. I am testing the new version now. I am not sure if something else is going on or it is related to the new version but my access token in Auth for Tesla is only good for 8 hr (and works) and if I use the refresh token instead, it fails. I can’t remember how this worked before but I thought I just copied the access token from the app and I was good for 45 days. Did I miss something here?
The refresh token from Auth for Tesla will not work with this app, but the Access Token should be good for 45 days after copy/pasting a new one in. Is it the Powerwall Manager app that is notifying you that the token is or will be expiring (issues connecting to the server/notification? token about to expire notification? warning in logs?), or are you receiving an indication that the token is only good for 8 hours some other way? Are you on SmartThings or Hubitat? Thanks.
I believe I’m seeing the same issue as well now. It appears tokens I generated today now expire in 8 days instead of 45. I will see if I can update the app to use refresh tokens instead, and generate the access tokens automatically every 8 hours. If the hub api’s support the calls, it’s a better implementation anyway and should eliminate the need for the 45 day token update – at least for as long as the refresh tokens remain valid. Access tokens I generated several days ago are still valid, so hold on to your old 45 day access tokens for now if you have them.
I was seeing it in the Auth for Tesla app and I also received a message saying it on was no longer connected as well. I am on SmartThings. I did use the access token and connect it after my earlier message and it is still receiving data so perhaps the Auth for Tesla app is just saying it is valid for shorter than it is. Powerwall manager is saying Token last updated 1 day ago now and is connected. Perhaps I triggered the expiration before from Auth for Tesla unintentionally and trusted the validity data in that app.
Thanks for all your work on this.
Hi
I’ve been having trouble with the schedules on my Smartthings v2 hub.
I have setup 3 schedules per day but only the last ever schedule runs – the previous 2 schedules get the ignored. I’ve tried different combinations of tbc and self powered also tried on friends powerwall – again same result.
Anyone else having this type of problem?
Thanks in advance
I found there was a problem with the way SmartThings was handling my multiple schedule implementation (not honoring overwrite: false), although this appears to work fine on Hubitat. Sorry about that. I’ve made an update (v0.3.20) to the app to correct this, although this now puts a SmartThings (only) limit on the max number of schedules (to 12 for now since I had to pick some arbitrary limit).
This update also includes fixes for false off-grid notifications, issues with setting reserve percentage remotely from some apps such as Node-Red, and a fix for an issue tailoring the gateway dashboard iFrame display on Hubitat. There’s also now an option to send a notification if the access token hasn’t been changed for 40 days.
I haven’t yet removed the Backup-Only and Time-Based Control Strategy (Cost Savings/Balance) scheduling options yet despite these no longer being available on the Tesla app, just in case these are still being effectively utilized by someone.
This has very limited testing since I wanted to get this SmartThings schedule fix out there. Please let me know if there are issues.
Thank you so much for fixing the schedules – I can confirm that it is now working with 2 schedules on the Smartthings platform.
Node red – with your previous version I was successfully updating the reserve percentage by altering the value of a Smartthing’s ‘Virtualdimmer’ with Node Red and then using Webcore to mirror that change to your setBackupReservePercent – this is still working successfully with the new 24Oct21 version
Does the new change allow me to update setBackupReservePercent directly from Node Red? – I’m only asking just in case Webcore is discontinued – hopefully not!
Setting the backup-only mode to 100% reserve used to charge my powerwall at 3.2kw, setting the reserve to 100% in self consumption mode only charges it at 1.6kw.
Is this the same for everyone?
I only get a 4hour off peak period so the 1.6kw charge rate won’t fill my battery.
Yep, same here…
Also tried it in TBC mode, same result…
Tesla modified the charging power from grid in last ver upgrade in PW2.. 1 Pw max 1.7kw per hr, 2 pw2 gets 3 kw per hr and 4 pw2 gets the full 5 kw From GRID.. no change from solar..full 5kw depending on production excess
Thanks for checking, just when you get it working nicely Tesla move the goal posts!
Hi and thank you for your continued efforts, I used to use your SmartThings app daily when I just had a Powerwall 2. Since we added solar I no longer had the need to manage the Powerwall charging directly as over the Summer it managed itself well and rarely needed to charge itself off-peak, mostly filling up with solar during the day.
However, as autumn has set in and it’s much colder now in England, I’ve noticed that the PW algorithm is pretty poor at predicting how much to charge by, often only charging a bit overnight and then running out midway through the peak day. I sent Tesla a support email and they responded that a) the PW algorithm was working as designed and currently doesn’t use weather forecasts and relies entirely on historical data and b) why was the ‘Backup’ option no longer on their app to allow me to manually charge? They told me it has been removed deliberately but that sliding the ‘Reserve’ percentage to 100% will achieve the same aim…
So, I guess that explains why your app will no longer schedule charging cycles as they’ve been removed, but was wondering if the Reserve % settings instead in your app will work instead? Will try it out later but wondered if anyone had tried it…
Hi Roelof – Yes, setting a reserve of 100% in Self-Consumption mode in the Powerwall Manager should have the same effect as was achieved with Backup-Only. I’ve moved my Powerwall Manager schedules over to do this, and it all appears to be working fine. The next update to the app will depricate the old Backup-Only option as well as include a fix for false off-grid notifications and also a fix for an issue with setting reserve percentage remotely from some apps such as Node-Red. It’s currently in test and will hopefully be released in a couple of days.
Thanks very much for your reply, excellent news, really appreciate it!
As others have reported, when I change the reserve level to 100% in self powered mode, my PW2 only charges at 1.7kW which will never fully charge it as my off peak time is only 4 hours. Is there any way to speed this up?
I am considering getting one of these automation hubs to control my powerwall’s. Which would you recommend at this time.
Following
I would recommend using the Hubitat Elevation hub for most people for running the Powerwall Manager. I’m not sure how much longer SmartThings will support running hosted Groovy code, and due to local gateway self-signed cert issues, it is not possible to access local Powerwall gateway data with SmartThings (at least not a way that I have found).
Thank you and awesome job!!!
With the ‘Classic’ app long gone, all SmartThings users are on the current version of the app which doesn’t have the same UI as in the sample screenshots in the product pages.
Now we’re left with very basic view without all the readings. I have 3 questions if anyone can answer:
1) I only see a ‘Energy Consumption’ which is always 0.0 kWh and a ‘Power Meter’ that seems to work with live data showing a negative watt value. What are these 2?
2) My ‘Power Source’ doesn’t seem to work either. Currently showing an icon with a cloud with a strike through line. Does that mean it’s not able to determine the current source ie. grid or running on PW battery?
3) Dimmer – I see a slider for dimmer, but seems to return back to 0% when I try and change any value in it. What does this dimmer do?
Thanks!
Minor bug report…. If the app is configured with a Tesla account token and a local gateway password, but you set the Tesla account not to poll at all (because all the status can be retrieved locally and the gateway is just for commanding), the app’s status page will tell you it could not find any Powerwalls on your Tesla account. When I switched the Tesla account to poll hourly, it immediately reported that it was authenticated.
No matter… Being fed up with smartthings, I just purchased the hubitat… I have high hopes
I don’t understand. I have followed the instructions precisely but for some reason my scheduled instructions are only being followed some of the time. I have put in several register scheduled things around the time I want it to change but they are all being ignored most of the time. What am I missing? What am I doing wrong? My timezone is correct.
Marcel, which platform are you running on (SmartThings or Hubitat?) Can you check the platform logging page to see if there are any errors or suspicious entries? Setting the logging level to debug or trace (general preferences) may also provide more relevant information on the logging page.
Sorry for the interjection here. I decided to get Hubitat for local control (I decided against Mode changes, just do reserve changes). I think your app is fantastic, but Tesla Cloud is an unreliable resource for Powerwall control. I will continue to use SmartThings for my other devices as Hubitat lacks support or requires other upgrades.
It appears that events scheduled to happen at same time as TOU change (e.g. OffPeak to Peak) do not happen. Can anyone confirm this?