Custom Component: ABB/Power-One/FIMER PV Inverters - SunSpec Modbus TCP

Hey! Thank you so much!

I’ve setup the new sensors using the REST endpoints. When I check the entities all the data is displayed right as expected. Sadly I can’t setup those new sensors as data inputs for the Energy dashboard. I can’t find them there.

Do I have to setup additional helper sensors that accumulate the sensor readings? I read something about this in some other approach.

Yeah, sorry, my bad. It’s the problem of the DIY and not using a fully build integration :slight_smile: The one retrieved by the API are the power values only (W). You need to convert the proper ones to Energy values (Wh, via platform/integration) to be able to pick 'em up in the Energy Dashboard, something like this

sensor:
  - platform: integration
    source: sensor.generation_to_battery
    name: battery_charge_energy
    unique_id: battery_charge_energy
    unit_prefix: k
    round: 2
    method: left

  - platform: integration
    source: sensor.battery_to_house
    name: battery_discharge_energy
    unique_id: battery_discharge_energy
    unit_prefix: k
    round: 2
    method: left

  - platform: integration
    source: sensor.generation_to_grid
    name: injected_energy
    unique_id: injected_energy
    unit_prefix: k
    round: 2
    method: left

  - platform: integration
    source: sensor.grid_to_house
    name: imported_energy
    unique_id: imported_energy
    unit_prefix: k
    round: 2
    method: left

  - platform: integration
    source: sensor.generation_instant_output
    name: overall_solar_energy
    unique_id: overall_solar_energy
    unit_prefix: k
    round: 2
    method: left

  - platform: integration
    source: sensor.generation_to_house
    name: autoconsumed_energy
    unique_id: autoconsumed_energy
    unit_prefix: k
    round: 2
    method: left

The examples you provided don’t seem to work for me to calculate battery discharge and charge values correctly. I did find out that sensor.battery_instant_power_flow from your example, which uses PBat from the JSON source, is basically what I need.

The value is negative when discharging from battery and charging when it’s positive.

I just can’t wrap my head around how to write a riemann sum for this to integrate that into the energy dashboard.

What is the problem with my sensor definition?

PBat as you say is positive when charging and negative while discharging. Given that we are speaking of power and not energy you need to create 2 different sensors derived from PBat,

  • one that is positive while charging and null while discharging
  • one that is positive (absolute) while discharging and null while charging

and that is exactly what the template definition in my configuration.yaml do (brutally copied from @monkeypr00f Nodered Flow).
Having these “rectified” values you can now do a simple integral/reimann sum and derive energy values.

Hey, sorry it took a while for me to answer. Was busy with some stuff.

I just want to share how I got it working in my case. I use the REST API to create two sensors for my battery for incoming and outgoing power. As for solar energy production, I use the before used sunspec integration and simply created a riemann sum helper sensor.

Thanks @wrongisthenwright couldn’t have done it without your help! <3

rest:
    resource: http://IP/v1/livedata
    username: "myusername"
    password: "mysupersecretpassword"
    authentication: basic
    scan_interval: 60
    timeout: 30
    sensor:
      - name: "Battery Charge Total"
        value_template: >
                {% for point in value_json['BATTERY-ID']['points'] %}
                        {% if point.name == 'ECharge' %}
                        {{ point.value/1000 }}
                        {% endif %}
                {% endfor %}
        device_class: energy
        unit_of_measurement: kWh
        state_class: total
      - name: "Battery Discharge Total"
        value_template: >
                {% for point in value_json['BATTERY-ID']['points'] %}
                        {% if point.name == 'EDischarge' %}
                        {{ point.value/1000 }}
                        {% endif %}
                {% endfor %}
        device_class: energy
        unit_of_measurement: kWh
        state_class: total
sensor:
  - platform: integration
    source: sensor.inverter_dc_watts
    name: solar_energy_production
    unique_id: solar_energy_production
    unit_prefix: k
    round: 2
    method: left

Hi, i think you are italian, I would like to talk with you in italian, may be in private.

So, this is an international comunity, i must to speak english.

…I have a powerone (aurora) inverter connected via rs845 and a wifi module called Elfin W11.

You think i can use your integration for to connecdt? I tried, but fallied… thanks!

Ciao Alessandro.

If you read more carefully the readme in the repo, my integration is based on the SunSpec register map, so it requires a VSN300/VSN700 card in the inverter. Those cards translate the Aurora native protocol in SunSpec, they act as protocol gateways.

If you want to use your Elfin, you will need to use the native ABB integration, but it will only provide you with one sensor, the production.

I would advise you to purchase the VSN300 card, first check if your inverter supports it.

thanks, the native abb integration, The only one i found is for a cable configuration. I don’t know if there is one for elfin ew11 wifi. The vsn300 card is more expencive for a old inverter…

the price of the vsn300 doesn’t depend on the inverter model. you can find it for 120-140.

elfin ew11 15 euro…
I don’t spend that money In a old installation (up 16 years old)
may be 4 years and I change all my photovoltaic system
…naturally if i could to configurate one or any sensor with my ew11 i’m satisfied…

Im not an expert like Alessandro, but if I googled correctly ew11 is nothing more than a rs485 to wifi adapter. It exposes quite a lot of protocols, but basically you should be able to connect to it via modbus native integration.

see here for the basics:

Obviously you must adapt the code to reflect you inverter register map, not thesimplest thing in the world but doable if you find the inverter manual/register map with addresses.
In this way you should be able to gather all the metrics your inverter exposes over RS485.

Alessandro can correct me if I’m wrong…

I think it’s what i did. or rather, what I tried to do.
unfortunately all the sensors created do not give values ​​or rather “values ​​not available”
so, I definitely did something wrong. At a certain point I thought that maybe that configuration might not work with my inverter.
finally, contrary to what you think, I am very ignorant on the subject. In Italy they say: I’m groping in the dark. Thank you for your reply.

this is a work witch is out of my capacity.

could this be it?

I’m very sorry for the late reply, I missed completely your question.
Yes it could be, I don’t hav your inverter so I cannot be sure.
Please note that in the table you showed the addresses are offset in respect a fixed Base Address. In my case that base address is 40000, don’t know in your case.

Having these values you can start compiling the config file for HA, see this:

Where

INVERTER_IP_ADDRESS

is the IP of your EW11, and the addresses ( address: 4xxxx)

Is the sum of the base Address (try with 40000 first) and the offset from the table
For the DataType you need to match the values smallint and single to the datatypes available in HA (Modbus - Home Assistant)

Hi, is there a way to calculate the total energy daily produced? Right now there is only the total energy from installation sensor.abb_inverter_total_energy .
ABB VSN 300
Thanks a lot,
Lorenzo

You need to create a utility_meter sensor:

utility_meter:
  total_energy_production:
    name: Total Energy Production
    source: sensor.elios4you_produced_energy
  hourly_energy_production:
    name: Hourly Energy Production
    source: sensor.elios4you_produced_energy
    cycle: hourly
  daily_energy_production:
    name: Daily Energy Production
    source: sensor.elios4you_produced_energy
    cycle: daily
  weekly_energy_production:
    name: Weekly Energy Production
    source: sensor.elios4you_produced_energy
    cycle: weekly
  monthly_energy_production:
    name: Monthly Energy Production
    source: sensor.elios4you_produced_energy
    cycle: monthly
  yearly_energy_production:
    name: Yearly Energy Production
    source: sensor.elios4you_produced_energy
    cycle: yearly

The system did not connect this morning. It was still working yesterday.
I found the following error in the lofg file:

 2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec] Setup config_entry for abb_powerone_pvi_sunspec
2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.coordinator] Scan Interval: scan_interval=60.0 update_interval=0:01:00
2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.coordinator] Coordinator Config Data: {'base_addr': 40000, 'host': '192.168.X.X', 'name': 'ABB Inverter', 'port': 502, 'scan_interval': 60.0, 'slave_id': 254}
2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.coordinator] Coordinator API init: Host: 192.168.70.31 Port: 502 ID: 254 ScanInterval: 60.0
2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.coordinator] Data Coordinator: Update started at 2024-12-09 09:05:20.640839
2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.api] API Client connect to IP: 192.168.70.31 port: 502 slave id: 254 timeout: 59.0
2024-12-09 09:05:20.640 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.api] Check_Port: opening socket on 192.168.X.X:502 with a 3.0s timeout.
2024-12-09 09:05:20.656 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.api] Check_Port (SUCCESS): port open on 192.168.X.X:502
2024-12-09 09:05:20.657 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.api] Inverter ready for Modbus TCP connection
2024-12-09 09:05:20.662 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.api] Modbus TCP Client connected
2024-12-09 09:05:20.662 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.api] Start Get data (Slave ID: 254 - Base Address: 40000)
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Slave ID: 254
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Base Address: 40000
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Manufacturer: ABB
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Model: -3P38-
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Options: 0x0BED/0xFF28/
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (opt_notprintable) opt_model: 0x0BED/0xFF28/ - opt_model_int: 11
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (opt_comm_model) comm_model: UNO-DM-2.0-TL-PLUS
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Version: 2201A
2024-12-09 09:05:20.720 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_1) Sernum: XXXXXX
2024-12-09 09:05:20.738 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_101_103) Slave ID: 254
2024-12-09 09:05:20.738 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_101_103) Base Address: 40000
2024-12-09 09:05:20.738 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] (read_rt_101_103) Inverter Type (int): 102
2024-12-09 09:05:20.738 DEBUG (SyncWorker_7) [custom_components.abb_powerone_pvi_sunspec.api] read_sunspec_modbus: failed with error: 102
2024-12-09 09:05:20.739 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.coordinator] Coordinator Update Error:  at 2024-12-09 09:05:20.640551
2024-12-09 09:05:20.739 DEBUG (MainThread) [custom_components.abb_powerone_pvi_sunspec.coordinator] Finished fetching abb_powerone_pvi_sunspec (108968-3P38-1120) data in 0.098 seconds (success: False)

And today there is data again.
I didn’t change the settings

And I didn’t change the code. :slight_smile:

Check wifi connection, is the signal strong enough? With some users there were issues like that, with random disconnects, etc.