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
Tesla has just added the option of Open-Source Tokens to the fleet API, where applications can get client IDs that do not have an associated client secret. That’s presumably what prevents/prevented this project from moving off the API that’s sunsetting; I would suggest registering the app and switching to the Fleet API in the near future.
V0.3.83 restores Backup-Only mode as a scheduler option (with a deprecated warning message).
Powerwall Manager V0.3.82 is now available with the following changes:
Edit (16-Feb): Corrected Backup-Only typo
Is it the set mode Backup-Only that’s removed?
I find this mode useful as the Powerwall will charge at 3.6KW with this mode, with the self-powered mode it will only charge at 1.8KW.
I get mixed length time periods of cheap rate electricity so use Backup-Only during the shorter periods as self-powered mode won’t put enough capacity in the battery.
I removed Backup-Only as an GUI option for new/updated schedules only. Current schedules should still execute as they did before and the command is currently still available via the device command.
That is interesting though that this could providing a capability otherwise not available; Tesla removed Backup-Only several years ago and changed systems that were set to Backup-Only to Self Powered with Backup Reserve at 100 percent.
If you’re still finding it useful, I can keep it as an option in the scheduler (maybe with a deprecated warning). I am a little wary of commanding an unsupported mode though. When I just tested, it appeared to put the mobile app in an odd state and I no longer had the option to set Self-Powered/TimeBased control. I had to kill and restart the mobile app to get those options back after first changing back to Self-Powered from PWM.
Hi!
Please advise if the Time EST changes to EDT or if it is always EST? I am in the UK and need to account for the GMT to BST change.
Hi Bob – I believe if your local time zone in Hubitat (Main page->Settings->Hub Details) is set to “Europe/London – Greenwich Mean Time”, the DST change should be handled automatically. I’m in Arizona where we don’t do the daylight savings time thing, so I haven’t actually observed whether this is working appropriately in PWM. Maybe someone can jump in here if this hasn’t worked for them in the past…
Hi! Eric,
Thank you for your reply. I have checked the hub and it was set to EST so I have now changed that to GMT. I have set the times in your app in GMT now and will monitor it?
I think the hub must have been a US hub that I purchased second hand as it was set to EST.
I am very new to this and still very much learning. Thank you for your help.
Regards
Bob.
Yes – times in the scheduler should be local time based on the time zone set in the Hub details settings page – and they should adjust accordingly to that time-zone’s DST schedule. Yep, I’d monitor now and/or set a test schedule to verify the time zone change was applied. I know Hubitat recommends a reboot after updating your time zone.
Hi! Eric,
All the schedules ran fine since the change of time zone. I will keep an eye on it and watch out for the change to BST to ensure this all goes through correctly.
Regards
Bob.
Hi!
I have tried to use the Powerflow Tile. However. This appears not to work? I have attached a picture of what is displayed. Any ideas?
I haven’t seen this one before, but each browser I’ve tried behaves differently. Not sure if you’ve attempted this, but after a change made by Tesla a while ago, in order to display the power flow animation, you need to log in to the gateway from the browser/device used for your dashboard. This can be done from the dashboard iFrame tile itself or by entering the gateway url on another tab in the same browser.
Fully Kiosk Browser doesn’t appear to have an issue with this using the default security settings, and the last time I checked, either did Firefox. Safari required accepting of a self-signed certificate exception on the log in page, and also required “prevent cross-site tracking to be disabled. (I wish Safari would allow you to disable this on a per site basis). Unfortunately, I haven’t found a way to to get Chrome to work since Tesla added the log-in requirement.
Are you able to scroll down/dismiss this and log in to the gateway in the tile itself?
Hi!
I am using Chrome. I have tried putting the I.P. address into Firefox and it still gives me the same screen. It appears that Tesla must have changed something. Would there be a difference between UK and US ? I have also opened the Hubitat Desk top in Firefox and I get the same. Maybe Tesla have set this as an output.
Hi,
Anyone noticing that we cannot seem to set the reserved levels any more via the integration? No errors, it just ignores any changes that are set. Has been working fine even yesterday, just stopped working this morning onwards.