MyEnergi units integration

Hello i am trying to configure my home assistant and started with my power system at home with units “myenergi” units (a zappi charger and a harvi grid meter).

i can get these two scripts to work by itself but never at the same time and i simply cannot find any documentation on how i do this.

So my question is simply how do i merge them both so that i can have sensors from both in the same view in home assistant ?

i am sorry for this kind of noob question but trying to learn and not finding the right instructions, any hint is good for me.

If needed i can of course attach my failed trials and the real response from the myenergi hub.

best regards Pontus

Blockquote

  • platform: rest
    name: Harvi EVSE
    resource: https://s3.myenergi.net/cgi-jstatus-H
    device_class: power
    scan_interval: 60
    timeout: 30
    authentication: digest
    username: !secret myenergi_username
    password: !secret myenergi_password
    headers:
    User-Agent: Home Assistant
    Content-Type: application/json
    Accept: application/json
    unit_of_measurement: kW
    value_template: ‘OK’
    json_attributes:

    • harvi
  • platform: template
    sensors:
    gridphase1:
    friendly_name: ‘Grid Phase 1’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.harvi_evse.attributes[“harvi”][0][“ectp1”] is defined %}
    {{ states.sensor.harvi_evse.attributes[“harvi”][0][“ectp1”] / 1000 }}
    {% else %}
    0
    {% endif %}
    gridphase2:
    friendly_name: ‘Grid Phase 2’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.harvi_evse.attributes[“harvi”][0][“ectp2”] is defined %}
    {{ (states.sensor.harvi_evse.attributes[“harvi”][0][“ectp2”]) / 1000 }}
    {% else %}
    0
    {% endif %}
    gridphase3:
    friendly_name: ‘Grid Phase 3’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.harvi_evse.attributes[“harvi”][0][“ectp3”] is defined %}
    {{ (states.sensor.harvi_evse.attributes[“harvi”][0][“ectp3”]) / 1000 }}
    {% else %}
    0
    {% endif %}
    gridtotal:
    friendly_name: ‘Grid total’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.harvi_evse.attributes[“harvi”][0][“ectp3”] is defined %}
    {{ ((states.sensor.harvi_evse.attributes[“harvi”][0][“ectp1”]) +
    (states.sensor.harvi_evse.attributes[“harvi”][0][“ectp2”]) +
    (states.sensor.harvi_evse.attributes[“harvi”][0][“ectp3”])) / 1000 }}
    {% else %}
    0
    {% endif %}

Blockquote

and

Blockquote

  • platform: rest
    name: Zappi EVSE
    resource: https://s3.myenergi.net/cgi-jstatus-Z
    device_class: power
    scan_interval: 60
    timeout: 30
    authentication: digest
    username: !secret myenergi_username
    password: !secret myenergi_password
    headers:
    User-Agent: Home Assistant
    Content-Type: application/json
    Accept: application/json
    unit_of_measurement: kW
    value_template: ‘OK’
    json_attributes:

    • zappi
    • harvi
  • platform: template
    sensors:
    chargerphase1:
    friendly_name: ‘Charger Phase 1’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.zappi_evse.attributes[“zappi”][0][“ectp1”] is defined %}
    {{ states.sensor.zappi_evse.attributes[“zappi”][0][“ectp1”] / 1000 }}
    {% else %}
    0
    {% endif %}

    chargerphase2:
    friendly_name: ‘Charger Phase 2’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.zappi_evse.attributes[“zappi”][0][“ectp2”] is defined %}
    {{ states.sensor.zappi_evse.attributes[“zappi”][0][“ectp2”] / 1000 }}
    {% else %}
    0
    {% endif %}

    chargerphase3:
    friendly_name: ‘Charger Phase 3’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.zappi_evse.attributes[“zappi”][0][“ectp3”] is defined %}
    {{ states.sensor.zappi_evse.attributes[“zappi”][0][“ectp3”] / 1000 }}
    {% else %}
    0
    {% endif %}

    chargertotal:
    friendly_name: ‘Charger total’
    unit_of_measurement: kW
    device_class: power
    value_template: >
    {% if states.sensor.zappi_evse.attributes[“zappi”][0][“ectp3”] is defined %}
    {{ ((states.sensor.zappi_evse.attributes[“zappi”][0][“ectp1”]) +
    (states.sensor.zappi_evse.attributes[“zappi”][0][“ectp2”]) +
    (states.sensor.zappi_evse.attributes[“zappi”][0][“ectp3”])) / 1000 }}
    {% else %}
    0
    {% endif %}

    chargervoltage:
    friendly_name: ‘Charger Phase Voltage’
    unit_of_measurement: V
    device_class: power
    value_template: >
    {% if states.sensor.zappi_evse.attributes[“zappi”][0][“vol”] is defined %}
    {{ states.sensor.zappi_evse.attributes[“zappi”][0][“vol”] }}
    {% else %}
    0
    {% endif %}
    chargertime:
    friendly_name: ‘Charger Time’
    unit_of_measurement: CET
    device_class: power
    value_template: >
    {% if states.sensor.zappi_evse.attributes[“zappi”][0][“tim”] is defined %}
    {{ states.sensor.zappi_evse.attributes[“zappi”][0][“tim”] }}
    {% else %}
    0
    {% endif %}

Blockquote

1 Like