- Introduction
- Revision Log
- Screenshots
- Credits and Acknowledgments
- INSTALL INSTRUCTIONS
- Automation Function Summary
- User Requirements
- Future Dev Work
- Problems Found During Development
- Equipment Used During Development
This started out as a Home Assistant project to create a UI to control my Solax inverter locally. It's now a project to automate the contol of the my Solax inverter, Zappi EV charger and Octopus Energy interactions including Octoplus Saving Sessions and Free Electric sessions. The idea isn't entirely new (see credits below) but the project now goes beyond my original idea and now provides the opportunity to automatically contol for scenarios (decribed in the requirements below).
The project is split into 3 parts:
- The first part is to simplify previous efforts by Kamil Baczkowicz into a single Home Assistant Package (with some updated parts).
- config/packages/solax.
- The second, is to create an interactive dashboard/ui to control how energy is used with Octopus Energy and Zappi EV charger.
- config/packages/solax_zappi_octopus
- Automations 5001-5005
- Dashboard Solax & Octopus Settings.yaml
- The third part provides integration with Octoplus Saving Sessions and Free Electric Sessions.
- config/packages/octopus_saving_sessions
- Automations 6001-6002
- Dashboard Octopus Saving Sessions.yaml
Version | Date | Files updated | Description |
---|---|---|---|
v2.1.4 | 29/1/25 | packages/octopus_saving_sessions/input_boolean.yaml packages/solax_zappi_octopus/templates.yaml All automations Octopus Saving Sessions.yaml (Dashboard) |
1. Added new controls to Saving Sessions Dashboard to attempt to get a dispatch during battery prep and also attempt to get a dispatch straight after session. 2. Updated EV Start Time logic 3. Renamed all automations |
v2.1.4 | 28/1/25 | packages/solax/templates.yaml | Improved resilience to sensors reporting defaults/template warnings in logs due to invalid/empty rest responses. |
v2.1.3 | 23/1/25 | packages/octopus_saving_sessions/input_datetime.yaml packages/octopus_saving_sessions/input_number.yaml packages/octopus_saving_sessions/templates.yaml packages/solax/templates.yaml packages/solax_zappi_octopus/templates.yaml automation 600x.yaml removed automation 6001.yaml added automation 6002.yaml added dashboard/Solax & Octopus Settings.yaml added dashboard/Octopus Saving Sessions.yaml |
1. Fixed bug with free electric 2. Fixed bug with battery in from solar calcs 3. Enhanced Octopus Saving Session Options with prep time and prep SoC with checks to stop charging when the target SoC is reached 4. Tidier Notifications |
v2.1.1 | 19/1/25 | packages/solax_zappi_octopus/templates.yaml | 1. Fixed bug with tariff select |
v2.1 | 19/1/25 | All | 1. Revised Dashboards 2. Added Battery Warming controls 3. Added Mobile Notifications 4. New template sensors to switch utility meter tariffs peak/offpeak 5. General bug fixes in template sensors |
The Solax interactions are possible due to work published by @Colin Robbins and @Kamil Baczkowicz. I've tried to simplify things by putting their work into a package. Essentially it becomes a building block for my automations and dashboards. Suggested reading:
- https://community.home-assistant.io/t/solax-x1-hybrid-g4-worked-example/499362
- https://community.home-assistant.io/t/automated-octopus-saving-sessions-with-solax-x1-hybrid-g4/654502
- https://community.home-assistant.io/t/solax-x1-hybrid-g4-local-cloud-api/506172
- HACS
- Octopus Energy (by bottlecapdave) v13.5.0
- Myenergi
- Uptime
- Powercalc
You must edit and replace instances of Zappi number, Solax registration number, Octopus account details & IP address :
- automations.yaml (automation files need to be cut and paste into your single automation.yaml)
- templates.yaml
- secrets.yaml
- Dashboards
- Solax & Octopus Settings.yaml
- Octopus Saving Sessions.yaml If you have previous used similar Solax automations/config be aware that some rest_command names may have changed. Feed in priority options have been added. Also be aware that some entities have been added in templates.yaml
- In the solax package templates.yaml you must adjust the battery size to your battery size and set a flag indicating where your solax CT clamp is. (notes are in the yaml)
- Copy the contents of Solax & Octopus Settings.yaml
- Replace zappi_XXXXXXXX with your Zappi number
- Replace z_ZZZZZZZZ with your Octopus account number
- Open Home Assistant
- Open Overview dashboard
- Click Pencil icon in top left
- Click + to add a new dashboard
- New window opens, click the 3 dots in top left corner
- Select Edit in Yaml
- Replace the contents with your prepared yaml
- Click Save
- Click Done
Automations can take a long time to run. I wish it could be made to be more snappy but the rest_commands aren't reliable. The automations make use of an input_boolean.solax_automation_running set to true to indicate in the UI (and to other automations) that an automation is running. Please be patient and wait for the input_boolean to go off before assuming the automation failed. On the dashboard it should turn red whilst something is running.
- Manages the inverter behaviour when Zappi is plugged/unplugged/charging.
- Exports Solax battery on demand or daily during offpeak periods down to 20% SoC.
- Creates Events that can be notified with 5005.
- By selecting "Full Octopus Control" in the UI, as soon as an EV is plugged in Octopus should provide a dispatch.
- By selecting "Solar Export Priority" in the UI, Zappi won't be controlled by Octopus until the sun is below a configurable elevation.
- If neither "Full Octopus Control" or "Solar Export Priority" is on then Octopus won't start control until a configured time.
- "Intelligent Charge Target" amount of energy % of car battery size to be dispatched by Octopus.
- "Intelligent Target Time" target EV ready time.
- "Intelligent Smart Charge" Indicates if Octopus is in control of charging (leave alone and let automation work)
- "myenergi zappi-XXXXXXX Charge Mode" Zappi Mode - (leave alone and let automation work)
- "Use Grid During Octopus Dispatch" Use this option to use the grid rather than battery when Octopus dispatching (this can be true in off peak hours).
- "Prevent Zappi Draining Battery" Use this option if the CT clamp is positioned in a place that sees Zappi load and consequently discharges the house battery into the EV.
- Solax defaults - set default work mode, Charge to SoC & Min Soc. These values are used to return inverter to some defaults after a battery discharge or EV charge session.
- Monitors the battery SoC and stops the discharge at target SoC
- Triggered whenever a force discharge is in progress
- Multiple target SoC can be set for different scenarios
- Free electric preparation
- Saving Sessions
- Daily Exports
- Manual Exports
- When user uses the UI to change a Solax setting rest_command is used to set that option on the inverter.
- Patience is key when changing options. Alter one at a time and wait for the red roboot to go off.
- Sets the UI options based on whats set on the inverter.
- Triggered whenever a change occurs on the inverter (whenever input_boolean.solax_automation_running changes to off).
- Triggered every 15 minutes.
- Sends notifications based on Events created in automations.
- Can be turned off by using input_bool.solax_zappi_octopus_control_notifications.
- Use the UI to set the day and times of the free electric.
- Use the UI to set the target battery SoC.
- Use the UI to set when the battery should discharge (usually early in morning just in case it's sunny later).
- UI can be used to use the target battery SoC as the "charge to SoC" if you don't wish to export battery.
- The automation will set the Zappi to FAST during free electric period.
- Template Sensor is required for this to work - sensor.octopus_is_there_a_saving_session_today.
- Automatically joins a session.
- Allows for joining manually.
- Allows for setting a target battery discharge SoC.
- Allows for setting Prep charge to SoC
- Allows for setting of Prep time
- Checks if prep SoC is reached and stops charging
- Prepares the by charging the battery at peak rate or tries to get an Octopus dispatch if Zappi is connected and charges the battery.
- During saving session the zappi is stopped and battery is discharged.
- After saving session a dispatch is requested if Zappi is connected.
- Control all Solax G4 Inverter settings locally.
- Optionally Prevent Solax battery discharging when Zappi is charging EV.
- Option needed as depending on where the CT clamp is placed Zappi loads will be seen by inverter
- Optionally always use grid during Octopus Dispatch.
- Optional but suggest its always on if you intend to maximise Battery Export when tarrifs are favourable
- Optionally export Solax battery to grid on a daily basis somewhere in off-peak.
- EV cant be charging.
- Solax battery cant be charging.
- Optionally maximise solar Export by not starting Zappi until the sun has set. Allows users to plug and forget and guarantee the car will charge after sundown.
- Optionally prevent Zappi from starting before a time of day. Allows users a bit of planning to load shift without having to go outside and plug in.
- Facilitate Octopus Free Electric Sessions by:
- Exporting the solax battery before sunrise to a level to reach the Session start.
- User configurable start discharge time.
- User configurable battery target SoC.
- Setting the inverter to Feed In Priority so the battery doesnt fill from solar.
- Setting the start2 and stop2 period.
- Enable second period charge option.
- Set Zappi to Fast mode so EV starts charging.
- Reset Inverter back to a default mode after session.
- Reset Zappi to stopped state.
- Exporting the solax battery before sunrise to a level to reach the Session start.
- Join Octopus Saving Sessions and manage Solax inverter and Zappi:
- Automatically or manually join the session:
- Manual option is for when sessions are announced but not via API.
- Manual option must still be joined via app/web site.
- Manual option allows user to set the start and end manually.
- Before Session:
- Charge the Solax battery just before session.
- Start Zappi if possible.
- During Session:
- Export the Solax battery during the session.
- Stop Zappi during this time.
- Stop Solax battery discharge if target min SoC is reached and return to default mode
- After Session:
- Return inverter to default mode when session ends (if its still discharging).
- Automatically or manually join the session:
- Add functionality to set the 'Charge to Target SoC' dynamically based on a solar forecast. Currently low priority as Octopus offer 15p export rate where import is 7p so it makes sense to dump the battery before charging.
- Add functionality to discharge Solax battery prior to getting an Octopus dispatch. This will be particularly useful in summer months with large EV batteries that have less day light hours to charge overnight whilst maximising solar export during the day
- Zappi relies on a connection to cloud and the API used is sketchy and often reports unknown or unavailable. This is an issue for the main automation which relies on transitions 'From' and 'To' states. To get around this a new sensor was defined for the 'plug status' that remains at the previous known state whilst the API recovers.
- I've seen a Zappi plug status 'Fault' twice during the development. The first time it occurred the Zappi required physical interaction. Myenergi ignored my request of support but googling led me to conclude the fault was due to the connecter interface lead between the main board and the display wasn't properly connected. The second time it recovered and plug status went from 'Fault' to 'Charging'. Both instances occurred whilst attempting to start charging. Whilst I've attempted to account for these scenarios in the automations, no guarantees.
- Solax rest commands are slow and somewhat unreliable, stacking them is tricky, methods to tackle this have already been demonstrated in https://community.home-assistant.io/t/solax-x1-hybrid-g4-local-cloud-api/506172
solax_local_settings_payload and solax_local_realtime_payload sometimes returns empty or 0's in the payload. Not sure how to overcome this but it can cause some unreliability in automations. Even with the loop retry methods employed, failures to correctly set the inverter can slip past the loop protection undetected. An attempt to protect from failures are the delays introduced in the top of the automation variables (saves searching through and adjusting every instance) - Reboots/restarts can trigger the main automation, I've used an integration called "uptime" to check if the last reboot was within last 80 seconds.
- Battery Warming - Even through the official web ui I've seen issues/errors which won't allow the setting times or enabling/disabling the option. The first time I paniced and thought my rest command had broken the inverter so tried rebooting it. This didn't work. After leaving it alone for sometime (about 12 hours) everything was back to normal and settings could be adjusted again. Strange
- Solax X1-G4 Inverter
- Solax 9kWh Battery
- Wired LAN Connection to Inverter
- Wired LAN to Zappi