Reading Energy Data from HAN Port?

I investigated a bit and found the m2m interface for the Theben Conexa 3.0 at /smgw/m2m/.
The endpoint is always the same but the query is sent in the body with the key method. So to get the current readings you need to do two requests.
First get the usage-point-id via method user-info. Make sure to use Digest Auth (for trying out I used Postman):

POST /smgw/m2m/ HTTP/1.1
Host: 192.168.66.99
Authorization: Digest username=...
Accept: application/json
Content-Type: application/json

{
    "method": "user-info"
}  

this should return something like this

{
    "elapsed-time": "1089 miliseconds",
    "method": "user-info",
    "user-info": {
        "usage-points": [
            {
                "billing-Periods": [
                    {
                        "end-time": "2024-02-01T00:00:00Z",
                        "start-time": "2024-01-10T18:00:00Z"
                    },
                    {
                         "start-time": "2024-01-01T00:00:00Z"
                    }
                ],
                "capture-time": "00:00:00",
                "delivery-id": "xxx",
                "end-time": "2025-02-10T22:00:00Z",
                "meter": [
                    {
                        "meter-id": "xxx"
                    }
                ],
                "metering-point-id": "xxx",
                "on-demand-profile-configured": "true",
                "start-time": "2024-01-01T00:00:00Z",
                "taf-number": "1",
                "taf-state": "running",
                "usage-point-id": "abc",
                "usage-point-name": "xxx"
            },
            ...
        ]
    },
    "version": "1.3.0"
}

note that there could be several usage-points. Check for the one with "taf-state": "running" and note down the usage-point-id.

Now you can query the latest readings like so:

POST /smgw/m2m/ HTTP/1.1
Host: 192.168.66.99
Authorization: Digest username=...
Accept: application/json
Content-Type: application/json

{
    "method": "readings",
    "database": "origin",
    "usage-point-id": "abc",
    "last-reading": "true"
}

This will get the latest reading:

{
    "elapsed-time": "44 miliseconds",
    "method": "readings",
    "readings": {
        "channels": [
            {
                "obis": "xxx",
                "readings": [
                    {
                        "capture-time": "2025-02-20T20:14:57Z",
                        "cosem-status": "xxx",
                        "meter-status": "xxx",
                        "owner-number": "xxx",
                        "signature": "xxx",
                        "smgw-status": "xxx",
                        "target-time": "2025-02-20T20:15:00Z",
                        "value": "123456"
                    }
                ]
            }
        ],
        "records": "1"
    },
    "version": "1.3.0"
}

The value is the energy reading. The last 4 digits are decimal places so the example above would be 12,3456 kWh.
In my case it gave me a new reading every quarter of an hour but this might vary.

If this is working setting up a REST sensor within Home Assistant is straight forward:

sensor:
  - platform: rest
    name: energy
    unique_id: my_energy_data
    unit_of_measurement: kWh
    scan_interval: 900 # 15 min
    timeout: 20
    resource: https://192.168.66.99/smgw/m2m/
    method: POST
    username: <username>
    password: <password>
    authentication: digest
    verify_ssl: false # the SMGW uses a self-signed cert
    headers:
      Content-Type: application/json
      Accept: application/json
    payload: |
        {
            "method": "readings",
            "database": "origin",
            "usage-point-id": "abcd",
            "last-reading": "true"
        }
    value_template: "{{ float(value_json.readings.channels[0].readings[0].value) / 10000 }}"

This setup is running successful for me quite a while now without any issues. I’m not doing the usage-point-id lookup for the reading but not sure if the usage-point-id might change.

Some notes:

  • For this to work, the home assistant server needs to be in the same subnet as the SMGW (in this case 192.168.66.0). Querying from another subnet e.g. 192.168.0.0 won’t work.
  • There are more methods and parameters to discover like the device log, or daily readings but I didn’t bother as my goal was just to get the latest readings.

Hope this helps someone!

2 Likes