MatterVN / ModbusTCP2MQTT

Sungrow & SMA Solar Inverter addon for Home Assistant using mobusTCP
MIT License
68 stars 51 forks source link

Energy Management Dashboard - Inverter Power Needs to be kWh as a unit of measurement #17

Open scottgow opened 2 years ago

scottgow commented 2 years ago

I've been able to implement my inverter within my HA instance and am getting data, however when trying to use the HA energy management dashboard I can only see the following:

I'm expecting to see a Inverter Power which I believe to be a live measurement of the power being produced by my solar inverter. I've been looking around and it appears as this sensor's unit of measurement is a "W" watt... it won't be picked up via the energy management dashboard.

Are you able to review the above and change the unit of measurement from W to kWh and device_class to energy I believe this should resolve the issue.

Happy to discuss further or test as a beta if needed.

Cheers

bdog720 commented 2 years ago

This is my setup in HA

For Grid consumption I'm using "Inverter Daily Energy Import" For Return to Grid I have my own sensor setup (see code in configuration.yaml below) For Solar Production I'm using "Inverter Energy Today"

template:
      sensor:
        - name: grid_exported_today
          unit_of_measurement: kWh
          device_class: energy
          state_class: total_increasing
          state: >
            {{ (state_attr('sensor.inverter_energy_today', 'daily_power_yield')|float - state_attr('sensor.inverter_energy_today', 'daily_energy_consumption')|float) / 1000 }}
          availability: >
            {{ states('sensor.inverter_energy_today')|lower not in ['unavailable','unknown','none'] }}
scottgow commented 2 years ago

Thank you, that's great information.

On Tue, 18 Jan, 2022 at 8:52 AM, bdog720 @.***> wrote:

To: tenysmart/modbustcp2mqtt Cc: @.; @.

This is my setup in HA For Grid consumption I'm using "Inverter Daily Energy Import" For Return to Grid I have my own sensor setup (see code in configuration.yaml below) For Solar Production I'm using "Inverter Energy Today" template: sensor: - name: grid_exported_today unit_of_measurement: kWh device_class: energy state_class: total_increasing state: > {{ (state_attr('sensor.inverter_energy_today', 'daily_power_yield')|float - state_attr('sensor.inverter_energy_today', 'daily_energy_consumption')|float) / 1000 }} availability: > {{ states('sensor.inverter_energy_today')|lower not in ['unavailable','unknown','none'] }} — Reply to this email directly, view it on GitHubhttps://github.com/TenySmart/ModbusTCP2MQTT/issues/17#issuecomment-1014936597, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHH77GHGLVYMWKNIUMR5CHTUWSMSFANCNFSM5L24EGEA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign=notification-email&utm_medium=email&utm_source=github. You are receiving this because you authored the thread.[https://github.com/notifications/beacon/AHH77GHN2CDOT46SJGBHOXDUWSMSFA5CNFSM5L24EGEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHR7LIFI.gif]Message ID: @.***>

Yop1403 commented 2 years ago

To add some additional info for the developer: After the improvement of the measurement units (W to kWh / kWh to W) in version 0.2.1.1 the following still needs to be improved/corrected (for reference, my inverter is SG5K - this is most likely the same for all Sungrow inverters):

(1) For one of the items the /1000 division is not necessary as the original value is already in kWh. See picture below: 01 --> Can you change this so the value of that sensor is displayed correctly?

(2) HA energy monitoring expects a sensor for the consumption from the grid:****

03

Currently only these 4 sensors can be seen by HA Energy Monitoring:

02

--> Can you create a sensor that can be seen by HA Energy Monitoring based on this value: 04

(3) HA energy monitoring also expects a sensor for the power returned to the grid: 05 but currently there is no such value. **--> Is it possible that you create a sensor that is calculated as: 06 minus

07

In this example the result should be 20.3 kWh (32.1 kWh minus 11.8 kWh = 20.3 kWh)**

Marshalldog commented 2 years ago

To add some additional info for the developer: After the improvement of the measurement units (W to kWh / kWh to W) in version 0.2.1.1 the following still needs to be improved/corrected (for reference, my inverter is SG5K - this is most likely the same for all Sungrow inverters):

(1) For one of the items the /1000 division is not necessary as the original value is already in kWh. See picture below: 01 --> Can you change this so the value of that sensor is displayed correctly?

(2) HA energy monitoring expects a sensor for the consumption from the grid:** 03 Currently only these 4 sensors can be seen by HA Energy Monitoring: 02 --> Can you create a sensor that can be seen by HA Energy Monitoring based on this value: 04**

(3) HA energy monitoring also expects a sensor for the power returned to the grid: 05 but currently there is no such value. --> Is it possible that you create a sensor that is calculated as: 06 minus 07 In this example the result should be 20.3 kWh (32.1 kWh minus 11.8 kWh = 20.3 kWh)

To add some additional info for the developer: After the improvement of the measurement units (W to kWh / kWh to W) in version 0.2.1.1 the following still needs to be improved/corrected (for reference, my inverter is SG5K - this is most likely the same for all Sungrow inverters):

(1) For one of the items the /1000 division is not necessary as the original value is already in kWh. See picture below: 01 --> Can you change this so the value of that sensor is displayed correctly?

(2) HA energy monitoring expects a sensor for the consumption from the grid:** 03 Currently only these 4 sensors can be seen by HA Energy Monitoring: 02 --> Can you create a sensor that can be seen by HA Energy Monitoring based on this value: 04**

(3) HA energy monitoring also expects a sensor for the power returned to the grid: 05 but currently there is no such value. --> Is it possible that you create a sensor that is calculated as: 06 minus 07 In this example the result should be 20.3 kWh (32.1 kWh minus 11.8 kWh = 20.3 kWh)

I have the same issue

jsword commented 1 year ago

I only see inverter daily consumption as an option.

I'd like to see the solar production, grid consumption and return to grid. Here is a link to the energy documentation:

https://www.home-assistant.io/docs/energy/

I believe the energy unit is not being set properly.

jsword commented 1 year ago

It also looks like the dev_class needs to change from "power" to "energy"

https://www.home-assistant.io/integrations/integration/#energy