Micro Grid Inverter Envertech integration

Is anyone using the Envertech micro Grid inverter, for producing Solar Power?

The Envertech Website has an API for the Data. https://www.envertecportal.com

An IO Broker Integration is already available: https://github.com/adcrafter27/ioBroker.envertech-pv

Is it possible to apply it for an Homeassistant Integration?

I’m not able to create it myself, perhaps anyone can help me to do this.

Me too is very keen on having an integration with their data. However, writing an integration is beyond me.

1 Like

Here is a simple integration described (in German): https://tomapor.de/download/Envertech%20Integration.pdf

documentation updated #2: 13.03.2021
documentation updated #3: 10.08.2021 (update phyton-script for compatibility core-2021.8.5)

2 Likes

Hello, i followed the description mentioned above

“Zunächst benötigt man die eigene PID, die man per F12 aus dem Envertech Portal
(https://www.envertecportal.com) ermittelt. Am besten nach stationID suchen. Die PID ist eine
32stellige HEX-Zahl.”

but not get the 32 digit HEX StationID, but only get instead the PID only 4 digits.

Can anyone help me? Thank you.

1 Like

You need to search for stationId: no stationID: this is done in the web developer tools in the inspector tab… When you search for stationId then you will get a 32 Hex. Hope this helps

For those who have node-red installed on Home Assistant I wrote this flow which is way easier then a script:

[
    {
        "id": "90236b67.e1466",
        "type": "inject",
        "z": "692a85b207f3c084",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "*/15 8-21 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 310,
        "y": 160,
        "wires": [
            [
                "413272a1.c40e84"
            ]
        ]
    },
    {
        "id": "413272a1.c40e84",
        "type": "http request",
        "z": "692a85b207f3c084",
        "name": "Envertech",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "https://www.envertecportal.com/ApiStations/getStationInfo?stationId=IMPORTANT ADD 32 DIGIT ID HERE",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "credentials": {
            "user": "",
            "password": ""
        },
        "x": 480,
        "y": 160,
        "wires": [
            [
                "855b5f6.0b7092"
            ]
        ]
    },
    {
        "id": "855b5f6.0b7092",
        "type": "json",
        "z": "692a85b207f3c084",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 290,
        "y": 240,
        "wires": [
            [
                "ffe8e97f.8cf26",
                "7566c765e37a9b59"
            ]
        ]
    },
    {
        "id": "ffe8e97f.8cf26",
        "type": "ha-entity",
        "z": "692a85b207f3c084",
        "name": "CurrentPower",
        "server": "cbb458bc.e8ad88",
        "version": 1,
        "debugenabled": true,
        "outputs": 1,
        "entityType": "sensor",
        "config": [
            {
                "property": "name",
                "value": "solar.currentpower"
            },
            {
                "property": "device_class",
                "value": ""
            },
            {
                "property": "icon",
                "value": "mdi:solar-panel"
            },
            {
                "property": "unit_of_measurement",
                "value": "W"
            }
        ],
        "state": "payload.Data.Power",
        "stateType": "msg",
        "attributes": [],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": false,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 460,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "7566c765e37a9b59",
        "type": "function",
        "z": "692a85b207f3c084",
        "name": "",
        "func": "var payload=msg.payload.Data.UnitETotal;\nmsg.payload=parseFloat(payload.substring(0, payload.length - 4));\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 280,
        "y": 320,
        "wires": [
            [
                "c8d65c0d.51b59"
            ]
        ]
    },
    {
        "id": "c8d65c0d.51b59",
        "type": "ha-entity",
        "z": "692a85b207f3c084",
        "name": "solarPower",
        "server": "cbb458bc.e8ad88",
        "version": 1,
        "debugenabled": true,
        "outputs": 1,
        "entityType": "sensor",
        "config": [
            {
                "property": "name",
                "value": "solarPower"
            },
            {
                "property": "device_class",
                "value": "energy"
            },
            {
                "property": "icon",
                "value": "mdi:solar-panel"
            },
            {
                "property": "unit_of_measurement",
                "value": "kWh"
            }
        ],
        "state": "payload",
        "stateType": "msg",
        "attributes": [
            {
                "property": "state_class",
                "value": "measurement",
                "valueType": "str"
            },
            {
                "property": "last_reset",
                "value": "2020-05-13T22:00:00+00:00",
                "valueType": "str"
            }
        ],
        "resend": true,
        "outputLocation": "",
        "outputLocationType": "none",
        "inputOverride": "allow",
        "outputOnStateChange": false,
        "outputPayload": "$entity().state ? \"on\": \"off\"",
        "outputPayloadType": "jsonata",
        "x": 450,
        "y": 320,
        "wires": [
            []
        ]
    }
]
1 Like

Hi!
I have been looking for a vanilla way (without custom python script or Node-red) of adding support for the Envertech interface. After a lot of digging through other open source projects, this thread, some Postman trial/error, I think I finally have found a fairly easy way for anyone who wants to add support:

The following code snippet shall be added to customizations.yaml and gives you two sensors - one for your stations total current power, and one for your stations total energy.

rest:
  - resource: https://www.envertecportal.com/ApiStations/getStationInfo
    method: POST
    params:
      stationID: "[INSERT YOUR 32 HEX STATION ID]"
    sensor:
     - name: "Solar total Power"
       value_template: "{{ value_json.Data.Power|float }}"
       device_class: power
       unit_of_measurement: "W"
       json_attributes_path: "$.Data"
       json_attributes:
         - PowerStr
         - StrPeakPower
       state_class: measurement
     - name: "Solar total Energy"
       value_template: "{{ value_json.Data.UnitETotal|replace(' MWh','')|replace(' KWh','')|float}}"
       device_class: energy
       unit_of_measurement: "kWh"
       json_attributes_path: "$.Data"
       json_attributes:
         - UnitEToday
         - UnitEMonth
         - UnitEYear
         - UnitETotal
       state_class: total_increasing

As stated in a previous post, you’ll find your 32 HEX stationId using the developer tool when logged into envertechportal.com

If you would like to monitor individual microninverters, then add the following code snippet to customizations.yaml, directly after the previous snippet, continuing rest:.
In this example, there are a total of two microinverters, with two sensors each - one for power and one for energy.

  - resource: https://www.envertecportal.com/ApiInverters/QueryTerminalReal
    method: POST
    params:
      page: "1"
      perPage: "20"
      orderBy: "SNALIAS"
      whereCondition: '{"STATIONID":"[INSERT YOUR 32 HEX STATION ID]"}'
    sensor:
      - name: "Solar inverter 1A Power"
        value_template: "{{ value_json.Data.QueryResults[0].POWER }}"
        device_class: power
        unit_of_measurement: "W"
        json_attributes_path: "$.Data.QueryResults[0]"
        json_attributes:
          - SN
          - SNALIAS
          - STATUS
        state_class: measurement
      - name: "Solar inverter 1A Energy"
        value_template: "{{ value_json.Data.QueryResults[0].ENERGY }}"
        device_class: energy
        unit_of_measurement: "kWh"
        json_attributes_path: "$.Data.QueryResults[0]"
        json_attributes:
          - DAYENERGY
          - SN
          - SNALIAS
          - STATUS
        state_class: total_increasing
      - name: "Solar inverter 1B Power"
        value_template: "{{ value_json.Data.QueryResults[1].POWER }}"
        device_class: power
        unit_of_measurement: "W"
        json_attributes_path: "$.Data.QueryResults[1]"
        json_attributes:
          - SN
          - SNALIAS
          - STATUS
        state_class: measurement
      - name: "Solar inverter 1B Energy"
        value_template: "{{ value_json.Data.QueryResults[1].ENERGY }}"
        device_class: energy
        unit_of_measurement: "kWh"
        json_attributes_path: "$.Data.QueryResults[1]"
        json_attributes:
          - DAYENERGY
          - SN
          - SNALIAS
          - STATUS
        state_class: total_increasing

Repeat the above for as many microinverters you have, each time increasing the QueryResults[0], QueryResults[1], QueryResults[2]… and so on.

Hope this helps someone. This method can be used to add the solar production to Home Assistant’s Energy dashboard.

Known limitations:

  • The attributes of the Solar total Power are not floats, but strings containing the unit W.

I’m only ghetting a 4 digit StationID, too. Could anyone kindly explain how to extract this information?

Simple: the 4-digit ID was fine.

HI Guys,
does anyone have a step-by-step instruction for people like me who don’t have a clue :sweat_smile:

I already tried the in instruction here: https://tomapor.de/download/Envertech%20Integration.pdf but unfortunately without success.
I get this Error “Exception in </config/pyscript/getpv.py> line 11: response = task.executor(requests.post, url, headers=headers, data=payload) ^ NameError: name 'headers' is not defined

Can anyone help?

Add the following to your configuration.yaml:

rest:

  • resource: https://www.envertecportal.com/ApiStations/getStationInfo
    method: POST
    params:
    stationID: “YOUR-OWN-ID-GOES-HERE”
    sensor:
    • name: “Solar total Power”
      value_template: “{{ value_json.Data.Power|float }}”
      device_class: power
      unit_of_measurement: “W”
      json_attributes_path: “$.Data”
      json_attributes:
      • PowerStr
      • StrPeakPower
        state_class: measurement
    • name: “Solar total Energy”
      value_template: “{{ value_json.Data.UnitETotal|replace(’ MWh’,’’)|replace(’ KWh’,’’)|float}}”
      device_class: energy
      unit_of_measurement: “kWh”
      json_attributes_path: “$.Data”
      json_attributes:
      • UnitEToday
      • UnitEMonth
      • UnitEYear
      • UnitETotal
        state_class: total_increasing
1 Like

Great! Thank you!

So I can delete the python script?

yes, that is not needed.

Is it possible to create separate sensors for UnitEToday and UnitEMonth?

hello,

with home assistant version 2022.9.6 I wanted to test the rest implementation for my envertec converter.
with this entry in the configuration.yaml I was able to read the total engery (kWh):

rest:
    - authentication: basic
      resource: https://www.envertecportal.com/ApiStations/getStationInfo
      scan_interval: 60
      method: POST
      params:
        stationID: "yourID"
      sensor:
        - name: SolarTotalPower
          value_template: "{{ value_json.Data.Power|float }}"
          device_class: power
          unit_of_measurement: "W"
          json_attributes_path: "$.Data"
          json_attributes:
            - "PowerStr"
            - "StrPeakPower"
          state_class: measurement      
        - name: SolarTotalEnergy
          value_template: "{{ value_json.Data.UnitETotal|replace(' MWh','')|replace(' KWh','')|float}}"
          device_class: energy
          unit_of_measurement: "kWh"
          json_attributes_path: "$.Data"
          json_attributes:
            - "UnitEToday"
            - "UnitEMonth"
            - "UnitEYear"
            - "UnitETotal"
          state_class: total_increasing

I give an update next day if the current power is also working (currently no sun :wink: )

Update: all is working fine!

2 Likes

I guess if you just change this line:
value_template: "{{ value_json.Data.UnitETotal|replace(' MWh','')|replace(' KWh','')|float}}"
copy the complete block from name to state_class and change to the attribute you want. this adds an additional entity you can use. this should work.

you can also use the attributes to switch between your energy attributes (today, moneth, year, total)!

It this still working for everybody? After more than a year of working fine, I am now getting this error ont the QueryTerminalReal call:

2023-01-29 12:20:57.527 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.rest
2023-01-29 12:20:57.527 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from https://www.envertecportal.com/ApiInverters/QueryTerminalReal
2023-01-29 12:20:57.527 ERROR (MainThread) [homeassistant.components.rest] Unexpected error fetching rest data data: Expected str, int, float, bool, or None. Got 'Wrapper'.
  File "/usr/src/homeassistant/homeassistant/components/rest/data.py", line 63, in async_update
2023-01-29 12:20:57.529 DEBUG (MainThread) [homeassistant.components.rest] Finished fetching rest data data in 0.002 seconds (success: False)

The other call works fine (but does not give me enough data by itself):

2023-01-29 12:20:58.123 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from https://www.envertecportal.com/ApiStations/getStationInfo
2023-01-29 12:20:59.403 DEBUG (MainThread) [homeassistant.components.rest] Finished fetching rest data data in 1.280 seconds (success: True)

My config (hasn’t changed recently):

  - resource: https://www.envertecportal.com/ApiInverters/QueryTerminalReal
    method: POST
    params:
      page: "1"
      perPage: "20"
      orderBy: "SNALIAS"
      whereCondition: '{"STATIONID":"66AA551.........678E9"}'

The weird thing is that this command works for me when run from a command line:

curl 'https://www.envertecportal.com/ApiInverters/QueryTerminalReal' -X POST --data-raw 'page=1&perPage=20&orderBy=SNALIAS&whereCondition=%7B%22STATIONID%22%3A%2266AA551.........678E9%22%7D'

But it does not work from Home Assistant anymore. Ideas, anyone?

I was thinking that perhaps it’s an issue on the encoding of the station id. My configuration file is stored in UTF-8 format. Is yours too?

Hi,

have you found an answer? We have the same problem.

Best regards

Claudia

I have not found an answer, but there must be more people with this problem. I hope the experts/developers can help us out.

Same problem, reports “unavailable” at intervalls. I have changed scan_intervall to 60s, maybe this lowers load on the envertech server

+1 It also stopped working here after a year on the 20th February.