Git Product home page Git Product logo

solis2mqtt's Introduction

A MQTT bridge for Solis solar inverters.

Introduction

Solis solar inverters are equipped with an RS485 interface, through which telemetry values can be read and also control commands can be sent. The manufacturer offers LAN and WLAN sticks in combination with a software solution to access the interface. Unfortunately, this is always coupled with a connection to the manufacturer's cloud and integration into a home automation system is only possible in a detoured manner. This software acts as a bridge between the RS485 interface and a MQTT broker to allow easy integration into a home automation (with special support for Home Assistant), and furthermore without cloud constraints.

Hardware

  • The inverter uses a proprietary(?) RS485 plug, with the following pin-out:
  /-----\
  | 2 3 |
  | 1 4 |
  \--^--/
  1. +5V
  2. GND
  3. DATA+
  4. DATA-
  • Any RS485 adapter should do. I use one of these (with FTDI chip), but have also tested this simple (and cheaper) one.
  • I highly recommend using a proper connector, which can be found on ebay (search for "RS485 Solis" or "Exceedconn EC04681-2014-BF") and solder the wires to it.
  • I run the software on a RaspberryPi Zero W, but any Linux box should do.

Installation

  • Download and install to /opt/solis2mqtt

wget https://github.com/incub77/solis2mqtt/archive/main.tar.gz -O - | sudo tar -xvzf - --one-top-level=/opt/solis2mqtt --strip 1

  • Execute setup.sh. This will basically install dependencies, add a system user for the daemon to run in and setup systemd.

sudo bash /opt/solis2mqtt/setup.sh

e.g. sudo vi /opt/solis2mqtt/config.yaml

  • A reboot is necessary for user rights (access to /dev/ttyUSB*) to become effective.

sudo reboot

Usage

Solis2MQTT is intended to run as a system service. A log file is written to /opt/solis2mqtt/solis2mqtt.log. To control the service, the usual systemd commands are used:

  • Start: sudo systemctl start solis2mqtt
  • Stop: sudo systemctl stop solis2mqtt
  • Restart: sudo systemctl restart solis2mqtt
  • Disable start on boot: sudo systemctl disable solis2mqtt
  • Enable start on boot: sudo systemctl enable solis2mqtt

To check if the service is running you can do a ps -efH | grep solis2mqtt. The output should look something like this:

solis2m+   460     1  0 22:53 ?        00:00:08   /usr/bin/python3 solis2mqtt.py -d
pi         559   501  0 23:13 pts/0    00:00:00           grep --color=auto solis2mqtt

If Solis2MQTT doesn't start up to a point where the log file is written you can check /var/log/syslog for clues.

For development/debugging Solis2MQTT can also be started directly. Make sure to change to the working directory before doing so.

cd /opt/solis2mqtt
python3 ./solis2mqtt.py

The following command line arguments are implemented:

  • -d Start as a daemon. Otherwise, Solis2MQTT will stay attached to your shell and writes log messages to stdout/stderr.
  • -v Verbose mode. Will output debug logging messages.
  • --help ...

Basic Configuration

Configuration is read from config.yaml, that has to contain at least these entries:

device: /dev/ttyUSB0
mqtt:
  url: hassio.local
  user: whoami
  passwd: secret

This is a complete config example:

device: /dev/ttyUSB0
slave_address: 1
poll_interval: 60
poll_interval_if_off: 600
inverter:
    name: solis2mqtt
    manufacturer: Ginlong Technologies
    model: solis2mqtt
mqtt:
    url: hassio.local
    port: 8883
    use_ssl: true
    validate_cert: true
    user: whoami
    passwd: secret
  • device: [Required] The path to your RS485 adapter
  • slave_address: [Optional] The modbus slave address, default is 1
  • poll_interval: [Optional] Inverter poll interval in seconds, default is 60
  • poll_interval_if_off: [Optional] Poll interval during night in seconds, default is 600
  • interter:
    • name: [Optional] Used as a base path in MQTT, default is solis2mqtt
    • manufacturer: [Optional] Used for device info in Home Assistant, default is incub
    • model: [Optional] Used for device info in Home Assistant, default is solis2mqtt
  • mqtt:
    • url: [Required] URL to your MQTT broker
    • port: [Optional] Port of your MQTT broker, default is 8883
    • use_ssl: [Optional] Use SSL for MQTT traffic encryption, default is true
    • validate_cert [Optional] Validate certificate for SSL encryption, default is true
    • user: [Required] User for MQTT broker login
    • passwd: [Required] Password for MQTT broker login

Inverter configuration

The file solis_modbus.yaml contains a list of entries, that describe the values to read from (and write to) the inverter.
You can add your own entries if you want to read other metrics from the inverter. Especially if it comes to writing to the inverter - use at your own risk :-)
This is an example of an entry:

- name: inverter_temp
  description: Inverter temperature
  unit: "°C"
  active: true
  modbus:
    register: 3041
    read_type: register
    function_code: 4
    number_of_decimals: 1
    signed: false
  homeassistant:
    device: sensor
    state_class: measurement
    device_class: temperature

The following options are available:

  • name: [Required] Has to be unique. Used in MQTT path and together with the inverter name (from config.yaml) as part of Home Assistant unique_id
  • description: [Required] Used for generating log messages and as display name in Home Assistant
  • unit: [Optional] Added to log messages and used for Home Assistant
  • active [Required] Set to false if the entry should be ignored
  • modbus: [Required]
    • register: [Required] The modbus register address to read/write
    • read_type: [Required] The modbus data type. Currently register and long are supported. Additionally composed_datetime can also be used here (see below)
    • function_code: [Required] The modbus function code to read the register
    • write_function_code: [Optional] The function code to write to the register
    • number_of_decimals: [Optional] Can only be used in combination with ready_type: register. Used for automatic content conversion, e.g. 101 with number_of_decimals: 1 is read as 10.1
    • signed: [Required] Whether the data should be interpreted as signed or unsigned
  • homeassistant: [Optional]
    • device: [Required] Used for Home Assistant MQTT discovery. Can either be sensor, number or switch
    • state_class: [Optional] State class for Home Assistant sensors
    • device_class: [Optional] Device class for Home Assistant sensors
    • payload_on: [Optional] In combination with device: switch required. Specifies the payload that indicates the switch is in 'on' position
    • payload_off: [Optional] In combination with device: switch required. Specifies the payload that indicates the 'off' position
    • min: [Optional] In combination with device: number required. Specifies minimum value.
    • max: [Optional] In combination with device: number required. Specifies maximum value.
    • step: [Optional] In combination with device: number required. Specifies step value. Smallest value 0.001.

Special case for datetime

As the datetime information is stored in several registers, there is a special read_type to read this as one ISO datetime string.

- name: system_datetime
  description: System DateTime
  unit:
  active: true
  modbus:
    register: [3072, 3073, 3074, 3075, 3076, 3077] # [year, month, day, hour, minute, seconds]
    read_type: composed_datetime
    function_code: 4
  homeassistant:
    device: sensor
    state_class:
    device_class: timestamp

Screenshots

MQTT Explorer

Home Assistant

solis2mqtt's People

Contributors

incub77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solis2mqtt's Issues

OSError: [Errno 0] Error

I have the following problem when executing the script:

pi@raspberrypi:~ $ cd /opt/solis2mqtt
pi@raspberrypi:/opt/solis2mqtt $ python3 ./solis2mqtt.py
2023-08-05 11:46:31,306 - root - Starting up...
Traceback (most recent call last):
  File "./solis2mqtt.py", line 189, in <module>
    start_up(args.daemon, args.verbose)
  File "./solis2mqtt.py", line 180, in start_up
    Solis2Mqtt().main()
  File "./solis2mqtt.py", line 27, in __init__
    self.mqtt = Mqtt(self.cfg['inverter']['name'], self.cfg['mqtt'])
  File "/opt/solis2mqtt/mqtt.py", line 13, in __init__
    self.connect(cfg['url'], cfg['port'])
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 914, in connect
    return self.reconnect()
  File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1073, in reconnect
    sock.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
OSError: [Errno 0] Error
pi@raspberrypi:/opt/solis2mqtt $

My current version of Python: 3.9.9

My manually adapted files:
1)solis2mqtt

 - name: active_power
  description: Active Power
  unit: W
  active: true
  modbus:
    register: 33004
    read_type: long
    function_code: 4
    signed: false
  homeassistant:
    device: sensor
    state_class: measurement
    device_class: power
- name: inverter_temp
  description: Inverter temperature
  unit: "°C"
  active: true
  modbus:
    register: 33041
    read_type: register
    function_code: 4
    number_of_decimals: 1
    signed: false
  homeassistant:
    device: sensor
    state_class: measurement
    device_class: temperature
- name: total_power
  description: Inverter total power generation
  unit: kWh
  active: true
  modbus:
    register: 33008
    read_type: long
    function_code: 4
    signed: true
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
- name: generation_today
  description: Energy generated today
  unit: kWh
  active: true
  modbus:
    register: 33014
    read_type: register
    function_code: 4
    number_of_decimals: 1
    signed: false
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
- name: generation_yesterday
  description: Energy generated yesterday
  unit: kWh
  active: true
  modbus:
    register: 33015
    read_type: register
    function_code: 4
    number_of_decimals: 1
    signed: false
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
- name: total_dc_output_power
  description: Total DC output power
  unit: W
  active: true
  modbus:
    register: 33006
    read_type: long
    function_code: 4
    signed: false
  homeassistant:
    device: sensor
    state_class: measurement
    device_class: power
- name: energy_this_month
  description: Energy generated this month
  unit: kWh
  active: true
  modbus:
    register: 33010
    read_type: long
    function_code: 4
    signed: false
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
- name: generation_last_month
  description: Energy generated last month
  unit: kWh
  active: true
  modbus:
    register: 33012
    read_type: long
    function_code: 4
    signed: false
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
- name: generation_this_year
  description: Energy generated this year
  unit: kWh
  active: true
  modbus:
    register: 33016
    read_type: long
    function_code: 4
    signed: false
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
- name: generation_last_year
  description: Energy generated last year
  unit: kWh
  active: true
  modbus:
    register: 33018
    read_type: long
    function_code: 4
    signed: false
  homeassistant:
    device: sensor
    state_class: total_increasing
    device_class: energy
# frequency currently not supported by home-assistant, topic is in discussion
#- name: grid_frequency
#  description: Grid Frequency
#  unit: Hz
#  active: true
#  modbus:
#    register: 33042
#    read_type: register
#    function_code: 4
#    number_of_decimals: 2
#    signed: false
#  homeassistant:
#    device: sensor
#    state_class: measurement
#    device_class: frequency
- name: system_datetime
  description: System DateTime
  unit:
  active: true
  modbus:
    register: [33072, 33073, 33074, 33075, 33076, 33077]
            # [year, month, day, hour, minute, seconds]
    read_type: composed_datetime
    function_code: 4
  homeassistant:
    device: sensor
    state_class:
    device_class: timestamp
- name: serial_number
  description: Serial Number
  unit:
  active: false
  modbus:
    register: 33229
    read_type: register
    function_code: 4
    number_of_decimals: 0
    signed: false
  homeassistant:
    device: sensor
    state_class:
    device_class:
- name: power_limitation
  description: Power limitation
  unit: "%"
  active: true
  modbus:
    register: 33051
    read_type: register
    function_code: 3
    write_function_code: 6
    number_of_decimals: 2
    signed: false
  homeassistant:
    device: number
    min: 0
    max: 100
    step: 0.01
    state_class:
    device_class:
- name: on_off
  description: On/Off
  unit:
  active: true
  modbus:
    register: 33006
    read_type: register
    function_code: 3
    write_function_code: 6
    number_of_decimals: 0
    signed: false
  homeassistant:
    device: switch
    payload_on: 190
    payload_off: 222
    state_class:
    device_class:

2) config.yaml

device: /dev/ttyUSB1
mqtt:
   url: 192.168.178.XXX
   port: 1883
   user: Tom
   passwd: mypassword

My inverter is:
Solis 4G Mini Single-phase inverter

image

I use this adapter:

image

Control max discharge AMPS

Can anyone help me with controling the max discharge amps on my Solis Hybrid 6K?

I know the register I need is 43118 but I'm not 100% sure what I need to put in my solis_modbus.yaml.

- name: discharge_power_limitation
  description: Discharge Power limitation
  unit: "A"
  active: true
  modbus:
    register: 43118
    read_type: register
    function_code: 3
    write_function_code: 6
    number_of_decimals: 2
    signed: false
  homeassistant:
    device: number
    min: 0
    max: 70
    step: 0.5
    state_class:
    device_class:

If I read register 33144 it shows the discharge limit as 100 - If really want to be able to manually set it to zero.

I am using modbus register codes found here

Tried to add a PR for this - but something screwy ?

Anyway - just wanted to add in the Readme.md

The easiest and cheapest way to get the ExceedCon connector is to purchase a WIFI dongle - these cost approx $30(AUD) and can be easily opened up (two tabs), you can then remove the embedded aerial and WIFI module and put your Raspberry PI W inside the enclosure with the wires nicely presented.

Craig

Error after running setup.sh

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'

What can I do to resolve?

HA Errors for some registers

I'm seeing some HA errors in my logs for registers that don't have the correct Device Class etc. What should I be using where the value is not something that would fit in the device class options?

Here "Battery Status" is either 0 or 1 and doesn't have a unit as set in my register:

- name: battery_status
  description: Battery Status
  unit:
  active: true
  modbus:
    register: 33135
    read_type: register
    number_of_decimals: 0
    function_code: 4
    signed: false
  homeassistant:
    device: number
    min: 0
    max: 1
    step: 1

The above produces the following error in HA:

2022-12-30 22:43:07.186 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'Battery Status', 'state_topic': 'solis2mqtt/battery_status', 'unique_id': 'solis2mqtt/battery_status', 'device_class': None, 'state_class': 'measurement', 'unit_of_measurement': None, 'device': {'name': 'solis2mqtt', 'model': 'solis2mqtt', 'manufacturer': 'Ginlong Technologies', 'identifiers': 'solis2mqtt', 'sw_version': 'solis2mqtt 0.7'}, 'platform': 'mqtt'},)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 328, in async_discover
config: DiscoveryInfoType = discovery_schema(discovery_payload)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__
return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec
v = func(v)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable
return schema(data)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected SensorDeviceClass or one of 'date', 'duration', 'timestamp', 'apparent_power', 'aqi', 'battery', 'carbon_monoxide', 'carbon_dioxide', 'current', 'distance', 'energy', 'frequency', 'gas', 'humidity', 'illuminance', 'moisture', 'monetary', 'nitrogen_dioxide', 'nitrogen_monoxide', 'nitrous_oxide', 'ozone', 'pm1', 'pm10', 'pm25', 'power_factor', 'power', 'precipitation', 'precipitation_intensity', 'pressure', 'reactive_power', 'signal_strength', 'speed', 'sulphur_dioxide', 'temperature', 'volatile_organic_compounds', 'voltage', 'volume', 'water', 'weight', 'wind_speed' for dictionary value @ data['device_class']

The same is true for "Storage Mode", typically 35 / 33:

# Battery storage mode, 33=self use, 35=timed charge
- name: storage_mode
  description: Storage Mode
  unit:
  active: true
  modbus:
    register: 43110
    read_type: register
    number_of_decimals: 0
    function_code: 3
    signed: false
  homeassistant:
    device: number
    min: 33
    max: 35
    step: 1

Generates error:

2022-12-30 22:43:07.196 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'name': 'Storage Mode', 'state_topic': 'solis2mqtt/storage_mode', 'unique_id': 'solis2mqtt/storage_mode', 'device_class': None, 'state_class': None, 'unit_of_measurement': None, 'device': {'name': 'solis2mqtt', 'model': 'solis2mqtt', 'manufacturer': 'Ginlong Technologies', 'identifiers': 'solis2mqtt', 'sw_version': 'solis2mqtt 0.7'}, 'platform': 'mqtt'},)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 328, in async_discover
config: DiscoveryInfoType = discovery_schema(discovery_payload)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__
return self._exec((Schema(val) for val in self.validators), v)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec
v = func(v)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable
return schema(data)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
return self._compiled([], data)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: expected SensorDeviceClass or one of 'date', 'duration', 'timestamp', 'apparent_power', 'aqi', 'battery', 'carbon_monoxide', 'carbon_dioxide', 'current', 'distance', 'energy', 'frequency', 'gas', 'humidity', 'illuminance', 'moisture', 'monetary', 'nitrogen_dioxide', 'nitrogen_monoxide', 'nitrous_oxide', 'ozone', 'pm1', 'pm10', 'pm25', 'power_factor', 'power', 'precipitation', 'precipitation_intensity', 'pressure', 'reactive_power', 'signal_strength', 'speed', 'sulphur_dioxide', 'temperature', 'volatile_organic_compounds', 'voltage', 'volume', 'water', 'weight', 'wind_speed' for dictionary value @ data['device_class']

Could anyone advise what changes are needed to the registers to clear the above errors pleasE?

pano-mqtt client issue

not sure of this project is still being developed/monitored, but if it is, there seems to be an issue with the mqtt client used.

The project uses the pago-mqtt library, and when this moved to V2 it seems tho have broken solis2mqtt, causing it to throw an mqtt client socket error when run (sorry, don’t have the exact error message)

I have fixed the issue by forcing v1.1 in the requirements.txt file using the following:

replace the line paho-mqtt
with paho-mqtt==1.1

i them removed a line in the mqtt.py file:
self.enable_logger()
rerun the setup and the the integration is now delivering data to home assistant.

however it would b great if it could be fixed to run with paho-mqtt v2 but is a bit above my pay grade I am afraid.

Writing Registry Values

Hi,

So I've got this pretty much reading most things I need but was wondering what modifications would be needed to write to the inverter? Ie Forced charge / discharge periods etc.

I've been following this HomeAssistant thread but not sure how this could work using this integration. I know no Python either...

Thanks for any assistance

Edit: Still trying to get this off the ground. Can anyone explain the purpose of this code, taken from solis2mqtt.py

def on_mqtt_message(self, client, userdata, msg):
        for el in self.register_cfg:
            if el['name'] == msg.topic.split('/')[-2]:
                register_cfg = el['modbus']
                break

        str_value = msg.payload.decode('utf-8')
        if 'number_of_decimals' in register_cfg and register_cfg['number_of_decimals'] > 0:
            value = float(str_value)
        else:
            value = int(str_value)
        with self.inverter_lock:
            try:
                self.inverter.write_register(register_cfg['register'],
                                             value,
                                             register_cfg['number_of_decimals'],
                                             register_cfg['write_function_code'],
                                             register_cfg['signed'])
            except (minimalmodbus.NoResponseError, minimalmodbus.InvalidResponseError):
                if not self.inverter_offline:
                    logging.exception(f"Error while writing message to inverter. Topic: '{msg.topic}, "
                                      f"Value: '{str_value}', Register: '{register_cfg['register']}'.")

solis_modbus.yaml

Line 154, my Pi didn't like the commented text after the register array, I simply moved it to a new line and that solved the issue.

- name: system_datetime description: System DateTime unit: active: true modbus: register: [3072, 3073, 3074, 3075, 3076, 3077] # [year, month, day, hour, minute, seconds]

Needs to be

- name: system_datetime description: System DateTime unit: active: true modbus: register: [3072, 3073, 3074, 3075, 3076, 3077]
# [year, month, day, hour, minute, seconds]

If anyone has a full 5G registers config they'd like to share I'd be most grateful, I appear to have some unit/precision errors in mine but will work through them this next weekend.

pin out

Please confirm pin out diagram is with the interfacing side of the socket facing you?
This would mean the +5v is bottom right as you solder, assuming the lug is pointing towards you?


| 4 2 |
| 3 1 |
|----^-----

where 1 is +5V? (Grey cable in this image, lug towards bottom of photo)
IMG_1591

Wrong path for installing pip3 requirements

Thanks very much for sharing your Project! I appreciate your work.
I have just a litte improvement, what caused an Error during Installation:

From the documentation, setup.sh is intended to be run like "sudo bash /opt/solis2mqtt/setup.sh".
That way, pip3 can not load the requirements.txt from the opt folder, since the working directory is still different.

echo "### Installing requirements ###"
pip3 install -r requirements.txt

needs to be changed to:

echo "### Installing requirements ###"
pip3 install -r /opt/solis2mqtt/requirements.txt

Discovered entities with a name that starts with the device name

Hey all,

Starting with Homeassistant 2023.8.0 there is a problem with the device name. This will work on for now, butt will cause problems beginning with version 2024.2.0 and above.

grafik

Now, HomeAssistant will temporarily remove the device name from the description to make sure there is no redundency.
Maybe there is anyone here, who has allready figured out an Workaround, without removing the device name from the entity ID

Best Regards

Solis 5G modbus registers

Hey man,

First of all, thank you for this great project.
I am a fresh owner of a Solis inverter in use with an external battery setup, and i have a home assistant setup i would like to integrate this with.
After wiring everything up, i noticed the registers you are using are for another generation of Solis inverters.
I have a 5G inverter, for which i've found the modbus registers in a PDF.
To make it easier for people with the same issue, i have attached the file to this post.
5G Modbus PDF
This was originally posted on this URL openenergymonitor

Thank you and keep on doing what you're doing.

Stef

Slave reported illegal data address

Hello,
I've installed solis2mqtt on a raspberry pi with latest lite distribution of debian.
I use a cheap modbus to ttl converter connected to serial uart pins listening on /dev/ttyAMA0

The inverter is a solis RHI-5K-48ES-5G
Now I don't know if this model uses different modbus registers than mentioned in solis_modbus.yaml and this is the error?
I already verified my inverter address is set to 1, default baudrate and stopbit.
When starting the program, after a the inverter comes online, i get following error in the log entry:

2022-10-25 07:24:45,102 - root - Unhandled exception:
Traceback (most recent call last):
File "/opt/solis2mqtt/solis2mqtt.py", line 185, in
start_up(args.daemon, args.verbose)
File "/opt/solis2mqtt/solis2mqtt.py", line 180, in start_up
Solis2Mqtt().main()
File "/opt/solis2mqtt/solis2mqtt.py", line 137, in main
value = self.inverter.read_long(entry['modbus']['register'],
File "/usr/local/lib/python3.9/dist-packages/minimalmodbus.py", line 599, in read_long
self._generic_command(
File "/usr/local/lib/python3.9/dist-packages/minimalmodbus.py", line 1245, in _generic_command
payload_from_slave = self._perform_command(functioncode, payload_to_slave)
File "/usr/local/lib/python3.9/dist-packages/minimalmodbus.py", line 1329, in _perform_command
payload_from_slave = _extract_payload(
File "/usr/local/lib/python3.9/dist-packages/minimalmodbus.py", line 1880, in _extract_payload
_check_response_slaveerrorcode(response)
File "/usr/local/lib/python3.9/dist-packages/minimalmodbus.py", line 3538, in _check_response_slaveerrorcode
raise error
minimalmodbus.IllegalRequestError: Slave reported illegal data address

Any clues what causes this error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.