Tiber Pulse + Futurehome SmartHub --> Get Counter Reading

I would like to make a Python script (as simple and short as possible) that gets my electricity counter reading when being played.
I have a Tibber Pulse, linked to a Futurehome SmartHub (old generation).
I have looked over the internet and can’t find the advise I need.
Can anyone recommend some procedure? Examples?
Thanks in advance

I have of course looked at the old API, but cannot get it to work.
This would be the preferred path…

I would recomment getting data from the MQTT server running on the FH hub.
MQTT contains most or all of the data available in Futurehome and can easily be read by a Python script.
As a start I would recommend downloading MQTT Explorer (https://mqtt-explorer.com/) and use this to explore data.
To use it you need to create a user and password for the MQTT server if not already done. In the app Hub settings → Local API settings.
And you will need the IP adrress of the hub to connect.

This will allow you to explore all data available on the MQTT server on the hub.

In python I have used paho.mqtt.client to get data.
I would recommend to read How to Use MQTT in Python with Paho Client | EMQ or similar if you are not familiar with MQTT.

I can probably also provide some code examples if needed.

Thanks a lot for your reply, really appreciated! I will look into this.
Some examples of code would definitely help.
Can you tell me if MQTT server can run on old versions of the Hub ?

The MQTT server is a part of the HUB software and should be running there. Without knowing it I would assume the the FH app is talking to this MQTT server.

Below is a pyhon example I wrote two years ago when trying to learn about MQTT.
It subscribes to data (topic) for my Eva HAN server pt:j1/mt:evt/rt:dev/rn:zigbee/ad:1/sv:meter_elec/ad:1_1 and print data as the MQTT server makes them available.

Use the MQTT explorer to get the name (topic) for the Tibber HAN sensor. There are probably other things as well that needs to be changed tor Tibber.

import json
from datetime import datetime
from time import mktime
import paho.mqtt.client as mqtt

def timemark(timestamp):
    date = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%f%z").date()
    time = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%f%z").time()
    dt0 = datetime.combine(date, time)
    msepoc = int((mktime(dt0.timetuple()) + dt0.microsecond/1000000.0)*1000)
    return dt0, msepoc

def print_pdata(jdata, report, dt0, msepoc):
    power = 0
    i1 = float(jdata["val"]["i1"])
    i2 = float(jdata["val"]["i2"])
    i3 = float(jdata["val"]["i3"])
    u1 = float(jdata["val"]["u1"])
    u2 = float(jdata["val"]["u2"])
    u3 = float(jdata["val"]["u3"])
    print(f'{report} \t{dt0} \t{msepoc} \t{power:7.1f}W\t({i1:6.3f}A {i2:6.3f}A {i3:6.3f}A)  ({u1:5.1f}V {u2:5.1f}V {u3:5.1f}V)')

def on_connect(m_client, userdata, flags, rc0):
    print(f"Connected with result code {rc0}")

def on_message(m_client, userdata, msg):
    data = json.loads(msg.payload)
    report = data["type"]
    timestamp = data["ctime"]
    (dt0, msepoc) = timemark(timestamp)

    if report == "evt.meter.report":
        power = float(data["val"])
        unit = data["props"]["unit"]
        print(f'{report} \t{dt0} \t{msepoc} \t{power:7.1f}{unit}')

    if report == "evt.meter_ext.report":
        print_pdata(data, report, dt0, msepoc)

client = mqtt.Client("mqtt-test")
client.on_connect = on_connect
client.on_message = on_message
client.username_pw_set("username", "password")
client.connect('', 1884, 300)


Thanks a lot, I have good progress with this.
The problem I have now is to impose the local ip address of the smarthup. How can this be done?
In MQTT Explorer, I can use cube.local, but in the python script, the same thing does not work. Why?

Can’t you just use the iP adress?
I have set my router to use a fixed IP adress for the FH hub.
Works ok on all v1.x hubs, more troublesome on the v2 hub.