Electricity meter and IoT Open
The data from IoT Open presented in Grafana. How the data is acquired is the focus of this article.

Electricity meter and IoT Open

Disclaimer: I'm working with IoT Open but this article is my own work written in my spare time about a project also done in my spare time. Because I think it's fun I also like to share it.

No one can have missed the crisis around electricity and the prices that comes with it. I will not go into politics here since that's not my ballpark at all. But there is always a reason to play with some cool stuff.

As some of you may know one of my interests are boating and in my boat I have full control of the electricity going to and from the battery bank. In our home we do not. Time to change this.

I have a Aidon electricity meter with a RJ45 HAN port. There are several ways to get the data from it. Some research made it clear that it is sending MBUS-data. There are several ways to read that data, but I found that a Tibber Pulse was the easiest way for me. There are however cheaper and probably more fun ways to do it. One source of inspiration is https://hanporten.se/. The Pulse was very easy to install due to its casing with a magnet and WiFi. It is also powered from the RJ45 which makes the installation a breeze.

I like to have my home working even though the internet connection for some reason is down or something else happens. Therefore it is not acceptable for me to have the data sent from my electricity meter to some external part like Tibber to get parsed and then sent back to me. The Tibber service does that by default but the Tibber Pulse doesn't have to do this, you can set it to send data to wherever you like. That is a very nice feature that I really hope will remain in future versions as well since it is a really nice.

Step one is to have the Tibber Pulse send data to a MQTT-server that I control. Since I want to have the data locally I send the data to a IoT Open Edge Client in my home. The Edge Client have a MQTT-broker running locally that I can send the data to. To configure the Pulse i booted it with USB power from my laptop. Then it acts as an access point and creates an open WLAN that I can connect my laptop to. In my case it created a network 10.133.70.0/24 and the Pulse was on 10.133.70.1. I could connect to it on https://10.133.70.1. The settings are really simple. You need to add SSID and PSK of the network it should connect to and the address and the port of the MQTT-server. I have an open MQTT-server on my LAN so in my case it is the ip-address and port 1883. The only strange thing is that it seems like the update_url field is mandatory. If it is not filled in the data is not saved. Or at least that is what happened to me. But putting anything there seems to do the trick. I chose the same address as the mqtt-server but since it's named url i put https:// there also. It worked!

Then it was just a matter of plugging in the Pulse on the electricity meter. Since it is powered from the meter and has a magnetic case and the cabinet fot the meter is metallic it was literally less than a minute to install it. And after a few seconds data started coming on the MQTT-bus. The first message is really easy to read since it is clear-text JSON. For a moment I really thought this was a 20 minutes project. But those doesn't really exist. I just started to doubt when my suspicion was confirmed. A blob of binary data turned up on the screen. Bah, what was it? I obviously need to add some code here. But what am I looking at? Next step must be understanding the data I'm looking at.

Somewhere I read that it might be MBUS-data. And that might be correct. Then i found a Node-RED node that did an interpretation of these messages. I did take a look at the code and realized it was very simple. The code just searches for patterns in the data and then picks the values from that. Not sure if it is the best way, but it works and that is good enough for me. Inspired by this code in Javascript I wrote my own Edge App for the IoT Open Platform so it would be easy to use.

No alt text provided for this image
The Egde app configuration interface in IoT Open. It only needs an identifier for the meter so that one installation can have multiple meters and the topic this meter publish its data to,

The Edge app is quite simple. The code for it is available in the link above. It's really easy to install and configure once you have the right prerequisites. You will need a Tibber Pulse connected to you meter. You don't need a Tibber account. You will also need an IoT Open installation with an Edge client that can be reached from your Tibber Pulse.

Once the Edge app receives data it will create a device for it and the following functions.

No alt text provided for this image
The functions created in IoT Open for the electricity meter.

Now I can follow the energy we consume in the house in near realtime. The Tibber Pulse sends data every 10 seconds. I present the data as shown in the picture in the beginning of this article and also in a simple Node-RED dashboard.

If you try this out with any other meter e.g. with an RJ12 outlet or a meter of another brand it would be really nice if you could share your results.

As a complement to this I also wrote an Edge app fetching electricity spot prices. But that is the topic of another article.

#iot #iotopen #electricity #tibber

Jonas Enebrand

Founder, JEAB -eFrid V?lf?rdsteknologi

2 年

Great work!

Marcus Rej?s

Senior Software Architect. CPR Instructor. Swimming coach and official. Sailor. Alpine skier. Specialist in Free Software. @[email protected]

2 年

One big advantage from this setup is that I can se the phase balancing in near realtime and therefore now know what appliances are on which phase. I did not now that earlier and it is now very easy to see in real time as well as historic. This makes it easy to balance the load.

要查看或添加评论,请登录

Marcus Rej?s的更多文章

  • IoT Open Native WiFi sensor

    IoT Open Native WiFi sensor

    I'm working with IoT Open but this is a personal project of mine in the spare time. Just because it is fun.

    1 条评论
  • What is a horizontal IoT platform - and why should you bother?

    What is a horizontal IoT platform - and why should you bother?

    Disclaimer: I work for a IoT platform company, but this text and the thoughts in it are mine and not my employers…

    4 条评论
  • Monitor AED with Xarah and IoT

    Monitor AED with Xarah and IoT

    Background Today is Valentine's Day, or "every hearts day" as we call it in Sweden. A good day to think about heart…

    2 条评论
  • ADAX Heater control with IoT Open

    ADAX Heater control with IoT Open

    Disclaimer: I'm working with IoT Open but this article is my own work written in my spare time about a project also…

    2 条评论
  • Edge app for fetching spot prices

    Edge app for fetching spot prices

    Disclaimer: I'm working with IoT Open but this article is my own work written in my spare time about a project also…

社区洞察

其他会员也浏览了