Nicd

Nicd

We have geothermal heating at home, using a Thermia Calibra 7 pump. The pump has an online feature, but the UI is not really optimal for seeing the status of several sensors at a glance. So at my company’s hacking weekend this year, I decided to write such a UI. It’s very rough around the edges (of which there are many) and very minimal, but I had such fun making it that I wanted to share it.

The code is at Mikko Ahlroth / GeoTherminator · GitLab. It uses Phoenix LiveView to basically render a big SVG (that I drew in diagrams.net) and live update it with the new data. It also has two friendly buttons for changing the target room temperature (which are slow as molasses due to the online service being slow to access the pump). The UI is very “engineer”, I’m no designer. :003: Here’s an example:

I have it running on a Raspberry Pi at home, with an old phone serving as the display:

(Not final placement, just some prototyping.)

The Thermia online service has no public APIs that I know of, so I reverse engineered the HTTP calls sent by the browser. Sadly that also means the app requires a username/password pair to grab the authentication token. I could refactor it to only ask for the username/password on startup via the UI and not store it anywhere, but that’s something for the future as I don’t mind it myself.

In the future I might add some informative graphs, but that would require getting a bigger display. If I can score a small HDMI display somewhere, I can run it directly off the Raspberry without having a phone in the middle.

Disclaimer

Your pump and home are at risk! Do not trust anyone with your account username and password. If you do not understand all the code contained in this software, do not use it. If you do not understand how to compile and deploy Elixir projects, do not use this. Honestly, just use the online service. That way you can’t break your pump and void your warranty.

Showing Posts 1 to 8

Nicd

Nicd OP

Oh, an interesting thing I bumped into while writing it. The Mojito HTTP client would add a transfer-encoding: chunked header to the request behind the scenes. This made the Thermia API barf a 502 error for everything except the login endpoint. Really took me a long time to find out as I couldn’t see that header by inspecting my request, I had to install mitmproxy to debug what was going over the wire (now thinking back, I could have probably IEx.Pry’d it somehow?).

In the end I switched to Finch which didn’t send that header and everything started working again. :man_shrugging:

AstonJ

AstonJ

This is very cool Mikko! Tho I am not sure what is cooler, that you did this in Elixir or that you have geothermal heating :003: Bravo on both counts :023:

Nicd

Nicd OP

Geothermal heating is more and more popular here because it uses a lot less electricity than resistive electric heating and you’re not tied to the district heating network.

It’s good to note that it’s not the kind of geothermal where heat just bubbles out of the ground and comes from the Earth’s core like in Iceland. Here you would have to go kilometers deep to get that. Our thermal well is 140 meters deep and it’s instead the sun’s heat that is absorbed into the ground during the summer that is then used with the pump during winter. So it’s essentially indirect solar energy. I guess sometimes it’s called ground heating?

outlog

outlog

nice one!

you could even try to run everything on the android using elixir-desktop · GitHub

cpgo

cpgo

Agree on that, really cool.
Reminds me of the biggest heat pump fan in youtube

Nicd

Nicd OP

My Raspberry Pi that I used to host this app on just ate another memory card. So I decided to adapt it to an elixir-desktop app that I could run directly on the phone. Just ran it the first time: https://twitter.com/AmNicd/status/1563253296101756929

Thanks to @dominicletz for the awesome library. :heart: Now I need to clean it up and commit to git.

Nicd

Nicd OP

I’ve finally refactored the code a bit to ask for the user credentials instead of them being built into the APK. It also has CubDB for storing credentials and what view to restore the app to when it restarts (very dirty implementation).

Here it is deployed in the target environment:

Nicd

Nicd OP

Some time ago, the Thermia Online API was changed and this broke GeoTherminator. The login API was changed from an easy one to a devil’s Azure B2C API. Since I had to fix the app anyway, I thought I might as well learn Gleam while I’m at it.

So GeoTherminator is now running as a mixed Gleam and Elixir application! I just got the first working build running on my phone. I guess elixir-desktop could be renamed beam-desktop now, @dominicletz. :wink:

You can still find the sources at Mikko Ahlroth / GeoTherminator · GitLab, but be warned, the Gleam code is quite undocumented and probably unidiomatic, as I’m a total newbie there. On the Elixir side, all I had to do was replace some structs with records and type up their defrecords to match the Gleam data types.

I plan to continue gleamifying the rest of the core code. Then I might take a stab at seeing how far into the Phoenix web stuff I could reach into with Gleam, but I can’t promise too much because I already have other things in the pipeline (and a long Steam backlog!).

If you have any questions, I’d be happy to hear them!

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91898 914
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews