TimSoethout / goodwe-sems-home-assistant

Sensor for Home Assistant pulling data from the GoodWe SEMS API for solar panel production metrics.
88 stars 37 forks source link

Optional data #84

Open Kotikoodari opened 1 year ago

Kotikoodari commented 1 year ago

Thanks for the SEMS API! I have just installed that and got it preliminary operational.

However, I wonder why it doesn't provide all the available data - such as daily energy production. Current power and total Energy are provided.

I'm trying to follow instructions and add temperature and daily energy generation visible by adding "PV Temperature" and "PV energy day". However, the instructions are not very clear for a new HA guy like me and I hope to get very clear instructions how to get the data available.

Instruction tells:

Extra (optional) templates to easy access data as sensors Replace $NAME with your inverter entity id.

I have created a sensors.yaml file (in the same folder as configurations.yaml) with below text (with correct id):

- platform: template
  sensors:
    pv_temperature:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.tempperature }}'
        unit_of_measurement: 'C'
        friendly_name: "PV Temperature"
    pv_eday:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.eday }}'
        unit_of_measurement: 'kWh'
        friendly_name: "PV energy day"
    pv_etotal:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.etotal }}'
        unit_of_measurement: 'kWh'
        friendly_name: "PV energy total"

And I have written a row in the configurations.yaml:

sensor: !include sensors.yaml

However, I cannot get this working...

When trying to add a sensor "PV energy day" it says that it is not in use and it doesn't provide value.

Can someone help to provide clear instructions... I'm not too familiar yet with the logic of the yaml files and templates...

Also in future it might be good to provide all the basic values available by default, especially today's energy production.

Thank you!

sixtybi commented 1 year ago

Hi, have you figured this out already? I just faced the same issues here. Not very clear how to fetch more data. I only have current power and generated total. Please let me know how to proceed with this. Thanks!

TimSoethout commented 1 year ago

It seems the template syntax has changed, see https://www.home-assistant.io/integrations/template . Although the old syntax does still work for now.

It should become something like this (untested):

template:
  - sensor:
      - name: "PV energy day"
        unit_of_measurement: "kWh"
        state: '{{ states.sensor.inverter_$NAME.attributes.eday }}'

I agree that in the future these values should be added as separate sensors.

patrickmoll83 commented 1 year ago

I have the same issue, can someone help me?

f00f commented 11 months ago

For me, this worked:

template:
  unique_id: pv_gw10k_et
  sensor:
    - name: "PV Energy day"
      unique_id: pv_gw10k_et.pv_energy_day
      device_class: energy
      state: '{{ states.sensor.inverter_gw10k_et.attributes.eday }}'
      state_class: total
      unit_of_measurement: kWh
    - name: "Battery SoC"
      unique_id: pv_gw10k_et.pv_soc
      state: '{{ states.sensor.inverter_gw10k_et.attributes.soc }}'
      state_class: measurement
      unit_of_measurement: '%'
      icon: mdi:battery-20
    - name: "Battery SoH"
      unique_id: pv_gw10k_et.pv_soh
      state: '{{ states.sensor.inverter_gw10k_et.attributes.soh }}'
      state_class: measurement
      unit_of_measurement: '%'
      icon: mdi:battery-check-outline