fboundy / ha_solis_modbus

YAML file for reading Solis Hybrid Inverter directly with HA native modbus
MIT License
50 stars 7 forks source link

ha_solis_modbus

Home Assistant YAML for Solis Hybrid Inverter using MODBUS

This forked from https://github.com/fboundy/ha_solis_modbus and includes automations to estimate an overnight target SOC to ensure enough power to run your house until the sun comes out while also leaving maximum space in your battery for energy capture.

Fill in the three input numbers for charge, and set your usable battery capacity and solar prediction entity_id in the template sensor.

Requires forcast.solar integration: https://www.home-assistant.io/integrations/forecast_solar/

I have also added support for Discharging - can be used for Flux to discharge at peak times, for Octopus saving sessions. I also use this to dump excess enegry into my EV overnight. It works exactly as the charging. Fill in the inputs for start and stop times and target SOC, the automations do the rest!


This is a Home Assistant YAML file for communicating with a Solis Hybrid inverter using a Data Logging Stick which uses pure Modbus over TCP. It has been tested using a Solis 5-eh1p(3-6)k inverter and:

The S3-WIFI-ST stick will NOT work.

v1.1.0 now also supports writing to the inverter using a number of Automations. Scripts and Inputs.

Reading from the Inverter

The YAML file which can be included in the configuration.yaml file in the Home Assitant config folder. All that should need changing is the solis_ip secret which is included from secrets.yaml. Alternatively just overwrite with the IP address.

Scan intervals are set as follows:

Include this file in your configuation.yaml file with:

modbus: !include solis.yaml

Within this file you need to set the TCP port that MODBUS uss depending on the model of Data Logging Stick:

port: 8899 for the older DLS-LAN stick or port: 502 for the newer S2-WL-ST stick.

A fairly comprehensive set of both the input registers (33xxx) and holding registers (43xxx) is read. Other registers can be imported using the same format. A full list can be found here courtesy of Dr. Brian Coghlan. Note that some parameters are 32 bit and span two registers. Also note that 16 bit parameters can be signed (int16) or unsigned (uint16). More information on the Home Asistant Modbus integration can be found here.

Writing to the Inverter

This is done with a service call to the modbus integration. For example, to set the Timed Discharge Current Limit (register) to 50A:

service: modbus.write_register
data:
  address: 43141
  slave: 1
  value: 500
  hub: solis

The following scripts are included in scripts.yaml to assit with this:

Template Sensors

There are also a number of template sensors some of which are just helpers but others are needed for some of the scripting below and rely on certain input entities (see below). These are included in a separate file solis-templates.yaml these can be included into your configuation.yaml file with the below. Alternatively you may wish to merge them into the file directly:

template:
  !include solis-templates.yaml

Inputs

A number of helpers are needed for the scripts and automations included below. These are included in inputs.yaml. As with the other .yaml files they need to be either merged or included into your configuation.yaml. The inputs are as follows:

Utilities

Also included is a small Python script pymodbus_test.py 2hich will check modbus communications and, if all is well, will report back Inverter Temperature, Grid Voltage and Battery SOC:

Inverter Temperature:     30.3 C
Grid Voltage:            243.3 V
Battery SOC:              15.0 %

The following YAML files are also included:

octopus-intelligent.yaml - scripts and automations by @robjwalker to assist with Octopus Intelligent tariffs
ng_eso_dfs.yaml          - sensors to detect the most recent National Grid ESO Demand Flexibility Service slot start and end times