Goodwe Integration: Templates

TimSoethout/goodwe-sems-home-assistant: Sensor for Home Assistant pulling data from the GoodWe SEMS API for solar panel production metrics. refers to adding the following optional template:

  - 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"
      pv_iday:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.iday }}'
        unit_of_measurement: '€'
        friendly_name: "PV income day"
      pv_itotal:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.itotal }}'
        unit_of_measurement: '€'
        friendly_name: "PV income total"
      pv_excess:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.pmeter }}'
        unit_of_measurement: 'W'
        friendly_name: "PV spare"
      # battery soc
      pv_soc:
        value_template: '{{ states.sensor.inverter_$NAME.attributes.soc }}'
        unit_of_measurement: '%'
        friendly_name: "Battery power"

Looking at the below, I cannot work out where this might be stored:

1 Like

Hi Andre,

While it is possible to make that work, that is the legacy syntax for making those and you can’t find it easily in the Docs because that way was replaced years ago. You should complain to the source of that information that they need to fix this problem…

This should be put into your configuration,yaml file. If there is already a template: section in there, skip the template: key and put this under that key. Otherwise paste this into configuration.yaml as-is.

template:
  - sensor:
    - name: pv_temperature
      unique_id: 9c46ac94-7647-4e61-95f1-f2fee2d28531
      state: '{{ states.sensor.inverter_$NAME.attributes.tempperature }}'
      unit_of_measurement: 'C'
      attributes:
        friendly_name: "PV Temperature"
    - name:  pv_eday
      unique_id: 04fcd3a0-8a76-4726-b880-5c813621b69d
      state: '{{ states.sensor.inverter_$NAME.attributes.eday }}'
      unit_of_measurement: 'kWh'
      attributes:
        friendly_name: "PV energy day"
    - name: pv_etotal
      unique_id: b1859f54-bdf5-410c-9c2b-b2e3e44b745c
      state: '{{ states.sensor.inverter_$NAME.attributes.etotal }}'
      unit_of_measurement: 'kWh'
      attributes:
        friendly_name: "PV energy total"
    - name:  pv_iday
      unique_id: 5bc455c0-759b-4d13-8438-fbdbd65b6bc3
      state: '{{ states.sensor.inverter_$NAME.attributes.iday }}'
      unit_of_measurement: '€'
      attributes:
        friendly_name: "PV income day"
    - name:  pv_itotal
      unique_id: 832c97f9-0615-432b-9940-371ab5a3e7c5
      state: '{{ states.sensor.inverter_$NAME.attributes.itotal }}'
      unit_of_measurement: '€'
      attributes:
        friendly_name: "PV income total"
    - name: pv_excess
      unique_id: 61de79ae-42b0-4a0e-8650-589bcf0d1fe7
      state: '{{ states.sensor.inverter_$NAME.attributes.pmeter }}'
      unit_of_measurement: 'W'
      attributes:
        friendly_name: "PV spare"
        # battery soc
    - name: pv_soc
      unique_id: 3c232643-427b-48c1-8a77-443a9ed6c2ba
      state: '{{ states.sensor.inverter_$NAME.attributes.soc }}'
      unit_of_measurement: '%'
      attributes:
        friendly_name: "Battery power"

NOTE:

You may also want ot need to add availability: and state_class: information to these to take care of what happens if the sensor goes offline and to put these numbers into Long Term Statistics.
I have added a unique_id so you can see these values in the UI.