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
  • 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

Tesla PowerWall SmartThings Control
Tesla PowerWall SmartThings Control

Powerwall Manager Dashboard on Hubitat

Example Hubitat dashboard with Powerwall Manager Gateway powerflow tile

Example Powerwall Manager Dashboard running on the Hubitat Elevation Hub

Installation Instructions

The instructions below assume you have basic familiarity with Hubitat or SmartThings Groovy IDE custom code installation techniques.

Instructions for installing on SmartThings

Install the Powerwall Manager Smart App

  1. Open the Powerwall Manager Smart App code and select edit->select all” followed by “edit -> copy”.
  2. Navigate to the SmartThings IDE “My Smart Apps” tab
  3. Select “+ New Smart App” (upper right)
  4. Select “From Code”
  5. Paste in the Powerwall Manager Smart App code and select “Create” at the bottom
  6. Select “the Publish” button and select “For Me”

Installing the Powerwall Device Handler

  1. Open the Powerwall Manager Device Handler Code, and select “edit->select all” followed by “edit -> copy”.
  2. Navigate to the SmartThings IDE “My Device Handlers” tab
  3. Select “+Create New Device Handler” (upper right)
  4. On the “Create New Device Handler” page, select the tab “From Code”.
  5. Paste in the code for the Powerwall Manager Dashboard Device Handler code and click the “Create” button at the bottom
  6. Click the “Publish” button and select “For Me”.

Activate the Powerwall Manager Smart App from the SmartThings Mobile App

  1. From the SmartThings mobile app on your phone or tablet device, select “+” -> “Add  Routine” -> “Discover”
  2. Scroll to the bottom and select “My Apps”
  3. Select “Tesla Powerwall Manager” from the list
  4. Scroll through each of the setting options and menus and select “Save” when done. You can always go back and add/change your settings.
  5. 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

  1. Open the Powerwall Manager App code and select edit->select all” followed by “edit -> copy”.
  2. Navigate to your Hubitat “<> Apps Code” tab
  3. Select “+ New App” (upper right)
  4. Paste in the Powerwall Manager Smart App code and select “Save” at the upper right

Installing the Powerwall Device Driver

  1. Open the Powerwall Manager Driver Code, and select “edit->select all” followed by “edit -> copy”.
  2. Navigate to your Hubitat “<> Drivers Code” tab
  3. Select “+ New Driver” (upper right)
  4. 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

  1. Navigate to your Hubitat Apps tab
  2. Select “+ Add User App” at the upper right
  3. Select “Tesla Powerwall Manager” from the list
  4. 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.
  5. 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