Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple inverters #29

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rzulian
Copy link

@rzulian rzulian commented Apr 9, 2021

I've added the support for multiple inverters in the same modbus connection. This is the scenario when you have a three-phase inverter for photovoltaic and you also have a battery, which is driven by a single-phase inverter.
You cannot open multiple connection to the different inverters, instead you have to use one connection and use the unit_id to read from the other inverter.
I've used the ModbusTCPClient from pymodbus, which is supporting the unit_id in the read_holding_registers.
I've also modified the reference to the meter using meter_id instead of unit_id, because the unit_id has to reference to the main inverter's unit_id.

@mmN83
Copy link

mmN83 commented Jul 20, 2021

Hello rzulian,

Thank you for your integration. My set-up will be a little different including 3 x single phase inverters (one for each phase and in master-slave configuration).
Two of them host a LG battery controlled through modbus.

I was able to include a "battery sensor" as requested by one of the comment present in the issue page but I would like to understand which is the easiest way to get data from each of my inverters.
I can also provide a ethernet independent communication to all of the inverter.

Before landing on your integration I was wondering if it is feasible to implement 3 different custom components with 3 different domain (e.g. solaredge_modbus_1, solaredge_modbus_2, ...) and define 3 inverter communication through modbus over ethernet.
Do you think is this possible?

Otherwise, have you any suggestion for my implementation? Is it possible for your integration to include 3 inverters? Can you share your configuration as an example?

Looking forward to contribute with some testing activities as soon as my system will be upgraded from 1 to 3 inverters.

@purcell-lab
Copy link

Before landing on your integration I was wondering if it is feasible to implement 3 different custom components with 3 different domain (e.g. solaredge_modbus_1, solaredge_modbus_2, ...) and define 3 inverter communication through modbus over ethernet.
Do you think is this possible?

I have two inverters and have just setup multiple integrations to access each inverter using their own IP address. I then sum individual production in home assistant to provide total production. One inverter has the consumption meter which I also access via this integration

image

@mmN83
Copy link

mmN83 commented Jul 24, 2021

That is exactly my goal (plus battery readings).
Can you share your integration configuration?
Thank you!

@rzulian
Copy link
Author

rzulian commented Jul 25, 2021

@mmN83 I don't think it works this way. What I've understood from my implementation is that you have to use the unit_id to get access to a specific inverter via modbus; you cannot use the different ip address.
So basically you connect to the master via modbustcp, which is usually the unit_id 1, and then you can get the other inverters if you configure the different unit_ids.
BTW, if you are creating different components, you can have a synch problem, because you are not sure thatyou are reading the data in the same moment, therefore the totals can be wrong.

@purcell-lab
Copy link

That is exactly my goal (plus battery readings).
Can you share your integration configuration?
Thank you!

Not really much integration configuration. You need to ensure both inverters have modbus enabled and you know each IP address. Then complete two integrations with different names and ip addresses.

image

I called mine 'solaredge-modbus' and 'solaredge-modbus-meter'.

Then I sum the production from both in sensors.yaml to give me a total:

modbus_generation:
  friendly_name: "Solar Production"
  device_class: power
  value_template: "{{ (states('sensor.solaredge_modbus_ac_power') | float + states('sensor.solaredge_modbus_meter_ac_power') | float) |round (2) }}"
  unit_of_measurement: W

There could be a race issue where the two meters are measures at slightly different times, which is why I am interested in this pull request as I won't need to to the summation myself, the integration will be able to provide the total production as my inverters will be reporting through there internal RS485 Bus, until then I need to utilise the two integrations.

@purcell-lab
Copy link

@mmN83 I don't think it works this way. What I've understood from my implementation is that you have to use the unit_id to get access to a specific inverter via modbus; you cannot use the different ip address.
So basically you connect to the master via modbustcp, which is usually the unit_id 1, and then you can get the other inverters if you configure the different unit_ids.
BTW, if you are creating different components, you can have a synch problem, because you are not sure thatyou are reading the data in the same moment, therefore the totals can be wrong.

Agreed.

Currently the only way I could see to get the consolidated result was to create two integrations poll each inverter separately, which can have minor timing issues, but seems to be working reasonably for me.

I would prefer to just poll the master and get the results from there, hence I'm following your pull request and awaiting its integration.

@mmN83
Copy link

mmN83 commented Jul 27, 2021

Thank you both for your clarification.
In summary a configuration like the one below should fit my needs (3 inverters to be read):

solaredge_modbus:
name: 'SolarEdge Modbus'
host: XXX.XXX.XXX.XXX
port: XXX
scan_interval: XX
read_meter1: true
additional_inverter_unit_id: 2
additional_inverter_unit_id: 3

Am I right?

Additionally I can include in the code a if statement to read certain register (battery status) only from 2 of the inverter.

I will give it a try as soon as my system will be installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants