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
Strategy: Midnight: set Mode=Self-Powered; 6AM: set Reserve=100%; 4PM: set Mode=CostSaving, Reserve=0%; 6AM-4PM if Charge >=50% set Reserve=50%. Expected Outcomes: A. 6AM -> 4PM, all Solar (S) to Powerwall (PW) while Charge (C) 50% All S to Home (H) and Excess S (xS) charges PW. B. 4PM -> Midnight, All S to Grid (G), PW -> H while C > 0. C. Midnight -> 6AM, PW -> H while C > 0.. I’m PG&E customer and TOU schedule is Midnight to 3PM = OP (Off Peak), PP (Partial Peak) = 3PM-4PM & 9PM-Midnight, and P (Peak) = 4PM – 9PM. It seems PG&E as designed its times and rates to the disadvantage of solar (and Powerwall) customers. The above Powerwall Manager settings I hope will maximize the amount of solar I have available for use during PP and P. I have 2 PW and my records indicate 50% will last me at least 4PM to Midnight. If I generate less than 50% charge, I want all the charge available for P and 9PM-Midnight PP. The Tesla app forecasting model is opaque and Tesla is not clear on how Cost Savings mode works. Here (https://tinyurl.com/3zdyybs7) they say PW will charge from “excess solar”; while here (https://tinyurl.com/evwcsa8d) they say PW will charge from “any solar.” In any case, Tesla app does not reserve PW charge for P. It can use PW for 3PM-4PM PP. This is inefficient if PW cannot cover all of P and PP—it might use some charge in PP that could be used in P. Financially, one might want to dump all the solar you generate at P prices. The Tesla app will not support this and it might not be the most financially advantageous, depending upon your usage patterns. It seems to me the proper target is a system size and personal pattern of usage and generation that zeros out (or minimizes) your utility bill. Unless you use all your solar generation as it is generated, a Powerwall maybe a good investment, but adds significant cost that needs to be recovered. The Powerwall Manager SmartApp can be a valuable tool to manage the Tesla app behavior and help reduce cost recovery time. The idea of my strategy is to rapidly accumulate enough PW charge to last 4PM – Midnight; use Solar beyond that to (1st) power H and (2nd) then charge PW before Peak; use PW to power H… Read more »
I made some changes since I believe a Mode change (e.g., Self-Powered to Cost Saving) can take up to an hour (isthis true?) and I believe a Reserve change will be implemented almost immediately (is this true?).
Mode = Self-Powered; (1) 6AM set Reserve = 100%, (2) 6AM -> 4PM, if Charge > 50% set Reserve = 50%; 4PM set Reserve = 0%.
This keeps mode constant, forces all Solar to PW until Reserve will meet what I need for Peak and late Partial Peak. Solar is sent to Grid only when there is Excess Solar.
Is this better in theory? I will need to operate with these settings to get a handle how it performs. What happen with the original strategy is the 4PM changes did not occur (delayed I think) and I started to rack up power at Peak rates.
Ideas, thoughts?
This is where I’ve settled (at least for a day or two): 6AM Set Mode = Backup Only; 6AM -> 3:55PM / C > 50% Set Mode = SP, R = 50%; 4PM Set Mode = SP, R = 0%. This might take PW to 50% faster.
Just to say installed a couple of days ago – works fine – used the https://teslascope.com/help/generating-tokens to paste the token into the Smartthings IOS app. So thanks again!!
If anyone is interested in pulling the battery% value out of Smartthings into Node Red using a direct API call – this function works:
(feed this to an ‘http request node’ with option method “set by message selected” )
//get Battery % level
msg.headers = {}
msg.method = “GET”
msg.url = “https://api.smartthings.com/v1/devices/{deviceID}/status”;
msg.headers[‘content-type’] = “application/json”
msg.headers[‘Authorization’] = “Bearer {your_Smartthings_API_Token}”
return msg;
then to extract battery % use this:
msg.payload.components.main.battery.battery.value
To get ‘your_Smartthings_API_token’:
go to:
https://account.smartthings.com/tokens
Select “Generate Token”
Add a name
Tick every box
copy token to the above function
To get your ‘deviceID’:
Log into your Smartthings account from a PC
Select – MyDevices – Tesla Powerwall – List Events – then open latest event and copy ‘deviceId’ value (5th down in table)
(remove curly brackets in function!)
==============================================
Help required here:
If anyone has managed a “set” function eg setBackupReservePercent – I would love to know as I can’t make that work?
I got this far – (this returns a 200 so command is accepted – although I don’t know what is switching!!)
// Switch on/off
var on_off = “on”
msg.payload = {
“commands”: [{
“component”: “main”,
“capability”: “switch”,
“command”: on_off,
“arguments”: []
}]
}
msg.headers = {}
msg.method = “POST”
msg.url = “https://api.smartthings.com/v1/devices/{deviceID}/commands”;
msg.headers[‘content-type’] = “application/json”;
msg.headers[‘Authorization’] = “Bearer {your_Smartthings_API_Token}”;
return msg;
Having issues on device handler thou..does not display or read energy consumption nor power source.. any idea ?
Thanks for the update. Works great!
I just posted an update to the Powerwall Manager that re-adds the gateway status polling back in (for Hubitat) and also adds separate gateway and server polling preferences. This update also overhauls the scheduling infrastructure to allow an unlimited number of schedules, schedule naming, and adds optional month restrictions – so those of us with seasonal time-of-use utility plans or other seasonal requirements should hopefully not need to manually update schedules in the app as often.
The scheduling update was a fairly major infrastructure change, so if you update, please verify that your prior schedules have remained intact. Thanks to @snell on the Hubitat forums for the gateway auth cookie suggestions. Thank you Mike B. for both the direct token input and the seasonal scheduling suggestions. Thank you Jared for the separate gateway polling interval preference suggestion.
This update REALLY works.. thanks derwin..
For tokens needed in order to work, download this token generators for IOS or Android
https://teslascope.com/help/generating-tokens
Thank you so very much!!!!
Hello everyone. Sorry it’s taken so long to address the Tesla API auth changes. I’ve committed an update to now allow you to paste in an access token directly into the app to allow authorization with the Tesla server. Unfortunately, the app no longer supports direct access to the local gateway. You will need to generate and paste in a new token at least every 45 days.
There are several approaches for generating new Tesla tokens, including python scripts and the ‘Auth App for Tesla’ for IOS and Android.
Due to what appears to be limitations in the current way SmartThings and Hubitat handle URL redirection and HTTP headers, I’m not sure the app will ever directly support authorization with the Tesla server by entering in your account and password information alone. The issue with local gateway access also appears to be related to limitations in the Hubitat and SmartThings HTTP header interface. I would love to be proven wrong, so if anyone out there has a solution, it would be greatly appreciated.
The app does now allow you to generate and serve the access token posted via a script running on a local server for those wanting a hands-off approach for refreshing the token periodically.
Please let me know of any issues with the latest update. Thanks for your patience.
Any updates?
News about authentication? Thanks
Any updates on getting this functioning again? Still unable to use via SmartThings, getting :
Error Verifying Tesla/Powerwall Account
Please verify your Tesla Account username and password.
That option was 4 months ago and TESLA implemented 2FA recently.. of course .. you should NOT activate 2FA on you login page @TESLA as when the fix of this wonderfull app finally is in place
Hi We are in the UK with a PW2 GW2 and Smartthings. I cannot get the Smartapp to accept our credentials. Is this a common problem after you mention the new 2FS? As I have only tried for the first time recently so I don’t know if I am entering the correct credentials or it is a common problem. Really love to get this to work as we have a large 3 phase electric storage heater and if we have a power cut when it is charging over night it drains the PW2. Thank-you in advance
Tesla changed its auth now to use 2fa but mainly you can run with 2fa disabled.
Good documentation here
https://tesla-api.timdorr.com/api-basics/authentication
And sample pw code here :
https://github.com/fkhera/powerwallCloud
2FA doesn’t matter as much as the new login flow. 2FA is just one extra call in handling the new login.
I checked my powershell script for obtaining a token and that no longer works.
So it looks like Tesla has finally deprecated the /oauth/token endpoint in favour of using the new auth.tesla.com. I expect that this is part of the move towards 2fa?
I guess as soon as current tokens expire then any app that uses the original oauth/token will stop working. Looks like I was unlucky with the token expiration date.
On my side can’t even log in as previously.. double check my credentials on the app ans on Tesla site A-ok but the smarthings app no go. Error getting credentials
Hi
The app seems to have broken again for me – It has been working faultlessly for the last few months. The smartthings phone app updated last Monday and the Powerwall manager app became intermittent after that. I’ve tried deleting and reinstalling and now the system won’t accept a password.
This is the debug result of trying to enter password:
11:25:07 PM: error Http Get failed: groovyx.net.http.HttpResponseException: CUSTOM
11:25:07 PM: error Unhandled exception getting token: groovyx.net.http.HttpResponseException: CUSTOM
11:25:06 PM: debug requesting: /api/1/products
11:23:43 PM: debug resetting account tokens
Any ideas
Yes, it does look like Tesla has changed the authentication process. The app is no longer working on SmartThings or Hubitat. I may be able to make some updates to get things working again, but it could take a while, unfortunately.
How can I contribute ($) towards the effort? I know it could be more of a time thing, but I’d like to contribute none the less.
I’m in for this idea also. I wouldn’t buy a subscription but would happily contribute some cash. This app is awesome.
If I could suggest a strategy here…. Getting tokens automatically is a bit of a hassle in the new system; I used someone else’s existing code that encapsulated it nicely, but that’s less likely to be an option in Groovy. Refreshing tokens isn’t so bad. A quick change that allows the user to manually supply tokens would let people use existing tools to get them and give you time to implement the full login flow at your leisure.
Hello, Hope all is well. I was wondering if you have any plans in place to resolve this. I’d be more than happy to support any/all efforts financially, as I currently don’t have the skillset to code around the problem! Thanks!!
Hello –
I’m sure you get around 999 messages a day asking for updates on this, and I’m probably #704 lol. I’ll start off by saying I hope all is well with you and your family. That’s more appropriate. I’m looking forward to this working again, man it was some great work! Thanks,
Todd.
For the scheduling aspect, I would like to see not just day-of-week, but time-of-year scheduling. In the summer, when solar production is high, it makes sense to be Self-Powered with a low Reserve. In winter, when solar production is low, it makes sense to be in Backup. In between, Self-Powered with a high Reserve. The icon for scheduling is a calendar, but ironically, it seems impossible to schedule based on the calendar.
First, I would like to thank you for a very useful and well thought out app as well as such comprehensive functionality. Also, great how you have created the feature request list on Github that keeps us all updated. Big Thanks!
One small tweak to functionality, right now the feature to turn devices back on once grid comes back on uses the same list as devices to turn off. I use the turn off list to turn off large loads that are not normally on (in case they are on at the time of power outage) such as electric outdoor heaters but I don’t want those large loads to turn back on when grid power resumes given that normally we don’t know when it will resume. However, some devices (such as thermostats) I would like to turn back on once power resumes. Is it possible to have a separate list for turning on when grid returns? This is not high priority as I have just created automations to turn off the large loads and I just use the list in the app for items that are OK to turn back on but it would be great to manage all in one place. Thanks!
Manel, you can do more complicated things using Rule Manager. I created a virtual switch, and that switch is the only thing that the Powerwall app changes when grid status goes up and down. Then you can tie arbitrary rules to changes of that switch.
I am having trouble replying with full details but I don’t see anything in the logs that would indicate why before this. I will try some additional tests to try and determine when it does the token refresh but it seems to correspond with using the Tesla app – and by that I mean just open the app and have it refresh the data.
What would be the plan to enable Multi Factor Auth once Tesla releases it’?
Good question! Tesla added the option for multi-factor authentication about a month ago: https://www.tesla.com/support/multi-factor-authentication, but I haven’t yet investigated the implementation details yet. If Tesla at some point makes MFA a requirement, that will definitely bump up the priority. If anyone here is familiar with the code and wants to work the implementation specifics, I, and I’m sure many others here would be very appreciative.
Mine started to work again 3 days ago.
I can’t say for sure if it’s been consistently operational since, but It started working a few weeks ago again for me on SmartThings. It has consistently worked on Hubitat. I have yet to see any issues there.
Is there any way to make decisions based on the upcoming weather forecast (sunny/cloudy/raining) for the day? Also by the month? I would like to increase the reserve only in Winter months when it is forecast to be cloudy or rainy.
Hi Mark. This app doesn’t directly support weather forecast, but if you’re familiar with custom automation apps in SmartThings or Hubitat, such as WebCore or Rule Machine, you should be able to query a weather forecast capable driver/device handler and then execute any of the Powerwall Manager commands based on the forecast conditions.
Hi Darwin & Mark
I use the Solcast api to predict the amount of solar that I’m going to generate the next day. As I’m on an energy tariff that provides me with cheap energy during the night – every evening I adjust the reserve level in the app to an amount that gives me headroom to charge from the predicted solar the next day. (then a second schedule to revert back to self-powered at the end of the cheap period.)
I must say that the app works very well with this setup.
Is the reserve level percentage available to adjust in webcore, or is it only settable from the app?
Thanks again for the app.
Yes, this app and device handler/driver expose the following commands that webCore or any other smartApp can call:
setBackupReservePercent
setBackupOnlyMode, setTimeBasedControlMode, setSelfPoweredMode
setTbcBalanced, setTbcCostSaving
enableStormwatch, disableStormwatch
Solcast looks intriguing. Thanks for mentioning it. How are you currently getting data from the Solcast API? I haven’t seen that there are any available apps for SmartThings or Hubitat out there yet for it.
Hi
Thank you so much for getting back to me. That’s fantastic that the commands already exist – I felt they should be but I didn’t find them! (I’m a recently retired engineer exploring a whole new world!!).
Regarding Solcast – I have used Node Red – (running on a Pi) as the platform to collect the Solcast API data. Solcast allow 20 calls per day with the free account which is plenty for this purpose. There are Node Red flows on the internet that read the Solcast API, but I found them too complicated, so I ended up writing my own. I trigger it at 10pm – it just returns a single pv value in kWhr as a prediction for the following day. You are welcome to a copy of the flow (code), although it is very straightforward in comparison to device handler code!
As a background to Node Red – I had started to move away from Smartthings as there seemed to be too much change going on in a very short time – I had discovered Webcore thanks to your blog! and had found that a breath of fresh air compared to ST device handlers. I do hope Samsung keep supporting Webcore going forward. One of the reasons for the move to Node Red was that one of my data sources requires digest authorization which I understand isn’t supported (yet) in Smartthings. I really wanted to standardise on one platform. Luckily there is a Node Red flow that links to Smartthings so it is possible to pass data between the platforms – I pass your battery data to Node Red so it ought to be possible to set the Powerwall reserve percent from Node Red – that will be tomorrow’s challenge!
Thanks again and regards from the UK.
Node Red is great. I moved all of my automation rules to Node Red on a Pi a while back. Now, aside from a few custom apps, I only use the hubs for Zwave, Zigbee, etc device control. I don’t feel as locked in on a home automation platform anymore, as the Node Red flows will remain pretty much the same regardless of whether they control devices on Hubitat, SmartThings, or even Home Assistant.
I finally got round to this and it worked! Webcore Piston (excuse text formatting):
/**************************************************************/
/* webCoRE Piston #1 */
/**************************************************************/
/* Author : Mark */
/* Created : 20/02/2022, 14:00:19 */
/* Modified : 20/02/2022, 15:16:23 */
/* Build : 17 */
/* UI version : v0.3.114.20220203 */
/**************************************************************/
execute
every day, at 06:00:00
do
if
{$twcweather.forecast.daypart[0].cloudCover[0]} is greater than 50
then
with
Tesla Powerwall
do
setBackupReservePercent(50);
end with;
end if;
end every;
end execute;
It appear Tesla killed installer login with 1.50.1 they require power toggle in Every login do you know a works around d??
I am not aware of a workaround aside from switching over to use the Tesla server/cloud API. The Powerwall Manager app uses the server API and so far at least it remains operational.
For those interested in hacking the powerwall so check out ::
https://youtu.be/tYx3nlOedbA
The powerwall manager smart app started working again this evening for me and it’s so nice to have battery level notifications and webcore automations again. Wish/hope it lasts!
Sadly, I may have spoken too soon. My smartapp worked for about 24hr and then stopped updating again this morning after 5:10 am PDT. When I check the live logging, the errors appear to be similar:
Site resp error: Failed to complete. Message was: connection timed out: owner-api.teslamotors.com/205.234.31.120:443 on attempt 2.
I’m seeing the same issue now with SmartThings as well after things were briefly working again. My last successful update was also at ~5:11am PDT this morning. Hubitat remains operational.
As of 02:10 GMT UK time this morning, mine appears to be working again, can anyone else confirm? If so, fingers crossed it stays working…
Thanks Darwin! My Powerwall/SmartThings integration is now working with your Smart App on Smartthings again, as of this morning around 5am PDT!
Do you have an export or guide to setup the cool Hubitat dashboards for powerwall and solar?
Hi
Just a note to say thank you so much for sharing your app. I just wanted to add to the above to say that the EU servers are also affected. I’m in the UK on https://graph-eu01-euwest1.api.smartthings.com/ showing “Last Activity At 2020-09-10 3:23 PM BST” (07:23 AM PST). I hope this helps narrow down the problem.
Thanks for all of your work- this app is amazing, and has become a pretty instrumental part of my ST, so much so that I might have to move to Hubitat if ST takes away functions necessary for it to continue…
Today, I got a message that my Powerwall Smartapp hadn’t received data in more than 105 minutes this morning and it was reinitializing. I still wasn’t getting smartthings updates.
Currently using PowerWall Manager v0.2.8e.20200702, and had recently updated both the smartapp and device handler to the latest from github.
I captured the below information in the live logging:
At first I was receiving the connect timed out messages- I tried to go into the smartapp settings in the ST Classic app and re-enter my account information but the page to enter the account information wouldn’t load, stating “Something’s Wrong We can’t load your screen right now. ” with a button to “Retry”. That’s when the debug requesting: /api/1/products log messages would come up.
Does this mean the owners api is down right now?
—–
11:06:06 AM: warn Powerwall resp error: Failed to complete. Message was: connection timed out: owner-api.teslamotors.com/205.234.31.120:443. Retrying.
11:06:01 AM: error Unhandled exception getting token: org.apache.http.conn.ConnectTimeoutException: Connect to owner-api.teslamotors.com:443 [owner-api.teslamotors.com/205.234.31.120] failed: connect timed out
11:04:54 AM: error Http Get failed: org.apache.http.conn.ConnectTimeoutException: Connect to owner-api.teslamotors.com:443 [owner-api.teslamotors.com/205.234.31.120] failed: connect timed out
11:04:44 AM: error Unhandled exception getting token: org.apache.http.conn.ConnectTimeoutException: Connect to owner-api.teslamotors.com:443 [owner-api.teslamotors.com/205.234.31.120] failed: connect timed out
Thanks for the heads up. I’m seeing similar issues as well on SmartThings. It appears to still be running fine on Hubitat. The last successful update I received for the Powerwall on SmartThings was at 7:19am PDT. Looking into it..
Thanks, hope it’s not too complicated of an issue! I can confirm that my last PW update in SmartThings was 7:21 am PDT, with failure on the next check at 7:26 am PDT.
Since it’s working in Hubitat, and my Tesla mobile app still seems to work, I guess that means something must have changed on the SmartThings side…
Thank you so much for this! I just got powerwall installed and as I have real time market pricing for my energy this is a lifesaver for managing my grid usage! Thank you – thank you!
One feature request that I would love – it looks like you set the powerwall polling interval and it is a shared number between local powerwall and the tesla web api. I would love if you could adjust these independently. I don’t mind hitting my local PW interface a lot for things like the real time meter values / grid status but I don’t want to hit the tesla web api very much. (ie I would love to put something like 10 seconds on the local polling but 10 minutes on the tesla web api to keep them happy.
Let me know if this is upcoming – also I noticed there was no way to enter your customer email – does this app just default to tesla web api for items like the grid status? I believe those need to have customer login to grab locally right?
Thanks again!
Thanks for the feedback. Both of your suggestions are definitely on the roadmap – and yes, currently the app only uses the Tesla server API when authentication is required such as for commanding and viewing modes and states. I’ve put both your items on the to-do list: https://github.com/DarwinsDen/SmartThingsPublic/projects/2.
Darwin, Get App. I was wondering if there was anything in the API to make a grid outage turn on a device. For instance I would like the app to turn on my smart light in my house so that I know there is a power outage. Then I would like it to turn off when the outage is over.
Hi Mike. The app currently only directly supports turning off devices in the event of a power outage. However, the Powerwall device that the app creates is registered as a switch in both SmartThings and Hubitat that will flip to the off state in the event of a power outage. You can then use simple automations such Smart Lighting in SmartThings or Simple Automation Rules in Hubitat to turn on or off other devices based on this Powerwall switch state. Hope this helps. Let me know if you run into any issues.
Hi there! Wondering if you have thought of adding GitHub integration into Groovy? Not sure how hard that is from your side..
Currently having difficulty getting anything to show up in the app, even though handler and App are green and published… Anyway I’m sure I’ll sort it out – thanks for building this!!!
Hi – got it working, but the main thing I want to shut down during a power outage is my HVAC. The thermostats don’t show as switches in ST so (I guess…) that is why they are not available for your app to “shut off”. Can you implement Thermostat control?
the instructions are suberb for the smart things hub install but not a mention of how to install on Hubitat. I have a first gen hubitat that I would like to run this app on but I am clueless as to how to accomplish it – comes from being too old and not tech savey enough. Any instructions for Hubitat would be greatly appreciated!
Hi David. It was a little rushed, but I quickly updated this page with Hubitat installation instructions. Hopefully it’s enough to get you started for now.
Thank you so much!! I have switched my Powerwall control over to the Hubitat!! I’ll monitor for a few days to make sure. Thank you for solving a battle I have been waging with Tesla!! Where can I make a donation?
How is Smartthings “changes” going to affect this? This smart app is going away?
Good question. I’m not sure of how SmartThings will actually end up executing to their timeline for all this considering the multitude of custom apps out there that currently require the IDE. This app could be ported to the new SmartThings IDE, but that would require users to figure out their own hosting instead of using the SmartThings servers. Some of the functionality in the smartApp could be migrated over to the device handler if SmartThings continues to allow the groovy handlers. The app also works on the Hubitat hub, so that’s certainly an option for users willing to migrate over.
Hi,
I’m getting the following error:
50d08ff0-fe95-40d7-a194-b3dd0d9eddc7 1:30:43 PM: error java.lang.NullPointerException @line 664 (getTheDay)
Thoughts?
Hi – Looking at this now.
I think I figured it out. I ended up having to go to Manage location and then set my address in Geolocation field
Thanks! Nice debugging. Yeah – my first guess was that SmartThings wasn’t coming up with a valid time zone for you. I’ll see about adding in some protections (or worst case, a warning) for this.
Hi, I just had solar panels and a Powerwall installed but am still waiting for permission to operate from the electric company. I’ve been using a Smartthings hub for years, and was excited to come across your app. Excellent job!
Question – must we use the smartthings classic app or can we use the current version of the smartthings app? If the classic app is required, can the classic and current apps be run on the same phone?
Out of curiosity, I installed the smart app in the current version of the smartthings app, and it appears to install fine and includes all the settings found in the smart app. However, the Powerwall device in the smartthings app does not have the nice UI that you created and thus cannot be used to monitor the state of the Powerwall.
Thanks again for creating this, it is fantastic.
Hi Steven. Congrats on the new Powerwall installation. It’s a great device, particularly when paired with solar.
I’m not fully up to speed on the new vs classic SmartThings app differences, but from what I have seen, the Powerwall Manager smart app runs fine in both classic and new app. As you mention though, the Powerwall device itself is not displayed correctly in the new app. I believe SmartThings will be providing direction on how to update custom device types for proper operation on the new app, but I don’t believe they have released the details on how to migrate to the new app as of yet.
I believe you can run both the new and classic app simultaneously if you would like. Some features like the SmartThings Home Monitor (SHM) run independently between the two so you would want to choose only one to use for that if you run both apps.
Thanks! I appreciate the feedback.
I also want to say thank you so much for the work you’ve put in here. I also noticed my automation seemed to break with 1.46. Some automations still happen but then some don’t. Not sure why. For example, it will change the mode at least once a day but then won’t change it back or won’t change the reserve %.
If you need anything to help, let me know.
Thanks Joe. If you’re not using the v0.2.6e.20200302 version of the smart app (02-Mar-2020), you might see if updating to the latest version helps with missed commands. Command error check, retry logic, and command failure notifications were added after the January releases. If you’re still seeing issues, it would be helpful to know if you see any suspicious logs in the “Live Logging” tab in the SmartThings IDE (or just the Logs tab in Hubitat) at the time a command fails to execute.
Teslas most recent update seems to have broken the push commands on this app [on Hubitat], get commands still work and status still updates though. I will try to get some logs and see if that helps.
Hi Anthony. Thanks for letting me know. Yes, I would appreciate any logs or debug information you can gather. Powerwall commands still appear to be working for me from Hubitat, but my Powerwall is still back on version 1.45.2. Is your Powerwall now on 1.46 by chance?
Mine is on 1.45.2, looks like the refresh token did not work. I actually had to manually sign in to my account on my Tesla app today which sparked me to try the same on the Hubitat app and that corrected it.
This app has been an amazing lifesaver for me thank you so much for your work you put into it. My power company has 2 peak times per day so without this I was manually making changes until I tracked this down.
My next step will be trying to parse through the info and bring this control into Crestron. I have a lot of learning to do to get to that point but have some time so if I can figure out the whole OAuth 2.0 deal in Crestron simpl+ I’ll be on the right path.
I had something similar happen a while back and I was able to fix it by resetting the gateway (just hit the rest button – as simple as that.) I did it right after the last update because, why not,…
Thank you for creating this app! Just installed the it yesterday. I am using the Smartthings classic app and tried set an automated PW settings change (at 3:50pm, everyday, change reserve setting to 25% [from 100%]) but the change did not trigger even after 1 hour past the scheduled time. I’m on self-powered. Is it necessary to configure the “mode to set” to self-powered when setting a schedule or is it ok to leave it as “no action” since I just want to stay on self-powered?
Also, while having it set to “self-powered” with the button green, why is the “cost-savings” button also green at the same time?
Hi Mike. Sorry you’re having issues with the app. Leaving the “mode to set” as “no action” is fine if you are only wanting to have the schedule change the reserve percentage. Would you be able to schedule another reserve percentage change and let me know if you see any suspicious logs in the “Live Logging” tab in the SmartThings IDE while setting the schedule – and also when the action should be executing? Also, please verify that the schedule is still set when you exit the Powerwall Manager App on you mobile device and then return to it.
The cost-savings button currently will always show its current state for the Advanced Time controls mode regardless of what mode the Powerwall is in. It would probably make more sense for me to update that to show N/A or similar in that case.
also something that isn’t 100% clear is when are making a schedule is you have to ‘back all the way out’ until you see the ‘save’ button and once you hit that it should work as advertised if everything else is setup correctly. if you are just hitting ‘done’ you haven’t done the change yet.
First off you are awesome this is a great help especially because i can grid charge and solar charge so switching modes has sucked.
I got it all loaded and authenticated and am getting stats through attributes however I cannot find a block can add to control the powerwall from my dashboard. I was able to setup the schedule i want easily enough just not sure what m doing wrong with the dashboard, I am using hubitat
RE:Storm Watch update. I THINK I fixed it. I logged out of the Tesla app and when I went to login I couldn’t. I went to the website and was told that there were too many bad login requests. I had to reset my password, After that I could log back in to the app and then changed my credentials in ST and now it seems to work. The logs are mostly blue now (before there was a whole lot of Red…)
BTW GREAT on the storm watch automation – we’ve had 4 notices since you implemented the feature and every one of them I was able to push to super off peak. Really great job.
OK, here’s another feature request and may be this already exists somewhere:
I want to easily suspend the scheduling. Yesterday, there was a planned power outage and so the day before I wanted to have a full battery by the AM, so when ever my SmartThings flipped to new settings I kept having to manually set them back to back up – near the end of the day, I missed one and so in the AM I only had 75%.
It wasn’t a big deal but I suppose it would have been helpful to be able to just put a timer on it or just a switch somewhere in the interface.
Thoughts?
Glad to hear the Stormwatch scheduling worked out for you.
I’ll think about a good approach for adding a simple method to pause scheduling. Right now, when I need to do that – mainly for testing – I uncheck the desired day of the week for each schedule I want to pause, and then hope I remember to re-enable it again later.
Hi Mark. The latest v0.2.5e.20200229 release now provides an option on the preferences page to pause all automations. This release also includes the ability to define action triggers based on Powerwall battery charge % level.
I’m having a weird problem – the best I can figure out is that my reserve is stuck at 60% regardless of what the tesla app says or what ever mode I am in. The PW’s simply stop discharging whenever I hit 60%. Any ideas how to shake it free?
I have not heard of this issue before, but I have seen the Powerwall occasionally take several hours for a setting to take. Are you still seeing the problem? I would contact Tesla support if it is still occurring.
It’s been like that since last weekend. I’ve sent email to Tesla support but no answer. I’ll call on Monday.
The long and the short of it was the gateway was no longer receiving commands from my app or Smart Things. After two calls with Tesla ‘we’ll get back to you in a few days’ and a call from installer who suggested I hit the reset button on the Gateway (I didn’t know it existed as I wasn’t around when they finished the installation.) and within 20 minutes my PW’s were responding to commands both from ST and the Tesla app.
Good to know. Maybe I should have suggested that, but I’ve seen little information on exactly when the gateway reset button should be used. I hit mine once about a year or so ago after becoming impatient when the Powerwall didn’t seem to be behaving correctly based on the mode I had set several hours prior. Back then, the gateway software version was much slower to respond to commands, so I never gave it much thought as to whether hitting reset somehow helped resolved it or if the change finally just took effect on its own. Sounds like our situations may have been similar after all.
Hi, this is a great app! thank you for writing it. I’ve been using the app with Smartthings but I’m switching to Hubitat. Do you have any plans to tweak the app so that it works on both platforms?
Thanks! Hubitat support is on the long term roadmap, but I can’t make any promises at this point. I have a Hubitat hub on the shelf right now, but haven’t had a chance to give it a try yet.
Ok, thanks. I was able to get it to load with a couple of edits and create a device but it didn’t pull any data. No problem. I’m happy to wait, I’ve got plenty of other things to migrate across in the meantime ?
I spoke to soon. I gave it a quick try and was able to get at least initial functionality on Hubitat by updating the async http call for cross-platform support with Hubitat & SmartThings. v0.1.8 of the smart app has this latest update. I did not update the current device handler code. The current Powerwall device is not pretty on Hubitat right now, but it does show the current state and at least the few commands I attempted appear to work.
First off, this is awesome! I am loving it! Could we add some more selections to the reserve %? I am using it to defeat my energy company having dual peaks. I need about 15% reserve or I risk running out in the mornings during the peak, but I’d I jump to 25% I take grid power when I don’t need to. Any way that can either be changed to 5% increments or become a box we could insert any percentage? Thanks!
Thanks for the feedback. This has been one of the more common requests. Version v0.1.6 of the smart app now supports reserve percentage options in 5% increments. If your device handler code was already current (v0.1.3 from 12 Aug 2019), then to update, you’ll just need to follow the first section “Install the Powerwall Manager Smart App” of the installation instructions above and you should be good to go.
I saw it yesterday as I happened to be in GitHub updating some other smart apps and I want to give a sincere “Thank you!”
the update works perfectly.
Thanks for the app; it’s working great. But how do I delete the old app version? I now have two versions installed and I get an error trying to delete the first.
This usually means that SmartThings is holding on to a reference to the Powerwall device somewhere. Possibly there’s another smart app referencing it. Try removing the Powerwall device first (select the Powerwall device from the ‘Things’ tab and then select the cog in the upper right) before removing the smartApp.
It was the Alexa app. Deleted that and then could delete the old Version. Thanks!
Yet another feature request – is there a way to automate Storm Watch on and off? We are in a weather service alert and so over night my batteries topped off from the grid (yay!) but during the day I had them in self powered mode and with the batteries dropped below 90% or so it started to pull from the grid. during TOU peak – I’m glad I was watching the tesla app as suddenly I was pulling 10kW. I toggled off storm watch and it stopped. At 10pm when I am off peak, I’ll turn it back on.
Yes – that can be added without too much difficulty. I’ve put that on the list of future potential change requests here: https://github.com/DarwinsDen/SmartThingsPublic/projects/2
Hi Mark. I’ve added Stormwatch enable/disable scheduling in the latest release and I’m now putting it through its paces. I’ve updated my personal Powerwall Manager schedules to disable Stormwatch during peak utility periods and then re-enable it at the start of off-peak. In the year or so I’ve had the Powerwall, Stormwatch has never been triggered on my system, but regardless it would probably cost me a fortune in utility demand charges if Stormwatch ever was triggered during peak hours.
Fantastic! I’ve my power wall for like 6 weeks and we’ve had 3 storm watch events since….
ok – I have a real feature request. in scheduling, I would like to have finer control of the reserve % amount. 25/50/75 isn’t where I want to set it. for example I was 55 or 60% on backup and 20 or 15% on discharge.
this single thing is the only bit in the tesla app that is better 😉
Yes, I’ll look at changing that so that you can enter any percentage of your choosing. Thank you for the suggestion!
I have a trouble shooting question. I have the schedule set to switch to backup at 10pm and it didn’t do it last night – my pw’s were still on self power at 6am. how do I troubleshoot this?
In the SmartThings IDE, “My Locations” tab, you can select smartapps and devices and view their event history. There might be at least some clue as to what it did or didn’t do last night in either the Powerwall Manager app or the Powerwall device history. You should see the command events in both the smart app and device event history. You can also view the Live Logging tab for more detailed logs, but you can only view real-time logs, there will unfortunately be no history in live logging from last night. The Live Logging information could be useful if you are able to recreate the problem on command.
thanks – I’ll check it out.
In the future, I plan on having the app verify and resubmit the command if it didn’t appear to work – and also then send a notification if the command still doesn’t take after a few retries. It’s been so stable for me, I just hadn’t prioritized that.
I freaking love this, thank you!
You’re welcome! I appreciate the comment.
Hey there – I found you via TMC and I procured a Smartthings hub (the newest one) and was able to install your app into it. Thank You – it’s really awesome and certainly makes the Tesla app much more intelligent in terms of Time management.
In my particular situation, I want to turn off my nest thermostats when there is a grid outage and since Smart Things and NEST don’t talk to each other, I could use IFTTT (which still talks to NEST) if I could set up a trigger from your app that can be used to trigger an IFTTT recipe. Within the IFTTT section of the Classic app, I can only set the powerwall ‘switch’ – it seems that there needs to be some sort of hook from your app to IFTTT. Perhaps the thing to do is to have your app ‘think’ the Powerwall is off when there is a grid outage and then I can use that state to trigger the IFTTT recipe.
Thoughts?
Hi Mark. Thanks for the feedback. What you describe is precisely how the Powerwall manager should currently work. The Powerwall device in SmartThings is considered a switch, and “on” indicates that the Powerwall is connected to the grid and “off” indicates a disconnect/power outage. You should be able to perform IFTTT actions based on this switch state. Please let me know if you run into issues – I can’t say I’ve fully tested the full integration here.
Great! I’ll test once I have a UPS installed for my server.
Here’s another thought- can you set up an internal trigger from the amount of charge in the PW? For example to automate a switch from Backup to Self Power at 75% change, or to Backup at 20%? I don’t trust the Tesla app to figure out how much charge I really need for backup.
You should be able do this with the WebCore Smart App if you’re willing to add it to your SmartThings tool kit. It’s the most sophisticated and simple-to-use (once you get the hang of it) GUI based home automation rules engine that I’m aware of, and you may find it useful for other purposes as well. Here’s a sample WebCore piston that I think would accomplish what you’re looking for:
I agree though, it’s nicer when options like this are directly controllable from the Powerwall Manager, so I’ll try to look at adding more of these types of features in the future.
Interesting – when I have some time I might try that.
In playing around with all the options, it’s not super clear to me how to get the exact behavior I want. I’m TOU in SCE (los angeles) and right now it’s pretty easy to have the PW setup so it’s in backup mode during the off peak times and Self Powered mode (with a high-ish reserve up until Peak) and then at Peak, lower the reserve.
That works fine, but during Peak, ideally I’d want the excess solar going back to the grid. When ever I turn on the Advanced settings, it seems to turn off the powerwall and grab power from the grid which is exactly what I don’t want. 😉
could it be that I have to run in Advanced mode for a few days for it to learn? my biggest concern is that mode won’t reserve enough energy to for TOU peak to end at 8pm or hold on to 10pm when the shoulder is done.
is there a way to force the PW to send to the house during peak and solar to the grid? I figure Advanced/Cost mode would do that but it doesn’t seem to.
Triggers based on Powerwall battery charge % level are now available in the latest v0.2.5e.20200229 release.
New to the whole smartThing environment and the basic model – have downloaded your code and have it showing my power wall status – and see a list of switches for when it’s off grid. I have a NuHeat floor heater thermostat – and have installed it in the Smartthings/home/app also – showing status for it also – but the NuHeat Thermostat does not show up as a device that can be switched “off” during a grid outage – I’m requesting some help/tips/pointers as to how we could modify the code to also set the NuHeat thermostats to “off” during an outage also – being new to the IDE and the general model I’m lacking enough context to forge a path forward – the Device Handler for the NuHeat thermostats are listed here https://github.com/ericvitale/ST-NuHeat-Signature-Thermostat – I’m wondering if anyone can take a look and rough out some code or provide me some pointers. I really don’t want to run the electric floor heaters while on battery power.
thank you in advance for any assistance.
Hi David. Looking over the NuHeat device handler code, it doesn’t currently support the Switch on/off capability directly (which the PowerWall Manager currently requires for control), although it does provide on/off command methods. You can add the switch capability by typing in the following line on or around line 49 in the NuHeat device handler code:
capability "Switch"
One possible issue with this though is that the NuHeat device handler off() command currently runs a resume function which sets the thermostat to ‘Schedule Mode : 1’. I’m not so sure this is what you want since I’m unfortunately not familiar with the NuHeat device, but maybe it’s a start. Once you add the capability line to the NuHeat code, you should be able to test on and off triggers by using a Smart App like SmartLighting to turn the heater on and off via a physical or virtual switch trigger (if you don’t want to do the full house power down needed to test with the PowerWall Manager).
Per suggestion from @amphipri0nI, I’ve updated the app and device handler to indicate the grid outage status (onGrid/offGrid) from the Powerwall. I also added grid status push/text notification option as well as an option to select devices to turn off during an outage in the Powerwall manager app itself. If you’ve already installed the prior version, you’ll need to update both the smart app and device handler for all the changes to work properly.
As a side note, the Powerwall performed flawlessly when I cut off grid power to test the update. This is the first test I’ve done on the latest V1.37.1 software version. The Powerwall immediately cut over to power my home, and solar continued charging the battery. I think with a little care and forethought (and unfortunately no air conditioning with just a single Powerwall), my home power could be indefinitely sustainable without grid-power. The Powerwall is just plain awesome.
Hello. Thanks for this awesome piece of work!!! Are there any plans to allow the user to modify on-peak/off-peak price schedule? Thanks again,
I love the work you are doing!
I’m trying to use the plugin on hubitat but receive the error,
“Error Verifying Tesla/Powerwall Account. Please verify your Tesla Account username and password.”
I can confirm the password is correct. To play it safe I turned off 2FA.
When looking at logging, I see:
app:3022021-05-15 10:05:07.101 pm errorHttp Get failed: groovyx.net.http.ResponseParseException: Unauthorized
[..]
I’m having exact same issue logging in on new ST android app.. someone please respond.
Thanks
Highbar – Can you verify that you’re running an updated version of the app? It should show at least v0.3 or higher (currently v0.3.0 or v0.3.1) at the top of the app for the work-around for the Tesla auth API change.
I installed latest code 0.3.2. I used the iOS token generator from link and put into Tesla token info. I still get an error not validated with Tesla unauthorized. I also tried the local gateway but received error also. Is there some other instructions that I’m not doing correctly. I’ve had the previous version 0.2 running for almost a year with no issues.
I have (1) a trigger for an action to start at 4PM (mode=self-powered, cost savings, reserve=0) and (2) a charge restriction (charge>=50% -> set mode=self powered, reserve=50%) that expires at 4PM. What is the order of operation for events set for the same time? In my example, will #1 even happen if charge is > 50%?