Simply add 3 sensor values

Hello. I have tried for hours and days to try to do this simple task. All I want to do is add the values of 3 sensors that are in mqtt.yaml. I have 3 Solar Controllers and I want to add up their PV Yield for the day… I can get the PV yield for each controller from mqtt, but I can’t figure out how to add them. Thank you for any help. I have tried to make a template but don’t know where to put it or I’m just doing something wrong. I need help with making the sensor or template or platform. I’ve found several examples and don’t know the terminology. I also need to know where to put it. Does it go in mqtt.yaml or configuration.yaml? Once you help me get it figured out this time I should be having fun making lots of others. Thanks again.

This is them from mqtt.yaml:

line 1 in mqtt.yaml is sensor:

    # 277 Controller PV Yeild
  • name: “Shed Front PV Yeild”
    unique_id: “Cerbo2_277_PV_Yeild”
    device_class: power
    state_topic: “victron2/N/c0619ab2a9f9/solarcharger/277/History/Daily/0/Yield”
    value_template: ‘{{ (value_json.value|float(0))|round(2) }}’
    unit_of_measurement: “kWh”
    icon: mdi:solar-power

    278 Controller PV Yeild

  • name: “Shed Roof PV Yeild”
    unique_id: “Cerbo2_278_PV_Yeild”
    device_class: power
    state_topic: “victron2/N/c0619ab2a9f9/solarcharger/278/History/Daily/0/Yield”
    value_template: ‘{{ (value_json.value|float(0))|round(2) }}’
    unit_of_measurement: “kWh”
    icon: mdi:solar-power

    288 Controller PV Yeild

  • name: “Shed Ground PV Yeild”
    unique_id: “Cerbo2_288_PV_Yeild”
    device_class: power
    state_topic: “victron2/N/c0619ab2a9f9/solarcharger/288/History/Daily/0/Yield”
    value_template: ‘{{ (value_json.value|float(0))|round(2) }}’
    unit_of_measurement: “kWh”
    icon: mdi:solar-power

With those 3 sensors available already you could simply create a sensor group helper, add the 3 above entities and choose the sum option.

Hi Mo,

Example YAML configuration of a sensor group: (or just add with a helper from the UI)

# Example configuration.yaml entry
sensor:
  - platform: group
    type: mean
    entities:
      - sensor.temperature_kitchen
      - sensor.temperature_hallway

To add three sensors use this helper

Choose type: sum.

Thank you Tom! That did exactly what I needed. I had looked at the Helpers but the name “Min/Max” does not seem like something that will add things. I knew they had to be a simple solution. Thank you for pointing me in its direction.

1 Like