After setting up things in HA I noticed that there were some issues with the DAY_ENERGY reading. It was shown as having unit 'W' and the value was not converted to 'kWh' as the other energy values. Yet all the energy values, as returned by the Fronius API are in Wh.
So I have made the following changes:
Changed the DAY_ENERGY sensor the be of type 'energy'.
Modified the logic for how the state is converted.
Fixed a bug where all sensors created after the first power sensor got the power_unit as unit type.
With these changes the sensors looks ok and the values are converted as I believe that they should be.
After setting up things in HA I noticed that there were some issues with the DAY_ENERGY reading. It was shown as having unit 'W' and the value was not converted to 'kWh' as the other energy values. Yet all the energy values, as returned by the Fronius API are in Wh.
So I have made the following changes:
With these changes the sensors looks ok and the values are converted as I believe that they should be.