I have a SMA Sunny Boy SB2500TLST-21 inverter which I want to read out. The current SMA Webconnect component does not work with my type of inverter and the standard modbus component seems to be to limited to get the data I want into Home Assistant.
The inverter allows for a standard modbus connection and I want to retrieve the following values:
I’m willing to pay EUR 75,- to anyone that is capable of converting the linked Python script to a HA custom compontent.
[EDIT] After some more tinkering I might be able to use the default modbus component after all together with the template sensor. If I’m still missing something I’ll try to submit issues to extend the modus component. For now I’m pulling the bounty on this.
@phuturist Did you manage to use the ModBus component with a template sensor? If yes, do you care to share your findings?
I was using the WebConnect interface, but this keeps on turning itself off. I’m told this is because I use a Home Manager 2.0…
Yes I have. See below the configuration for configuration.yaml. Getting the right register id’s was a hassle. They seem to differ per model but there is a lot of documentation about it from SMA. And dont forget to actually enable modbus TCP on the inverter. It’s disabled by default.
modbus:
type: tcp
host: 192.168.0.128
port: 502
sensor:
- platform: modbus
scan_interval: 10
registers:
- name: SMA Power AC
unit_of_measurement: W
slave: 3
register: 30775
count: 2
data_type: uint
- name: SMA Daily Yield
unit_of_measurement: Wh
slave: 3
register: 30517
count: 4
data_type: int
- name: SMA Total
unit_of_measurement: MWh
slave: 3
register: 30513
count: 4
data_type: int
- name: SMA Volt
unit_of_measurement: V
slave: 3
register: 30783
count: 2
data_type: int
- platform: template
sensors:
sma_power:
value_template: "{% if states('sensor.sma_power_ac')|float < 0 or states('sensor.sma_power_ac')|float > 3000 %}0{% else %}{{ states('sensor.sma_power_ac')}}{% endif %}"
friendly_name: 'Power'
unit_of_measurement: 'Watt'
icon_template: mdi:flash-circle
sma_day_production:
value_template: "{{ states('sensor.sma_daily_yield') }}"
friendly_name: 'Dagopbrengst'
unit_of_measurement: 'Wh'
icon_template: mdi:flash-circle
sma_total_production:
value_template: "{{ (states('sensor.sma_total') | float / 1000) | round(2) }}"
friendly_name: 'Totale opbrengst'
unit_of_measurement: 'MWh'
icon_template: mdi:flash-circle
sma_voltage:
value_template: "{% if states('sensor.sma_volt')|float < 0 %}0{% else %}{{ states('sensor.sma_volt') | float / 100 | round(2)}}{% endif %}"
friendly_name: 'Voltage'
unit_of_measurement: 'V'
icon_template: mdi:flash-circle
Cheers for that, that’s great!
I’ve changed the slave to 126 based on what I read somewhere. I am getting some values: all -1 or a number with 10 digits. Strange as I copied the register number straight off SMA’s crappy Excel doc.
I’ll try with slave: 3…
What does the count argument do and how do you chose which number to use? The doc is not helping me much: count (Optional): Number of registers to read.…
SMA does mention on its documents not to place more than 5 requests per poll and space each polling by at least 10 seconds.
I’ve found out a lot of sensors output the maximum possible value when no value is published by the inverter. This occurs for example with current yield at night when the PV does not produce anything. I’ve created template sensors for such problematic values that sets the value to 0 rather than these non sensical numbers…