Devi Smart

Here you go - Home Assistant + MQTT + Autodiscovery.

Have a fun!

2 Likes

@igor-podpalchenko thank you for making this, awesome that a way to get Devireg thermostats directly in HA is done!

But unfortunately, my skills are kind of limited to get the integration installed. I am running HA OS on a RPI5 and I cannot figure out how to install Java to run the commands. Do you have any tip on how to do that?

I got java running on a windows pc and the discovery running. I can add user name and the OTP and I see the user is added in the Devireg app on my phone. But the script keeps running and seemingly not getting proper contact with the thermostats, what do you think can cause that?

This is part of the messages it is generating:
22:01:42.315 [pool-8-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a2302c66ce657bf1b13c62417f1a57269b2a5b0b84b3553586975
22:01:42.317 [pool-7-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a2302c66ce657bf1b13c62417f1a57269b2aeb0b84b3553586975
22:01:42.318 [pool-6-thread-1] INFO i.h.b.d.internal.SDGPeerConnector - Connecting to peer 3e1ea4a23c66ce651b13c62417f1a57269b2a7eb0b8453586975
22:01:42.368 [pool-1-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1
22:01:42.384 [pool-2-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1
22:01:42.400 [pool-3-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1
22:01:42.416 [pool-4-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1
22:01:42.433 [pool-5-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1
22:01:42.450 [pool-6-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1
22:01:42.466 [pool-8-thread-1] WARN i.h.b.d.internal.SDGPeerConnector - Device went offline: Connection refused by grid: 1

Hi Ugglas,

Can you share a step-by-step guide on how you have managed with Java on Windows. I’m struggling with this bit.

@Hubszo I have still not managed to get the discovery function to work. I have now tried running the service on both Windows and Raspberry pi OS with the same results. So I do not think that I should give any guidance here :smiley:

I installed the Java 22 in Windows, used CMD to run

java -cp ha-devi-mqtt.jar io.homeassistant.devi.mqtt.service.DiscoveryService

from the folder where I placed the ha-devi-mqtt.jar file to start the discovery dialogue. But maybe I am running wrong Java version causing the issue, I am not sure.

After I enter user name, it gives the following messages and one error:
19:17:14.860 [main] INFO i.h.b.d.i.GridConnectionKeeper - Successfully connected to Danfoss grid
19:17:14.866 [main] ERROR i.h.d.mqtt.service.DiscoveryService - Cycle

Might possibly have something to do with that?

I’ve replied to you on github.
Ensure the host you using for pairing, is running on the same WiFi as thermostats.

Attach the full log there, please. It’s some odd behavior, as HA user was registered. But the code seems unable to reach thermostats themselves, to read their serial number to build MQTT topics.

There was a bug in the discovery code. Fixed in the latest build.

I’m using OpenHub integration for now. Want to clarify few thing about your HA integration.
Does Java library should be ran once on any machine (Mac laptop for example) just to get key/token for further use in HA on other hardware? Or it should be installed on ha itself?
After token received - I wold need just configure addon / Lovelace cards on HA and get all the day from my Devi thermostats via mqtt topics in ha?

You should run discovery once (or when you add more thermostats).
The software isn’t bound to HA instance, it just publishes data to MQTT (it supports HA auto-discovery, so all your devices will appear in HA under Devices → MQTT).
The software may be run anywhere, with access to the MQTT broker.

It does not require any additional HA cards, except the mentioned in guide to edit the thermostat schedule. You may always add it later (it’s not mandatory dependency).

Thank you @igor-podpalchenko for your work on this!

Apologies for this stupid question / could do with some basic guidance:

  • I copied the GIT URL
  • On my mac: git clone URL - which downloads the repository

There is no JAR file there so I assume I have to compile it. I tried that with the build.sh script but that throws various errors (see below)

So clearly - I’m doing something very wrong. Could someone point me in the right direction?

build-sh

Take the jar release or use docker. You don’t have those tools installed on your machine.

I now managed to get the integration to work, I now have the thermostats added to my HA :slight_smile:

The discovery did not produce a file for me but can generate the file based on the information that comes from running the discovery.

But I ended up running Raspberry Pi OS on a RPi4 I have extra just to run this docker and send MQTT to my HA on RPi5 as HA OS do not accept to run docker.

The climate entities are acting a little bit weird but I think that I can get it to work bu having the devireg thermostats all in manual mode and control them by HA and not use the devi schedule and so on.

A big advantage for me is that I now have access to the energy usage of each thermostat in HA and can monitor energy consumption for heating in each room. Also, now I can control the thermostats by smart functions depending on solar power production and electricity prices which will reduce my average price/kWh considerably.

1 Like

Thank you @igor-podpalchenko for the wonderful work you did here. I managed to install it and will add some comments to this thread which may help others / could be added to the README to make things a bit easier for others. But I still have two questions:

  1. The schedule in Home Assistant differs from the one in the DeviApp (Sat + Sun are blank). Would anyone know why this could be? Pictures attached and the mqtt value for the schedule is below

{“THU”:[“8688”,“90d6”],“TUE”:[“8688”,“90d6”],“WED”:[“8688”,“90d6”],“SAT”:[“87f6”],“FRI”:[“8688”,“90d6”],“MON”:[“8688”,“90d6”],“SUN”:[“87f6”]}

  1. How do I configure the dial (pointed to by the arrow in the last picture) / which value should this relate to?

HA
Devi
Dail

My notes on the installation which may help someone:

The JAR is I believe compiled with Azul Zula Java - at least that’s the only one I could get it to work with. I started with OpenJDK but it throws errors when you try to run it that the versions are wrong. The latest OpenJDK version is 22 I believe and this JAR is compiled with version 62 I believe (can’t remember the exact numbers). Using Azul Zula fixed that but it took me forever to figure it out.

The weekly schedule card suggests that you add the text below to your configuration.yaml file. In my case, when you add “mode: yaml” - it broke all my existing dashboards. I removed that line and it worked fine.

p1

To add the card to your dashboard you should add:

p2

But the description is not clear where you should add that. It’s in edit dashboard and then click the button below:

Thanks again @igor-podpalchenko for creating this. It’s amazing

1.) You may have “old” format schedule, it was 15 min step, then it was changed to 30 30-minute “step”. You can change your schedule in Devi app to ensure, there are no periods, that start or end with XX:15, XX:45. Only XX:30 and XX:00.

2.) The climate component allows the display current state of the device. From a writing perspective, you might click on it (top right corner) and use “SET OVERRIDE” to set a temperature. This is the temperature, that will be set till the end of the current day, afterwards it will switch back to the previous mode (schedule, manually and so on).

1 Like

Are you using Home Assistant OS on a Raspberry Pi? If yes, then how did you get to run the Java file?

I run HAOS on a RPi but run a NAS at home as well. I couldn’t figure out how to install this DeviSmart software on the RPi, so I installed it on the (QNAP) Nas, which works fine.

Hey everyone,
just tried to make this run on my RaspberryPi 4 with HomeAssistant installed as the main OS. Did anyone manage to install the service on the same device? Is it possible to install the service a custom local add-on? I tried going that route, but unfortunately my knowledge regarding this is very limited.

So my question is, since I do not have any other devices available, has anyone succeeded in installing the service within HomeAssistant? I’d appreciate any help :slight_smile:

Thanks @igor-podpalchenko for your work on this. It’s great!

I have got it up and running on a Pi 4 (happy to provide a guide if that would be useful for others) and I can see my thermostat in HA.

I am getting an error when using the thermostat card. I have my thermostat in manual mode (I don’t use a schedule) and when I change the thermostat mode from “OFF” to “HEAT” I get an error in the Pi4 terminal, and thermostat won’t switch to heating mode.

InputCommand deviceId: xxxx, sensorName: thermostat_mode_command, payload heat
14:02:44.709 [MQTT Call: xxxx] INFO i.h.b.d.internal.DeviRegHandler - Command for unknown sensorName: thermostat_mode_command

Is this a bug, or have I missed something?

I am now running Raspberry pi OS on a RPI4 for the Devireg thermostats and sending with MQTT to my HA OS on RPI5. It is now working good, I now have controls and sensors of all my Devireg thermostats in HA. But if I restart Home Assistant, the controls loose connection, the deviregs does not change any values until I restart the devireg runtime on the RPI4. All sensor values are still connected and updating, just the control part loose connection.

Anyone else have the same issue and did you find a work around to make the controls re-establish connection after a HA restart?

10 month ago I tried to put OpenHab inside HA addon, but sucks with shared folders (HA addon = docker container with limited shared folders)

This Addon has Java, opensdg, OpenHab, mc and test ssh server for testing. But I can not start it with OpenHab, because OpenHab need write access to some folders.

Maybe you can fork it and run java code inside it?