Guys, I’m trying to read data from my Sunny Boy 7.7TL inverter via Modbus over TCP. I thought I’d try with a single parameter to begin with (to get my feet wet), but I can’t even get that to work!
I can access the inverter using a free (Windows-based) simulator and see data that looks valid (screenshot at the end of post), so I know all is good on the network and inverter-side. However, when I try to read the data in HA, that’s when my problems begin.
I have a simple entry in configuration.yaml to read a single data field - in this case, Power AC. The entry in configuration.yaml is:
modbus:
- name: SMA
type: tcp
host: 192.168.86.150
port: 502
sensors:
- name: sma_power_ac
state_class: measurement
unit_of_measurement: W
slave: 3
address: 30775
count: 2
data_type: uint32
scan_interval: 10
In templates.yaml, I have:
- sensor:
- name: SMA Power
state: "{{(states('sensor.sma_power_ac') | float(0) + 1.0)}}"
unit_of_measurement: "W"
unique_id: c7310e44-451b-11ee-be56-0242ac120003
(The + 1.0 is only there as a sanity check to make sure something is being loaded into the sensor value in the event of zero data from the inverter. It’s purely temporary until I debug this problem.)
This is what I get in the HA States:
So, clearly it’s seeing a value of zero (0) and adding the 1.0.
The question is: why is it zero?
If I run a simulator and interrogate the inverter from my Windows machine, I get:
which shows a value of 7076, which would be the correct wattage output from my inverter at this time of day.
Really confused and looking for some kind of hint.
Thanks.