Introducing the Powerwall Manager SmartApp for SmartThings (and Hubitat) Hubs
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.
Update 10-Jan-2020: The latest version v0.2.0e.20200110 of the Powerwall Manager smart app adds initial (basic) cross-platform support for the Hubitat Elevation Home Automation hub
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 (added 13-Aug-2019)
- Control:
- Set Reserve % Level
- Set Operational Mode Status (Backup-Only/Self Powered/Advanced Time Controls)
- Set Optimization Strategy (Cost-Saving/Balanced)
- 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 (added 22-Jan-2020)
- Select smart devices to automatically turn off in the event of a grid outage (added 13-Aug-2019)
- 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 (added 13-Aug-2019)
- Firmware version changes
- Integrates Powerwall status and and controls with the SmartThings Hub and ecosystem
- Supports sophisticated monitoring rules and automated control of Powerwall functions through scripting and rule engines such as the phenomenal WebCoRE.
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”. Selecting the “Raw” button may make this a bit easier.
- 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 Dashboard Device Handler Code, and select “edit->select all” followed by “edit -> copy”. Selecting the “Raw” button may make this a bit easier.
- 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 Classic mobile app on your phone or tablet device, select the Automation -> SmartApps tab
- Scroll to the bottom and select “+Add a SmartApp”
- 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 Classic mobile app “Things” tab.
Instructions for installing on Hubitat
Install the Powerwall Manager App
- Open the Powerwall Manager Smart App code and select edit->select all” followed by “edit -> copy”. Selecting the “Raw” button may make this a bit easier.
- 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 Dashboard Device Handler Code, and select “edit->select all” followed by “edit -> copy”. Selecting the “Raw” button may make this a bit easier.
- 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
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,
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).
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.
I freaking love this, thank you!
You’re welcome! I appreciate the comment.
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.
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….
I’m getting ‘tesla account issue’ on updating my schedule – what did I do wrong?
Are you seeing any other errors such as “Error verifying Tesla/Powerwall account”? You may need to go back into the Account Information section and verify your credentials. If that fails, can you pull up the ‘Live Logging’ tab in the SmartThings IDE and try running through the app settings again – and let me know if there are any suspicious logs there?
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!
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.
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.
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.
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
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.
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,…
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.
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.
Hi, I’ve been having issues since updating to the latest SmartApp & Device Handler.
App connects to Tesla account and installs device however no update in SmartThings App at all 🙁
I found the following error through the SmartApp simulator #
“Site resp error: Failed with status code 404”
Please assist …thanks
Can you pull up the Live Logging tab in the SmartThings IDE and let me know if there are any suspicious logs there? Particularly of interest would be to see exactly what shows up in the Live Logging tab when first installing and configuring the app. You won’t need to re-paste in the code, just re-add the app by hitting the “+ Add a SmartApp” in the SmartThings mobile app SmartApps tab. Pull up the Live Logging tab first before performing the install and make sure to complete hitting all the Done, Next and finally Save prompts. Thanks.
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.
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.
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?
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?
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.
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.
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:51 AM: error Powerwall resp error: Failed to complete. Message was: connection timed out: owner-api.teslamotors.com/205.234.31.120:443 on attempt 2.
11:06:48 AM: error Site resp error: Failed to complete. Message was: connection timed out: owner-api.teslamotors.com/205.234.31.120:443 on attempt 2.
…
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:05:59 AM: debug Gateway not connected
11:05:58 AM: debug device for Powerwall exists
11:05:58 AM: debug Updated
11:04:54 AM: error java.util.concurrent.TimeoutException: Execution time exceeded 20 app execution seconds: 78566916672074 @line -1 (doCall)
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
11:04:34 AM: debug requesting: /api/1/products
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…
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.
Do you have an export or guide to setup the cool Hubitat dashboards for powerwall and solar?
Thanks Darwin! My Powerwall/SmartThings integration is now working with your Smart App on Smartthings again, as of this morning around 5am PDT!
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…
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!
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.
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.
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.
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.
Hi Darwin – thanks for all your work on this app. I read some above about the recent issues with using the PW app with smartthings. It is working for me using smartthings but I can see from the logging that a token refresh is done often. It seems to do this anytime I use my regular Tesla App (car or Powerwall). I see session expired and reauthenticating in the Tesla app and then next time I do a refresh in smartthings, I see :
3b0977ed-8e3e-4b1e-ad39-451a7c6996d5 5:23:12 PM: warn groovyx.net.http.HttpResponseException: Unauthorized
3b0977ed-8e3e-4b1e-ad39-451a7c6996d5 5:23:10 PM: warn Site resp error: Failed with status code 401. Retrying.
3b0977ed-8e3e-4b1e-ad39-451a7c6996d5 5:23:09 PM: warn Site resp error: Failed with status code 401. Refreshing token
It does seem to get a new token after that and it works but eventually breaks my access in the Tesla app causing me to have to log in frequently.
Is this expected behavior and just how it is with the current state of Smartthings?
Thanks,
Mark
Hi Mark – The app will attempt to refresh its token under certain repeated error conditions, but this is not expected normal behavior. Do you see any prior error conditions in the logs that would indicate why the token refresh is being attempted? Is there anything specific you are doing with the Tesla app that appears to trigger the problem? I admittedly haven’t been monitoring my SmartThings instance of this since I verified it was working again after the SmartThings server issues appeared to resolve themselves about a month ago. Thanks for bringing it to my attention. I will investigate further.
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.
Any plan to move from classic or new smart things app seems classic is dead as of today rip
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.
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.