MODBUS data from SMA Inverter

I used this:
https://www.sma.de/en/products/monitoring-control/sunny-explorer

It’s old, windows only. Also make sure you know the passwords (mine were empty or default luckily). It connects to bluetooth. First time setup was a bit finnicky but not the hardest thing i’ve ever done.
I tried direct connecting with ethernet cable but that sucked, sitting in the laundry room with a long cable. Was also less reliable. Bluetooth reaches pretty far in my case.

       friendly_name: 'SMA_Grid Frequency'
       value_template: >-
           {% if states('sensor.sma_grid_frequency')|float < 30 or states('sensor.sma_grid_frequency')|float > 100 %}
             Not Measured
           {% else %}
             {{ states('sensor.sma_grid_frequency') }}
           {% endif %}
       unit_of_measurement: "Hz"
     modbus_grid_voltage:
       
       friendly_name: 'SMA_Grid Voltage'
       value_template: >-
           {% if states('sensor.sma_grid_voltage')|float < 180 or states('sensor.sma_grid_voltage')|float > 300 %}
             Not Measured
           {% else %}
             {{ states('sensor.sma_grid_voltage') }}
           {% endif %}
       unit_of_measurement: "V"

This part is throwing errors if grid_voltage is not in the wanted range:

ValueError: Sensor sensor.modbus_grid_voltage has device class 'None', state class 'None' unit 'V' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'Not Measured' (<class 'str'>)

Don’t know if makes to also include the unit_of_measurement within an IF-case or if this would create another error due to changing units.

Hey all,

I have an older model SMA inverter (SB3000TL-21) where modbus has been enabled and integrated through sunspec.

But I’d like more control and detail through reading modbus register.

I think I found all the necessary info in this topic but I’m clueless about the data I’m receiving
It seems as if the data in the inverter isn’t always available. The register is empty (returns “0”) most of the time.


image

When reading other registers, the data isn’t always correct or even what I expect.
What am I doing wrong or am I stuck with sunspec?
image