Combining two solar sensors

I would like to combine two solar sensors into one, I have tried various examples on the forum but I am having no luck.

I am going through templates, it seems I am writing in Yaml, but it requires Jinja2.

Any help please.

- platform: template
    sensors:
      powermon_totalsolar:
        friendly_name: "Solar Generation - Total"
        value_template: "{{ states(‘sensor.myenergi Eddi power ct generation’) | float + states(‘sensor.myenergi Eddi Generation CT3’) | float }}"
        unit_of_measurement: 'watts'

This is what I have but I keep getting a syntax error unexpected char " on 146.

Hi, have a look at helpers

Open your Home Assistant instance and show your helper entities.

It seems like you’re not using the entity_id of your sensors

It should probably be something like sensor.myenergi_eddi_power_ct_generation instead of sensor.myenergi Eddi power ct generation

Take a look and copy it from the Dev Tools - States info or from the Settings - Entities screen.

Like @chairstacker points out, your entity name that you’re passing into states is obviously wrong–it cannot have any spaces. The actual entity name can be found like they describe in their post, using the States or Entities tools.

Also, even once you fix that, I don’t think your YAML is correct. At minimum, as you can see here, a properly configured state-based template sensor differs in several respects from your code. For example, you should be defining a state, not a value_template.

Are you in fact trying to define a state-based template sensor? Where does the code you pasted come from?

That looks really useful, but it doesn’t show on my system for some reason !

Yes, I saw that after I put this post on, I have corrected it but still nothing

Hi, thank you for your response, If I am really honest I am new to this and learning as I go, I am trying to get the two entities to add together to give one figure in my solar production.

Yeap… found this, it is now under Min/Max. seems to work OK. I would still like to understand the coding as I like to learn and now that I am getting into HA I think it is important to understand these things.

What exactly doesn’t show?

Info about the helper (integration): Min/Max - Home Assistant