NIBE Heat Pump Monitoring using Python instead of Perl

One of the most popular topics on this Blog is using the NIBE Uplink API to retrieve operational data reported by the Internet-connected NIBE heat pumps. That API is protected by OAuth2 authentication, which is a robust solution but which is rather more complicated than other APIs which simply expect an API Key or a non-expiring Token for authentication purposes.

There’s a Technical Articles page dating from 2016 which explains how to use the Perl scripting language on Linux to call the NIBE Uplink API, navigating the multiple steps of the OAuth2 handshake – see NIBE Heat Pump Monitoring via NIBE Uplink API (Perl Version). I originally chose Perl because that’s the language I was familiar with – and there was a Perl Module which handled many of the OAuth2 complexities.

Recently I’ve been learning Python for work and that’s proven to be a bit more friendly for this sort of thing. It’s also a language that more people are familiar with – and it’s rather more commonly used on different platforms, notably Microsoft Windows.

I’ve therefore adapted the original Technical Article to use Python rather than Perl and published that as NIBE Heat Pump Monitoring via NIBE Uplink API (Python Version). The Perl version is still relevant so will remain available too (especially since it has some valuable comments and responses) but my advice is for new users to follow the Python version instead.

I’ve also included some more general updates (such as the new NIBE S-Series heat pumps using an alternative API connected to myUplink.com) and some new screenshots. The script code is also now in a GitHub Repository rather than being embedded in the Blog page – and I intend to add some more comprehensive script examples once I migrate my other scripts from Perl to Python.

SMETS2 Meter Installed

After being on the Octopus Energy smart meter installation waiting list for 3 months (not helped by Covid-19 working restrictions) the old ‘dumb’ meter was replaced with a SMETS2 smart meter today. A very neat and tidy installation by Privodor who are recruiting and training new installers to help with the backlog. (I don’t know why those meter tails with coloured sheathing, originally installed by SSE, aren’t more widely available / used.)

As expected it had no issues with getting a Telefonica (O2) signal and it commissioned straight away. Once it registers with Octopus I’ll be switched to their Agile tariff.

SMETS2 Meter installed in the outdoor Meter Cabinet

A pleasant surprise is that the supplied Chameleon IHD6 in-home display had no issues with range (the cabinet is about 15m from the house) and it’s (mostly) picking up a signal in the middle of the house. After enabling WiFi on the IHD6 it’s evident it’s publishing readings using MQTT-in-TLS – but it only seems to be configured to send these direct to Chameleon.