Creating an API and Web UI for my District Heating System

Georg Dangl by Georg Dangl in Home Automation Thursday, July 13, 2023

Thursday, July 13, 2023

Posted in DotNet

A few months ago, we had a new heating system installed. It's a district heating system, with the heat exchange being controlled by a Schneid MR 12 control unit. From a heating perspective, it's a pretty simple concept: Two pipes go in your hose, one delivers hot water to a heat exchanger, the other carries the slightly colder water away. We're now part of a small network of 15 houses that use a central energy source for their heating and warm water needs.

It's working great, and replaced our own wood chip fired system. Now, with a new system, I naturally wanted to be able to get some data out of it and have the ability to control it remotely. I looked into some options, and I have to say, it's all a bit less comfortable than what we software engineers are used to with modern cloud systems. Nevertheless, the manufacturer could provide me with a network card, which makes a Modbus TCP interface available. It's quite an ancient protocol, having no security features or really anything besides reading and writing raw "registers", but it's quite well established in electronic engineering and thus has a wide range of libraries and packages available. The security part was pretty easy to take care of, by isolating it in the network and only granting specific hosts access.

For the actual API part, I've gone for a regular ASP.NET Core backend with an Angular frontend. The Modbus TCP connection is handled by FluentModbus, which provides an easy wrapper around the Modbus protocol so we can just use it to read and write binary data.

Finally, I've built a dashboard as the main entry point:

Dangl.SchneidControl Dashboard

It's great for a quick visualization of the data, and with a local SQLite database, I can even periodically log some data points and visualize them, like the outside temperature:

Dangl.SchneidControl Data Logging

There are also some properties that can be edited, like target temperatures or the operation mode of the system. And, all of those values are exposed via a REST API, so you can integrate the sensors e.g. as RESTful sensors in Home Assistant.

You can find the project directly on GitHub.

Happy heating!


Share this post


comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.

DanglIT

Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

Dangl.Blog();
// Just 💗 Coding

Social Links