This is my home monitoring setup repo.
A few goals.
- Monitor Powerwall battery charging
- Alert at certain levels
- Monitor my indoor thermostat temperature over time and compare to weather forecast
- Optimize when to turn on the AC when there is enough solar generation to offset its use
- Pre-cool the house
The first thing is to decide which home automation software to run. Two I'm considering.
- Homeassistant
- Homekit with Homebridge
-
Set up secure remote connections - ssl, duckdns, etc. - see (839) Home Assistant 101: Setting up Remote Access - YouTube
-
Backup the server
-
Set up battery alerts
-
Set up energy dashboard once Tesla fixed - here's how Using Tesla Powerwall Data on the HA Energy Dashboard - Third party integrations - Home Assistant Community
Done
- Set up companion app
- Move Home Assistant to Mac mini
You run this as a server and it can run without a hub like Homekit requires. Has great out of the box functionality and a ton of integrations. There's an iOS app which I haven't set up yet.
Good background: Which Installation Method is Best for Home Assistant? – Siytek
This was the best tutorial I found to install. To install as a VM on a mac (hard)
Refer to installation guide here: Run Home Assistant on macOS with a Debian 12 Virtual Machine – Siytek
Original article I used replaced by above: How To Install Home Assistant Supervised on Mac OS – Siytek
Note there may be updates here: home-assistant/supervised-installer: Installer for a generic Linux system
Other options reviewed To install natively on a mac (easy, but didn't work and no addons) - How To Install Home Assistant On Mac OS – Siytek - But you miss the Home Assistant Supervisor and its features Official install docs which require understanding VM's (hard) - MacOS - Home Assistant
It uses UTM | Virtual machines for Mac which is very cool. UTM has lots of Mac friendly features. Even AppleScript Scripting | UTM Documentation!
- Set networking to Bridged (Advanced)
- In your VM run
ip addr | more
to get the internet ip address
On networking: UTM Networking Mac M1 - YouTube
- Shared Network (NAT) - can connect out to the WAN but can not be connected to
- Host Only - No connection to the WAN or host network. But can communicate between VMs on the machine with ssh.
- Bridged (Advanced) - select virtio-net-pic. Get IP from your host network.
More references
- Network | UTM Documentation
- Virtual Box vs. UTM: Run Virtual Machines on Your Apple Silicon M1 Mac
- Debian 11 + Rosetta | UTM Documentation
Ideally I'd run as a service in the background, but choosing to do it as a login item as that's easier for me following these instructions - Remote Control | UTM Documentation.
Headless can run in the background Headless | UTM Documentation, but I don't want to have to login via ssh. Interseting ideas here too. [MacOS] Start VM Headless/In Background · Issue #2280 · utmapp/UTM
- Install the app
- Enter server address manually if not found
You can run the companion app on your Mac and it has sensors you can use for automation! It lets you add widgets and buttons to trigger actions that get sent to Home Assistant. See details here: Getting started with the home assistant app for MAC os | JuanMTech
Refer to installation guide here: Run Home Assistant on macOS with a Debian 12 Virtual Machine – Siytek
Original article I used replaced by above: How To Install Home Assistant Supervised on Mac OS – Siytek
brew install --cask utm
UTM | Virtual machines for Mac macOS | UTM Documentation
Start UTM Drag VM image into UTM interface
see info in this article here Configuring Bridged Mode Networking
This is likely already configured for the VM as it’s a he VM file. It should be set to "Bridged (Advanced)."
Make sure it's on the right Ethernet interview. You can find them listed running this command
networksetup -listallhardwareports
Check the vm's ip address with
hostname -I
or
ip addr | more
-- give more info on IP address
go to http://:8123 in browser login with homeassistant login it will take some time for Homeassistant to start up again
see section below on Cloudflare setup it should automatically come up
Remote Control | UTM Documentation.
- Find or create a shortcut to start the vm. I have one named "Home Assistant" which is my VM name already.
- Select add to dock
- Show in Finder
- Drag the item to the login items in system preferences
- shutdown the home assistant server
- remove the login item shortcut from system preferences.
As root
reboot now
- reboot vm
shutdown
- shutdown
Getting started with the home assistant app for MAC os | JuanMTech (838) HOW TO Connect Home Assistant to Apple Homekit - YouTube
Important security setup recommendations. 5 ESSENTIAL Tips for Security on Home Assistant - YouTube
Devices to configure
- Tesla Powerwall
- Honeywell Thermostat
- Samsung TV
- Vizio TV - note working yet; see info in VIZIO SmartCast - Home Assistant and raman325/pyvizio: Python client for Vizio SmartCast
- Xbox - see Xbox - Home Assistant
- Google Cast - Home Assistant
Top Add Ons to install
- File editor
- Log Viewer
- Grafana - addon-grafana/grafana/DOCS.md at main · hassio-addons/addon-grafana
- InfluxDB
- JupyterLab
- Glances
Integrations to consider
-
Google Drive
-
Local Calendar
-
Package tracking - How To Install Mail and Packages Integration Home Assistant - Smart Home Pursuits
The Best Home Assistant Addons And Repos Of 2023 - Gadget-Freakz.com
Great article outlining options: Home Assistant Backup Methods & Best Practices - SmartHomeScene
For me it's OneDrive using lavinir/hassio-onedrive-backup
- Navigate to Settings > Add-ons > Add-on Store
- Click the three dots in the top right corner and select Repositories
- Add the following repo: https://github.com/lavinir/hassio-onedrive-backup
- Click Add than Close
Other info: How do I back-up Home Assistant? – Maartendamen.com
Cloudflare tunnel approach The Easiest Free Way To Do Home Assistant Remote Access! - YouTube brenner-tobias/ha-addons: Repository for Home Assistant Add-Ons How tos · brenner-tobias/addon-cloudflared Wiki
General tunnel creation instructions
- You Need to Learn This! Cloudflare Tunnel Easy Tutorial - YouTube
- How to use Cloudflare Tunnel in your Homelab (even with Traefik) - YouTube
Great additional advice on the risks of Cloudflare tunnels
TODO: look into stronger authentication approaches for the tunnel.
Dynamic DNS + port forwarding approach (not recommended) Home Assistant Remote Access for FREE - DuckDNS + LetsEncrypt + Single URL - YouTube Home Assistant 101: Setting up Remote Access - YouTube
Great video on creating a dashboard - easy vs hard
Tutorials and info Create a Basic Automation in Home Assistant Easy home Assistant Notifications using Alerts! - YouTube I was wrong about Home Assistant Automations - YouTube 5 Home Assistant Built-In Integrations You Probably Should be Using - YouTube Easy Notifications with Alerts — Slacker Labs HOW TO Connect Home Assistant to Apple Homekit - YouTube Getting started with the home assistant app for MAC os | JuanMTech See types of triggers at Automation Trigger - Home Assistant
Running automation every time period - use time pattern - How Do Time Patterns Work in Home Assistant - Home Automation Insider
- "/30" is every half hour; must be like cron patterns - Time_pattern every full and half hour - Configuration - Home Assistant Community
- Use template editor in dev tools - Add sensor value to notification message - Share your Projects! / Dashboards & Frontend - Home Assistant Community
Finding your variable - use dev tools and look at states. You can test code in Templates. Example here is the powerwall charge state class. Call its state to get the charing percentage. See State Objects - Home Assistant for attributes. {{states.sensor.sensor-name.state}} {{states.sensor.powerwall_charge}} {{states.sensor.powerwall_charge.state}}
Example: {{states.sensor.powerwall_charge.name}} is at {{states.sensor.powerwall_charge.state}} {{states.sensor.powerwall_charge.attributes.unit_of_measurement}} {{states.binary_sensor.powerwall_charging.name}} is {{states.binary_sensor.powerwall_charging.state}} ({{states.sensor.powerwall_battery_now.state}} {{states.sensor.powerwall_battery_now.attributes.unit_of_measurement}}) Result: Powerwall Charge is at 58 % Powerwall Charging is on (-2.29 kW)
The Raycast Store: Home Assistant plugin allos you to control Home Assistant from the Raycast app. It provides a clean interface to view entities, trigger automations, and more.
It is extremely slow loading via the extrenal URL, so configure access via the local URL. Otherwise follow the instructions included with the plugin.
You can search entities and even change them. For example I can increase or decrease the thermostat by 0.5 degrees.
When configuring any energy cards with Tesla sensors these mean the following:
-
Now - current energy usage (+ or -)
-
Export - energy the device is outputting
-
Import - energy the device is consuming
-
Powerwall Battery = battery
-
Powerwall Solar = solar
-
Powerwall Site = grid (i.e. energy using or exporting to the grid)
-
Powerwall Load = Home (i.e. the load from your home)
battery: entity: sensor.powerwall_battery_now state_of_charge: sensor.powerwall_charge display_state: two_way grid: entity: sensor.powerwall_site_now solar: entity: sensor.powerwall_solar_now display_zero_state: true home: entity: sensor.powerwall_load_now
From Using Tesla Powerwall Data on the HA Energy Dashboard - Third party integrations - Home Assistant Community Here’s what I did after upgrading to Home Assistant 2019.9 45
- Grid Consumption: Powerwall Site Import
- Return to grid: Powerwall Site Export
- Solar Production: Powerwall Solar Export
- Home Battery Storage:
- Energy going in to the battery (kWh): Powerwall Battery Import
- Energy coming out of the battery (kWh): Powerwall Battery Export
More info on Powerwall
- Tesla Powerwall - Home Assistant
- Tesla Powerwall and Home Energy Management - Configuration - Home Assistant Community
- Solar battery run time till empty - Configuration - Home Assistant Community
- Search results for 'powerwall' - Home Assistant Community
Best power distribution card I've found. Requires HACS. ulic75/power-flow-card: A power distribution card inspired by the official Energy Distribution card for Home Assistant
Forecast.Solar - Home Assistant
- Put in the kW capacity of your solar system in watts.
- To calculate your azimuth see - find_your_azimuth [Forecast.Solar]
- suncalc.org azimuth for me is 66.88
- Openstreet Maps azimuth for me is 303 but I think I did this wrong
- declination - got from my Tesla plans - 18
Recommend National Weather Service Use any number for the API key - reference: NWS Integration API Key - Where to obtain ley? - Configuration - Home Assistant Community
Take a look at the additional cards here: lovelace-mushroom/docs/cards/template.md at main · piitaya/lovelace-mushroom
- How to theme home assistant | JuanMTech
- Install hacs in home assistant for themes and custom cards | JuanMTech
- Set up an alarm system with home assistant and alarmo | JuanMTech
Automations to explore
- Howto: Notify me when users arrive or depart my Home zone - Configuration - Home Assistant Community
- To your mobile device if the companion app is installed
- SendGrid - Home Assistant - free 100 mails/day
- in browser - HTML5 Push Notifications - Home Assistant
- Email SMTP server - Can Home Assistant Send Email? – Siytek
- ClickSend SMS - Home Assistant
sensor.powerwall_charge
There is no official integration for Nintendo Switch but these seem promising/interesting.
- New Integration: Nintendo Switch - Feature Requests - Home Assistant Community
- Nintendo Switch App Sensor - Track for example your Ring Fit Activity - Share your Projects! - Home Assistant Community
- Samuel Elliott / Nintendo Switch app APIs · GitLab
Mastering Home Assistant Templates: A Beginner's Guide - YouTube Mastering Home Assistant Templates: Intro to Date and Time - YouTube
-
Great tutorials are here: Home Assistant – Siytek
-
Home Assistant Beginner’s Guide: Setting up Home Assistant - Explains different Home Assistant parts
-
Tesla Powerwall and Home Energy Management - Configuration - Home Assistant Community
-
Solar battery run time till empty - Configuration - Home Assistant Community