What's new

[RELEASE] PWRMON v1.2.9 -Feb 7, 2024- Monitor your Tesla Powerwall(s) - Solar - Grid - Home Stats! (New: Weather! SMS/Email Notifications!)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Viktor Jaep

Part of the Furniture
PWRMON v1.2.9
Released February 7, 2024

Executive Summary: PWRMON is a shell script that provides near-realtime stats about your Tesla Gateway/Powerwall2/Solar environment. This utility will show all the current electrical loads being generated or consumed by your solar system, the grid, your home and your Powerwall(s). Electrical transmission flows are accurately being depicted using >> and << types of arrows, as electricity moves between your solar, to/from your batteries, to/from the grid and to your home. In the event of a electrical grid outage, PWRMON will calculate your estimated remaining runtime left on your batteries based on the amount of kW being consumed by your home. Weather has now been incorporated to give you a 3 day outlook on what kind of weather to expect for generation or off-grid consumption due to regional disasters or weather events.

Instead of having to find this information on various different web pages or apps, this tool was built to bring all this info together in one stat dashboard. Having a 'system' dashboard showing current solar, grid, home and powerwall stats would compliment other dashboard-like scripts greatly (like RTRMON or VPNMON-R2), sitting side-by-side in their own SSH windows to give you everything you need to know with a glance at your screen.

PWRMON is free to use under the GNU General Public License version 3 (GPL 3.0).

This project is hosted on GitHub

Changelog here | Jump to latest release | What's new: Feature Level Updates, SMS/Text Notifications, Weather Forecasts, Email Notifications, (P)rev Page + Logs, PW Mode, Reserve and % Remaining added to Large Icon Dashboard, Large Outage/Sync Icon Update, Large Font Dashboard, Initial Release, Added New Page 2 Stats!

Screenshots:

Page 1 -- Yes, this is my pathetic attempt at trying to duplicate the Tesla Gateway flow diagram functionality in ASCII format... :p yeah, LOL
pwrmon-1.25-pg1.jpg


Page 2
pwrmon-1.25-pg2.jpg


Large Font Dashboard Page 3
pwrmon-1.25-pg3.jpg


How is this script supposed to run?​

I would recommend running this script in its own SSH window from a PC that's connected directly to the Asus router, or from a utility like 'Screen', as it loops and checks the various stats every 10 seconds. Instructions:
  1. Download and install directly using your favorite SSH tools, copy & paste this command (or update from within PWRMON):
    Code:
    curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.2.9.sh" -o "/jffs/scripts/pwrmon.sh" && chmod 755 "/jffs/scripts/pwrmon.sh"

  2. Configure it using this command:
    Code:
    sh /jffs/scripts/pwrmon.sh -setup

  3. Run it standalone in an SSH window with this command:
    Code:
    sh /jffs/scripts/pwrmon.sh -monitor

  4. Or, using the screen utility, which has now been built-in:
    Code:
    sh /jffs/scripts/pwrmon.sh -screen

  5. To make things easier, you can now just type the script name itself (without the path/extension), like so:
    Code:
    pwrmon -screen

Do I need to configure anything?​

You can enter the setup screen with the command 'pwrmon.sh -setup' or by hitting the 's' key from within the UI:
pwrmon-1.25-setup.jpg


Hitting the "sc" option, there are currently 9 items you can configure (you can also access this screen by using 'pwrmon.sh -config'):
pwrmon-1.25-config.jpg


Requirements:
1.) This has been written and tested on an Asus RT-AC86U WiFi Router, and should be compatible with the vast majority of Asus routers out there that are compatible with custom Asus-Merlin firmware. Your router must be running custom Asus-Merlin firmware (https://www.snbforums.com/threads/about-asuswrt-merlin-custom-firmware-for-asus-routers.7846/), Entware (installed by running AMTM from an SSH command prompt) and jffs scripts enabled and installed (using the Asus-Merlin router UI -> Administration -> System).

2.) You must have a locally accessible Tesla Gateway device, reachable through your LAN (A Tesla Gateway is a device that monitors and distributes power between your solar, grid, home and batteries. It's very possible to run this setup if you only have batteries, or only have solar, but a Gateway device is still necessary)

3.) You will need to make absolutely sure your email address and password are correct in order to be able to log into your Tesla Gateway. A good way to initially test it is to browse to your Tesla Gateway (ex: https://192.168.45.22 or whatever your Gateway IP is), and making some attempts to log in there there first. Your default password to log into your Tesla Gateway is typically a 5-letter alpha upper-case combination that's found on a sticker inside your Tesla Gateway enclosure. It's also the same password you would use to authenticate to the Tesla Gateway TEG-### Wi-Fi network.

I'm definitely looking for your feedback... what works, what doesn't... what else would you like to see. But all-in-all, as good ideas come up for things to possibly add, very much a WIP (work-in-progress). ;) Lots more stuff to come... I'm looking at adding other power-related stats, as well as good visual indicators showing grid outages, etc.
 
Last edited:
Highlighting some new features... In recognition of major Hurricane Ian, I have integrated a 3 day weather forecast that includes today's current conditions, giving you all necessary info to get a good idea what's going to happen with the weather. This functionality uses a free API from weather.gov, and determines your location from the coordinates of your WAN exit IP to determine the weather for your local region. It will be close, but may not be exactly the weather that is happening on top of your house. Will look into allowing you to add custom longitude and latitude coordinates in the near future.

The first weather forecast page includes current/upcoming conditions, temperature, and wind direction/speed:
pwrmon-1.20-w1.jpg


Ability to see detailed conditions expands on the current and upcoming conditions on the (M)ore Details page, including chances of rain:
pwrmon-1.20-w2.jpg
 
Last edited:
Released v0.1b2... It's been so much fun being an ASCII graphics artist again after so many decades... ;) Will be continuing to refine and add more stats and features over time. Thanks for any suggestions for its continued enhancements!

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-0.1b2.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Changelog:
v0.1b2 - (Aug 7, 2022)
- FIXED:
Main focus is on the UI at this point, and making sure it aligns visually with the stock Tesla app, and is functionally/visually in line. Will be adding more functionality and stats at a later point. ;) Changed up the look/feel of the main UI, and making sure that everything looks the same. I noticed on my first release that there were some differences in the ways that grid, solar and home were being displayed, so now they are more uniform.
 
Have you used Home Assistant at all? It might be worth a look for you as it integrates with a lot of stuff like this and provides options for long term storage of data for analysis (i dump everything into influxdb and visualise it in grafana, for example). It runs on a Pi4 in my network cluster (aka the cupboard under the stairs :D)
 
Have you used Home Assistant at all? It might be worth a look for you as it integrates with a lot of stuff like this and provides options for long term storage of data for analysis (i dump everything into influxdb and visualise it in grafana, for example). It runs on a Pi4 in my network cluster (aka the cupboard under the stairs :D)
Thanks @Jack Yaz ... I have not heard of Home Assistant before. I'll check into it! I did find a nice free powerwall tool that plugs into influxdb/grafana, and have been using that for a few months... It certainly captures a lot of stuff, and looks great, but it's overwhelming, and doesn't resize down nicely... plus I wanted the challenge of building this through a shell script. My Android powerwall app broke somewhere along the way most likely due to constant changes in authentication practices, and just need something simple to display on my tablet dashboard in the kitchen to keep an eye on things. ;)

1659887936195.png
 
Thanks @Jack Yaz ... I have not heard of Home Assistant before. I'll check into it! I did find a nice free powerwall tool that plugs into influxdb/grafana, and have been using that for a few months... It certainly captures a lot of stuff, and looks great, but it's overwhelming, and doesn't resize down nicely... plus I wanted the challenge of building this through a shell script. My Android powerwall app broke somewhere along the way most likely due to constant changes in authentication practices, and just need something simple to display on my tablet dashboard in the kitchen to keep an eye on things. ;)

View attachment 43355
Home Assistant and tablet dashboards, now there's a topic!
 
Home Assistant and tablet dashboards, now there's a topic!
I'm waiting for one of the smart people/persons to start a Pi specific section of the Forums ;)

Casa Griswald only has Tesla Solar Panels and no battery nor charging station. The app provides little/limited info and anything would be an improvement.
 
Last edited:
I'm waiting for one of the smart people/persons to start a Pi specific section of the Forums ;)

Casa Griswald only has Tesla Solar Panels and no battery nor charging station. The app provides little/limited info and anything would be an improvement.
Do you have a Tesla Gateway with this setup? I'd love to know if it works with other configurations. I have 18.9kW of non-Tesla panels in my yard, but 3 powerwall2's + a Gateway.
 
Last edited:
Been a busy beaver today... adding a whole new second page of powerwall/grid/solar/home progress bar statistics. v0.1b3 is ready for evaluation!

v0.1b3 - (Aug 7, 2022)
- ADDED:
Created a 2nd page showing indicators for all of the main functions, solar, grid, home and powerwalls. Each progressbar is measured based on values in the setup, including number of powerwalls, max power generation from both solar, and the max load of your home. Also, calculating a runtime based on current battery percentage and current load on the home. An indicator was also added to show the max load your powerwalls can take based on how many powerwalls you have vs. the load in your home.
- FIXED: Made a modification on the grid ASCII graphic... still not satisfied, but it's getting better.

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-0.1b3.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Screenshots:
pwrmon-0.1b3-p1.jpg

pwrmon-0.1b3-p2.jpg
 
Last edited:
Pleased to release stable v1.0 today! Enjoy!

v1.0 - (Aug 15, 2022)
- Initial release of PWRMON! All bugs and inconsistencies have been resolved as of this first major release, providing the basic functionality of showing powerflows from solar, to/from home, to/from the grid, and to/from your batteries. The secondary page (by hitting the (N)ext key) shows further details using progress bar views. Calculations on expected runtime based on current load is displayed on both pages. All complimentary setup, config, view logs, update and uninstall menu pages are in place.

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.0.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"
 
Been toying around with these large number fonts to make something more useful so I can see what's happening from across the room... so enjoy the new v1.1 out today! :)

v1.1 - (Aug 18, 2022)
- MAJOR:
Added a major feature on the new 3rd page that displays powerflows for solar, grid, home and battery in large font numbers for the purposes of displaying this on a full-time dashboard in your home. The large fonts are especially welcome so you can read what's happening on your local power grid from across the room. Designed to take advantage of cheap 7" tablets or wall touch displays, to provide a suite of monitoring apps (along with VPNMON-R2 and RTRMON) so you can see what's happening in your environment at all times.
- ADDED: Added visual cue notifications on the Power Flow View (page 1) when the grid goes down, or comes back up, but is not in sync yet with your Gateway device.
- FIXED: Minor changes and corrections.

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.1.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Screenshots:
New Page 3 Dashboard View
pwrmon-1.1-3.jpg


New visual indicators when Grid goes down, or comes back up but is not in sync yet:

pwrmon-1.1-outage.jpg

pwrmon-1.1-sync.jpg
 
New release v1.12 is out there today! Enjoy!

What's new?
v1.12 - (August 24, 2022)
- FIXED:
Minor logic changes to successfully use API values coming from the Gateway in order to show Grid down/resyncing messages.
- ADDED: Grid down/syncing indicators in the large font view (page 3), switching icons to red, giving user proper notification when these events happen.

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.12.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Sample Screenshots:

Normal vs Grid Outage vs Grid Syncing

1661360584743.png
pwrmon-1.12-lgicons1.jpg
pwrmon-1.12-lgicons2.jpg
 
Last edited:
New release v1.12 is out there today! Enjoy!

What's new?
v1.12 - (Aug 24, 2022)
- FIXED:
Minor logic changes to successfully use API values coming from the Gateway in order to show Grid down/resyncing messages.
- ADDED: Grid down/syncing indicators in the large font view (page 3), switching icons to red, giving user proper notification when these events happen.

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.12.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Sample Screenshots:

Normal vs Grid Outage vs Grid Syncing

View attachment 43804 View attachment 43802 View attachment 43803
Can you say wow? I know I can. Great work! Your latest script mods has definitely increased my terminal play time.
 
Some small but helpful changes coming your way with PWRMON v1.15 available today! Enjoy!

What's new?
v1.15 - (August 31, 2022)
- FIXED:
Enhanced some of the look/feel to match the overall colors/theme of the app
- ADDED: Included current battery configuration mode, ie. backup, self-powered, and time-based, as well as the percentage of backup reserve that is currently configured.
- ADDED: Now displaying the % battery remaining on the large font dashboard view (page 3)

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.15.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Screenshots of changes:
Powerwall mode and reserve amounts now showing on the main page (1).
pwrmon-1.15-pg1-info.jpg


Percent battery remaining now showing on the large font dashboard page (3)
pwrmon-1.15-pg3-icon.jpg
 
Minor release today to v1.16 to add a few new enhancements!

What's new?
v1.16 - (September 10, 2022)
- ADDED:
Capability to go to a (P)revious page like on RTRMON. You can now flip back and forth between pages, instead of having to run through them all to get to the same point. Yey!
- ADDED: Logging entries for grid outage and grid syncing events. Depending on the length of your outages, initially, you may want to keep track of the size of your pwrmon.log file, and delete lines as necessary. I will be building in a trimming function at a later date.

Download
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.16.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Significant Screenshots:
1662815494763.png
 
Last edited:
Releasing v1.18 today... enjoy!

What's new?
v1.18 - (September 19, 2022)
- ADDED: Email notification capabilities
for major grid events: Down, Syncing or Return to Normal. Added the necessary setup menu items to record TO:, FROM:, SMTP Server, SMTP Port, Password, etc. Please note, this has only been tested on SSL SMTP connections, like smtps://smtp.gmail.com on port 465. I can add other methods of authentication if requests are made. Please note #2, in order for you to make use of a service like gmail in a case like this, you will need to obtain an "app password" to provide the necessary authentication using this method. And note #3, your smtp password is encrypted and saved in a config file that resides locally on the router under /jffs/addons/pwrmon.d/pwrmon.cfg, however, please know that due to the security constraints on these types of routers, I would still consider this to be an unsafe method of storage, and could still very easily be compromised by someone who knows what they're doing. Only use non-essential email accounts to send or receive these emails so you don't risk a primary account compromise!
- CHANGED: The behavior of the "pwrmon -screen" command, so that when you execute this commandline parameter, it first will look for orphaned screens and wipe them... then, it will launch PWRMON into a new screen environment, and connect to it. This skips the original behavior where it drops back to a command prompt, and asks the user to connect to the PWRMON screen by requiring the user to run the "screen -r pwrmon" command. If a screen session is already running, and you type "pwrmon -screen", it will then connect to this screen session without requiring any user input. Thanks much to @TITAN for the great suggestion!

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.18.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Significant Screenshots:
On the main page (1), a new visualization of the Powerwall Config, showing charge, email alerts, PW mode, and reserve power
pwrmon-1.18-1.jpg


From the setup screen, the new options available to configure your powerwall email notifications!
pwrmon-1.18-2.jpg
 
Releasing v1.18 today... enjoy!

What's new?
v1.18 - (September 19, 2022)
- ADDED: Email notification capabilities
for major grid events: Down, Syncing or Return to Normal. Added the necessary setup menu items to record TO:, FROM:, SMTP Server, SMTP Port, Password, etc. Please note, this has only been tested on SSL SMTP connections, like smtps://smtp.gmail.com on port 465. I can add other methods of authentication if requests are made. Please note #2, in order for you to make use of a service like gmail in a case like this, you will need to obtain an "app password" to provide the necessary authentication using this method. And note #3, your smtp password is encrypted and saved in a config file that resides locally on the router under /jffs/addons/pwrmon.d/pwrmon.cfg, however, please know that due to the security constraints on these types of routers, I would still consider this to be an unsafe method of storage, and could still very easily be compromised by someone who knows what they're doing. Only use non-essential email accounts to send or receive these emails so you don't risk a primary account compromise!
- CHANGED: The behavior of the "pwrmon -screen" command, so that when you execute this commandline parameter, it first will look for orphaned screens and wipe them... then, it will launch PWRMON into a new screen environment, and connect to it. This skips the original behavior where it drops back to a command prompt, and asks the user to connect to the PWRMON screen by requiring the user to run the "screen -r pwrmon" command. If a screen session is already running, and you type "pwrmon -screen", it will then connect to this screen session without requiring any user input. Thanks much to @TITAN for the great suggestion!

Download:
Code:
curl --retry 3 "https://raw.githubusercontent.com/ViktorJp/PWRMON/master/pwrmon-1.18.sh" -o "/jffs/scripts/pwrmon.sh" && chmod a+rx "/jffs/scripts/pwrmon.sh"

Significant Screenshots:
On the main page (1), a new visualization of the Powerwall Config, showing charge, email alerts, PW mode, and reserve power
View attachment 44300

From the setup screen, the new options available to configure your powerwall email notifications!
View attachment 44301
o_Oo_Oo_Oo_Oo_Oo_Oo_Oo_O
You(or that cat) has done it again. And you even ENCRYPTED, that password. Let me know if you need to add some SALT to that encryption. I can show you the ways of the python.....


@Viktor Jaep , beautiful work man!.
 
o_Oo_Oo_Oo_Oo_Oo_Oo_Oo_O
You(or that cat) has done it again. And you even ENCRYPTED, that password. Let me know if you need to add some SALT to that encryption. I can show you the ways of the python.....


@Viktor Jaep , beautiful work man!.
Sounds pretty "salty"... LOL! :D
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top