Where AA:BB:CC:DD:EE:FF is the MAC address of the unit.
char-read-hnd 19 will get you the current mode (08 in my case when it’s on schedule, heating element temp)
char-read-hnd 17 will get you something like AABBCCDD where AABB is current temp and CCDD is target temp; call temperatureTermaToCelsius('AA', 'BB') or temperatureTermaToCelsius('CC','DD') to convert to celsius.
To change the mode: char-write-req 19 00 will put in mode “0” which means off.
Yeah, it usually sees it straight away on the scan, and then the pairing connect/fail happens really fast
Will have a play around with it when I get more time.
Cheers
It can be tricky at time to pair. Try turning the unit off (by unplugging it / turning the mains switch off) and on again. Do scan first, check the unit is shown, then put it in pairing mode and pair it on RPI (it will ask you for the pin code which is 123456). Once that’s done, the rest is easy
I just cannot get it to pair
Tried so many times, but it fails every time.
Think I’m going to give up for now, but I may come back to it in a few months when I’ve dredged up the enthusiasm to try again
I have started, but paused attempts to connect from an ESPHome board. It was initially successful: I could pair and retrieve data as the first step, with the intention of adding control later.
However, the problem I encountered was that the connection/pairing (? not sure which) would come undone after a day or two. As far as I could tell at the time the only way to get it to reconnect was to put the radiator back into pairing mode.
I’ve not had time to dig deeper but it seemed as though the problem was possibly on the ESPHome+Bluetooth stack side, forgetting something about the pairing. A paired iPhone+Terma app, by contrast, has no trouble re-establishing a connection to the radiator after any amount of time.
As a general note for anyone trying to reverse engineer the protocol: the Android Terma BlueLine Next app APK is a Phonegap/Cordova-based app, so contains a wealth of interesting and quite readable JS code
I’m connecting to the Terma unit by having NodeJS running gatttools in interactive mode, so I can poll from time to time.
I initially had it opening a connection, poll, close a connection but that proved to be problematic since it uses a lot more Bluetooth traffic and it is more likely to fail in busy radio environments. I’ve switched to persistent Bluetooth connection with reconnect logic in case of failure.
It works well. So I guess you have an issue with the hardware. Either on esp or terma side.
Re: the app, I didn’t noticed it is Cordova. But android apps can be decompiled anyhow…
Did you get any further with this in ESPHome @rnorth?
I’m about to get a couple of these and I really am hoping that ESPHome Bluetooth proxy devices could be used to let me move all the control of the radiators (other than local dumb button control) into Home Assistant.
I see Terma have launched a WiFi controlled unit (Grzałka VEO) - but without any open API or local control, and I bet that will be harder to reverse engineer, especially as we already have the Bluetooth control commands courtesy of ptuk (thanks again @ptuk!)
@ptuk - thank you for your work on the protocol. I’ve used this to create a very simple python web server to enable control of the elements over WiFi. The code can be found here:
So glad someone managed to create a web server. I have a stub of a NodeJS server but not one in python.
I did manage to decode other parts of the protocol like time sync as well as on with timed off (eg turn on for 1 hour). I still have to workout the schedule function.
I’m happy to share if someone needs the details.
Is anyone willing to help to create an Home Assistant platform? I’ve never done that but I want to learn
I’ve not tested this at all so proceed with caution.
Nice work on the other parts. One of my goals was to not use the built-in functionality because I want to create schedules etc with the Apple Home app. But I can definitely see use in other scenarios. The comments about using a persistent connection I want to explore as well as the web server is agonisingly slow currently.
That’s absolutely essential. I was connecting every time I had to issue a command (or poll). It was super slow and unreliable. Persistent connection works wonders (although do handle disconnections as they will happen)