Git Product home page Git Product logo

eq-3-radiator-thermostat's Introduction

eQ-3-radiator-thermostat

Full-featured shell script interface based on expect and gatttool for eqiva eQ-3 radiator thermostat

This script allows to control the bluetooth radiator thermostat with the Raspberry Pi's Raspian and other Linux distributions.

$ ./eq3.exp 00:1A:22:07:FD:03

Full-featured CLI for radiator thermostat eQ-3 CC-RT-BLE

Usage: [<hciX>] <mac/alias> <command> <parameters...>

Sync:
 sync                                           - Syncs time and prints target temperature and mode

Mode:
 auto                                           - Sets auto mode and deactivates vacation mode if active.
 manual                                         - Sets manual mode and deactivates vacation mode if active.

Temperature:
 comfort                                        - Sets target temperature to programmed comfort temperature
 eco                                            - Sets target temperature to programmed eco temperature
 boost                                          - Activates boost mode for 5 minutes
 boost off                                      - Deactivates boost mode
 temp <temp>                                    - Sets target temperature to given value
                                                  temp: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5
 on                                             - Sets thermostat to permanent on (30°C)
 off                                            - Sets thermostat to permanent off (4.5°C)

Timers:
 timers                                         - Reads all timers and prints them human friendly
 timer-settings                                 - Reads all timers and prints them ready for re-configuration
 timer <day>                                    - Reads timer for given day
 timer <day> <base> <hh:mm> <temp> <hh:mm> ...  - Sets timer for given day and up to 7 events with temperature and time
                                                  day:  mon, tue, wed, thu, fri, sat, sun, work, weekend, everyday, today, tomorrow
                                                  base temperature before first and after last schedule: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5
                                                  target temperature 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5
                                                  hh:mm: time where minutes must be in intervals of 10 minutes, e.g. 23:40
 vacation <yy-mm-dd> <hh:mm> <temp>             - Activates vacation mode until date and time and temperature in °C
                                                  yy-mm-dd: until date, e.g. 17-03-31
                                                  hh:mm: until time where minutes must be 00 or 30, e.g. 23:30
                                                  temp: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5
 vacation <hh> <temp>                           - Activates vacation mode for given period in hours and temperature in °C
                                                  hh: Period in hours
                                                  temp: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5

Configuration:
 comforteco <temp_comfort> <temp_eco>           - Sets comfort and eco temperature in °C
                                                  temp: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5
 window <temp> <h:mm>                           - Sets temperature in °C and period for open window mode
                                                  temp: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5 
                                                  h:mm: time where minutes in intervals of 5 minutes but max. 1 hour, e.g. 1:00
 offset <offset>                                - Sets the offset temperature in °C
                                                  offset: temperature between -3.5 and 3.5 in intervals of 0.5°C, e.g. 1.5

Others:
 lock                                           - Locks thermostat (LOC). No PIN required!
 unlock                                         - Unlocks thermostat. No PIN required!
 serial                                         - Prints serial of thermostat (see little badge where batteries are) and PIN that is required to pair device in official app
 status                                         - Syncs time, Prints target temperature, mode and timers
                                                  (in debug mode also last command even of official app, set log_user to 1 in code!)
 json                                           - Simular to status but in json format
 clear                                          - Clear buffer of last request (will be printed in debug mode, set log_user to 1 in code!)
 reset                                          - Factory reset

Initial setup

Check pre-conditions

Install expect:

$ sudo apt install expect

Check if gatttool is available:

$ gatttool
Usage:
  gatttool [OPTION...]
...

1. Discover the MAC address of your thermostat

$ sudo hcitool lescan
LE Scan ...
38:01:95:84:A8:B1 (unknown)
00:1A:22:0A:91:CF (unknown)
00:1A:22:0A:91:CF CC-RT-BLE

It is the one related to the device CC-RT-BLE.

2. Aliases

For convenience reasons I recommend to use aliases. Instead of entering the bluetooth mac address each time you want to run the script, you can call the script by using meaningful names.

The script tries to read a file called .known_eqivas which must be located in your home folder or named in KNOWN_EQUIVAS environment variable. It is a text file with two columns:

  1. MAC address
  2. Meaningful name

My .known_eqivas looks as follows:

$ cat ~/.known_eqivas
00:1A:22:0A:91:CF Wohnzimmer
00:1A:22:0C:19:60 Küche

This enables you to call the script like this

$ ./eq3.exp Wohnzimmer sync

instead of

$ ./eq3.exp 00:1A:22:0A:91:CF sync

Note: You don't even have to write the whole alias. This works as well:

$ ./eq3.exp W sync

3. Pair bluetooth

Paring is not required if your thermostat asks for a 4-digit pin. However after inserting battery you have to disable and re-enable bluetooth in menu. Otherwise device is not found via bluetooth. After that you can immediately control it via BT.

Thermostats with newer firmwares, e.g. 1.46 and above, ask for a 6-digit pin and pairing is required. The following works for me:

  • Step 1: open bluetoothctl
  • Step 2: select bluetooth device (required in my setup * since a have two controllers, i.e. a build-in one and an external USB dongle)
  • Step 3: connect to thermostat by entering mac address
  • Step 4: enter passkey
  • Step 5: disconnect and quit.

Example:

$ bluetoothctl
Agent registered
[CHG] Controller 00:1A:7D:DA:71:13 Pairable: yes
[CHG] Controller 14:F6:D8:D4:1F:F1 Pairable: yes
[bluetooth]# select  00:1A:7D:DA:71:13
Controller 00:1A:7D:DA:71:13 my-pc [default]
[bluetooth]# connect 00:1A:22:0A:91:CF
Attempting to connect to 00:1A:22:0A:91:CF
[CHG] Device 00:1A:22:0A:91:CF Connected: yes
[CHG] Device 00:1A:22:0A:91:CF Connected: no
Connection successful
[CHG] Device 00:1A:22:0A:91:CF Connected: yes
Request passkey
[agent] Enter passkey (number in 0-999999): 308448
[NEW] Primary Service (Handle 0x8281)
        /org/bluez/hci1/dev_00_1A_22_0A_91_CF/service0200
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
...
[CC-RT-BLE]# disconnect
[CC-RT-BLE]# quit

Afterwards everything works again. Don't forget to explicitly disconnect when you are in bluetoothctl. Otherwise the script can't connect since the thermostat is occupied. Note that for some reason I had to repeat the pairing process after some time (in my case a month or so).

Examples

Sync time from PC to thermostat

$ ./eq3.exp hci0 00:1A:22:07:FD:03 sync

Temperature:			10.5°C
Valve:				0%
Mode:				manual
Vacation mode:			off

Note: Parameter hci0 is optional. Set this only if you want to use a specific bluetooth adapter.

Dump status

$ ./eq3.exp 00:1A:22:07:FD:03 status


Temperature:			10.5°C
Valve:				0%
Mode:				manual
Vacation mode:			off


Timer for Sun:
	Sun, 00:00 - 07:30:	17.0°C
	Sun, 07:30 - 10:00:	21.0°C
	Sun, 10:00 - 14:30:	19.0°C
	Sun, 14:30 - 21:20:	21.0°C
	Sun, 21:20 - 24:00:	17.0°C

Timer for Mon:
	Mon, 00:00 - 17:00:	17.0°C
	Mon, 17:00 - 21:00:	21.0°C
	Mon, 21:00 - 24:00:	17.0°C

Timer for Tue:
	Tue, 00:00 - 17:00:	17.0°C
	Tue, 17:00 - 21:00:	21.0°C
	Tue, 21:00 - 24:00:	17.0°C

Timer for Wed:
	Wed, 00:00 - 17:00:	17.0°C
	Wed, 17:00 - 21:00:	21.0°C
	Wed, 21:00 - 24:00:	17.0°C

Timer for Thu:
	Thu, 00:00 - 17:00:	17.0°C
	Thu, 17:00 - 21:00:	21.0°C
	Thu, 21:00 - 24:00:	17.0°C

Timer for Fri:
	Fri, 00:00 - 17:00:	17.0°C
	Fri, 17:00 - 22:00:	21.0°C
	Fri, 22:00 - 24:00:	19.0°C

Timer for Sat:
	Sat, 00:00 - 07:30:	17.0°C
	Sat, 07:30 - 10:00:	21.0°C
	Sat, 10:00 - 14:30:	19.0°C
	Sat, 14:30 - 22:00:	21.0°C
	Sat, 22:00 - 24:00:	19.0°C

Device mac:			00:1A:22:07:FD:03
Device name:			CC-RT-BLE
Device vendor:			eq-3

Program window open mode

$ ./eq3.exp 00:1A:22:07:FD:03 window 16.5 2:00

Window open temperature:    16.5°C
Window open time:           2:00

Temperature:                22.0°C
Valve:                      0%
Mode:                       auto
Vacation mode:              off

Set to auto and manual mode

$ ./eq3.exp 00:1A:22:07:FD:03 auto

Temperature:            21.0°C
Valve:                  0%
Mode:                   auto
Vacation mode:          off

$ ./eq3.exp 00:1A:22:07:FD:03 manual

Temperature:            21.0°C
Valve:                  0%
Mode:                   manual
Vacation mode:          off

Program comfort and eco temperature and switch to programmed temperatures

$ ./eq3.exp 00:1A:22:07:FD:03 comforteco 22.0 17.0

Comfort temperature:    22.0°C
Eco temperature:        17.0°C

Temperature:            22.5°C
Valve:                  0%
Mode:                   manual
Vacation mode:          off

$ ./eq3.exp 00:1A:22:07:FD:03 comfort

Temperature:            22.0°C
Valve:                  0%
Mode:                   manual
Vacation mode:          off

$ ./eq3.exp 00:1A:22:07:FD:03 eco

Temperature:            17.0°C
Valve:                  15%
Mode:                   manual
Vacation mode:          off

Set current temperature

$ ./eq3.exp 00:1A:22:07:FD:03 temp 22.5

Temperature:            22.5°C
Valve:                  15%
Mode:                   manual
Vacation mode:          off

Start and stop boost mode

$ ./eq3.exp 00:1A:22:07:FD:03 boost

Temperature:            22.5°C
Valve:                  80%
Mode:                   manual boost
Vacation mode:          off

$ ./eq3.exp 00:1A:22:07:FD:03 boost off

Temperature:            22.5°C
Valve:                  15%
Mode:                   manual
Vacation mode:          off

Start vacation mode

$ ./eq3.exp 00:1A:22:07:FD:03 vacation 17-03-31 21:30 14.5

Vacation mode:          17-03-31 21:30 14.5°C

Temperature:            14.5°C
Valve:                  0%
Mode:                   auto vacation
Vacation mode:          on
Vacation until:         2017-03-31 21:30

$ ./eq3.exp 00:1A:22:07:FD:03 vacation 120 19

Vacation mode:          17-02-14 21:30 19°C

Temperature:            19.0°C
Valve:                  0%
Mode:                   auto vacation
Vacation mode:          on
Vacation until:         2017-02-14 21:30

Set timer for Wednesday with 7 events and read it

$ ./eq3.exp 00:1A:22:07:FD:03 timer wed 19 03:00 23 06:00 19 09:00 23 12:00 19 15:00 23 18:00 24 24:00

Timer set: wed 19 03:00 23 06:00 19 09:00 23 12:00 19 15:00 23 18:00 24 24:00

$ ./eq3.exp 00:1A:22:07:FD:03 timer wed

Timer for Wed (0x0411 2004):    21 04 26 12 2e 24 26 36 2e 48 26 5a 2e 6c 30 90
    Wed, 00:00 - 03:00: 19.0°C
    Wed, 03:00 - 06:00: 23.0°C
    Wed, 06:00 - 09:00: 19.0°C
    Wed, 09:00 - 12:00: 23.0°C
    Wed, 12:00 - 15:00: 19.0°C
    Wed, 15:00 - 18:00: 23.0°C
    Wed, 18:00 - 24:00: 24.0°C

Set offset temperature

$ ./eq3.exp 00:1A:22:07:FD:03 offset 1.0

Offset temperature:     1.0°C

Temperature:            22.0°C
Valve:                  0%
Mode:                   auto
Vacation mode:          off

Lock and unlock radiator thermostat

$ ./eq3.exp 00:1A:22:07:FD:03 lock

Temperature:            22.5°C
Valve:                  42%
Mode:                   manual locked
Vacation mode:          off

$ ./eq3.exp 00:1A:22:07:FD:03 unlock

Temperature:            22.5°C
Valve:                  42%
Mode:                   manual
Vacation mode:          off

Integration in third-party tools

Over the time this script has been taken and integrated in several projects, e.g.

This is just a selection without any recommendation.

In addition I've seen discussions about integration in FHEM. There are a few projects that have taken the documentation of the API in order to implement simular scripts by using languages like Python or JavaScript (Node JS).

eq-3-radiator-thermostat's People

Contributors

heckie75 avatar steelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eq-3-radiator-thermostat's Issues

Implementierung von Retries

Hallo zusammen,

ich hab das Script im Einsatz. Leider ist ein Thermostat im Haus relativ weit entfernt und so hat der Pi nur sporadisch eine Verbindung zum Gerät. Die Erfahrung zeigt allerdings, dass nach 2-3 Versuchen eine Verbindung zu stande kommt. Gibt es eine Möglichkeit eine Art Globalen Parameter "maxRetrys" zu implementieren?
Kenne mich leider mit Shell-Scripting 0 aus...

Connection failed

I always get this message, although I successfully paired the thermostat.

Error status and timer parameter

Hello Heckie,

at first, thank you for this amazing script tool.
I found an issue, maybe it is only for my thermostat.
I send you an screenshot, maybe you can help.

Best regards
Eric
Germany,Olpe
erroreq3

Specify bluetooth interface

If you change line
spawn -noecho /usr/bin/gatttool -I
to
spawn -noecho /usr/bin/gatttool -I -i hci1 you can use it with another interface.

Would be great to do it dynamically from command line. A good place would be the last argument like
eq3.exp aa:bb:cc:dd:ee:ff boost hci1

However I'm not a expect/tcl expert and not used to the logic of this script.
I've changed the line in parse args

  set cmd ""
  for {set i 1} {$i < [llength $argv]} {incr i} {
    if {$i > 1} {
      append cmd " "
    }
    if {[regexp -nocase "hci" [lindex $argv $i]]} {
      puts "Store interface in a global variable here"
    } else  {
      append cmd [lindex $argv $i]
    }
  }

However then doCommand does another check and fails. You as developer should be able to change it in a few minutes.

Thanks for help.

Lowercase in MAC-address as alias recognized, breaks compatibility

Hallo Heckie75,

thanks for updating your script and especially implementing using the script with other bluetooth interfaces than hci0
Implementing your alias feature I've noticed that the script thinks you have specified an alias when at least one letter is written in lowercase like

eq3.exp AA:BB:CC:DD:EE:Ff sync
device "AA:BB:CC:DD:EE:Ff" isn't known yet. Please check ~/.known_eqivas file before using alias.

In old version lowercase mac-address was no problem. So this also breaks compatibility with old versions.

I think easiest fix is to use a regex to check if MAC and if so don't treat it as alias.

char-write-req 0411 03 corrupts memory state

On my device, if I issue an char-write-req 0411 03 without specifying the datetime like char-write-req 0411 03YYMMDDHHMM the internal state of the memory seems to get corrupted. Ie. if I then long-press menu and select dat I don't get 2017 but garbled stuff like 23E8 and I can't set the vacation mode via the wheel properly. Basically all time-related stuff is then messed up.

Window open time maximum 1 hour

Hallo Heckie75,

I've noticed a little flaw in your documentation.

 window <temp> <hh:mm>                          - Sets temperature in °C and period for open window mode
                                                  temp: 5.0 to 29.5 in intervals of 0.5°C, e.g. 19.5
                                                  hh:mm: time where minutes in intervals of 5 minutes, e.g. 02:05

Maximum window open time you can set on thermostat directly is 1:00
If you send 02:05 thermostat reports back 00:45 as window opentime. this is also shown on thermostat display.

Sorry for opening so many issues. Your project is really great and opening so many issues doesn't mean I'm picking only the non-working parts. I really like your project.
In fact I like it so much that I've developed a Node-RED node based upon your script and so I'm testing a lot.

You can find the Node here https://flows.nodered.org/node/node-red-contrib-eq3-thermostat
I would be glad if you mention it in your Readme like:

You can also use this code via Node-RED, see https://flows.nodered.org/node/node-red-contrib-eq3-thermostat

No paring required

Actually I am not 100% sure, but it seems that the thermostat must be explicitly paired (maybe only newer versions). Therefore you have to press the button on the termostat and start the pairing procedure. It depends on your linux distribution how devices must be paired there. The pin seems not to be required for pairing.

Paring is not required. However after inserting battery you have to disable and re-enable bluetooth in menu. Otherwise device is not found via bluetooth. After that you can immediately control it via BT.

Cannot read timers

There seems to be an issue with reading timers on these thermostats. The timers command throws the following error:

./eq3.exp 00:1A:22:06:31:84 timers can't read "d": no such variable while executing "return $d" (procedure "hexToDecimal" line 3) invoked from within "hexToDecimal [lindex $raw_timer [expr 2 * $event + 1 ]]" (procedure "readTimer" line 13) invoked from within "readTimer $day" (procedure "readTimers" line 5) invoked from within "readTimers" (procedure "init" line 14) invoked from within "init $INIT(timer)" ("^timers$" arm line 2) invoked from within "switch -regexp $c { ^sync$ { init $INIT(mode) } ^comforteco.* { checkArgs $c 2 "comforteco" {^comforteco [0-9]{1,2}\.?[05]? [0..." (procedure "doCommand" line 10) invoked from within "doCommand" (file "./eq3.exp" line 1112)

I cannot access the weekly schedule from the calor BT app either. Has anyone else encountered this?

Cheers

Feature: get current temperature

Is it possible to get the current temperature measured by the thermostat's sensor?
It will be pretty useful to calibrate the "offset" value from time to time.

I doubt the value is really exposed via BT since it is not visible in the official app, but maybe someone has an idea how to do it.

Failed to communicate (new Firmware?)

The script is not able to communicate with my thermostats:

$ ./eq3.exp 00:1a:22:0e:d7:e7 sync
doCommand: received command <sync>
[                 ][LE]> connect 00:1a:22:0e:d7:e7
Attempting to connect to 00:1a:22:0e:d7:e7
Connection successful
writeRequest: char-write-req 0411 03 150102150724
[00:1a:22:0e:d7:e7][LE]> char-write-req 0411 03150102150724
[00:1a:22:0e:d7:e7][LE]>
(gatttool:9131): GLib-WARNING **: 21:07:37.195: Invalid file descriptor.
ok
notification: 0x0421
ERROR: Thermostat hasn't responded after sync request in time (10 sec.)

One important point might be that I updated my thermostats to the latest firmware from December 2020, version 1.46. This version seems to (actually) enforce some kind of pairing, I had to enter a PIN on my iOS devices.

Let me know if I can help you with the debugging!

Bt like xm-15b or otger

Hello. I'm just using this script on rpi3 with gatttooll. Works perfectly ;)
But the range of built in rpi bt is too small. I'm wondering about to connect usb bt class1 (easy) or xm-15b (not so eeasy for me ) via serial.
My question is. How should commands look like for eq3bt via serial (for xm-15b , of course after sucessfull connect)
Maybe someone will know how to do it?

Thanks advance ;)

Auslesen der Timer-Werte mit "timer-settings" bricht mit Fehler ab

Erstmal Danke für das Tool, erspart eine Menge Gefummel!

Ich habe an meinem Test-Termostat (MAC-Adresse xxx) die Zeiten neu gesetzt:

pi$ eq3.exp xxx timer everyday 5.0 00:00 8.0 24:00

Status gibt zurück:

pi$ eq3.exp xxx status

Temperature: 4.5°C
Valve: 0%
Mode: off
Vacation mode: off

Comfort temperature: 21.0°C
Eco temperature: 17.0°C

Open window temperature: 12.0°C
Open window time: 00:15

Offset temperature: 0.0°C

Timer for Thu:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Timer for Fri:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Timer for Sat:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Timer for Sun:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Timer for Mon:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Timer for Tue:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Timer for Wed:
00:00 - 00:00: 5.0°C
00:00 - 24:00: 8.0°C

Device mac: xxx
Device name: CC-RT-BLE
Device vendor: eq-3

Timer-Settings abfragen geht schief:

pi$ eq3.exp xxx timer-settings

can't read "thermostat("timer_start_0_3")": no such element in array
while executing
"if {"00:00" == "$thermostat("timer_start_$key")"} {
append out "$thermostat("timer_temperature_$key") "
continue
}"
(procedure "dumpTimer" line 10)
invoked from within
"dumpTimer $day"
(procedure "dumpTimers" line 4)
invoked from within
"dumpTimers"
("^timer-settings$" arm line 3)
invoked from within
"switch -regexp $c {
^sync$ {
init $INIT(mode)
}
^comforteco.* {
checkArgs $c 2 "comforteco" {^comforteco [0-9]{1,2}.?[05]? [0..."
(procedure "doCommand" line 10)
invoked from within
"doCommand"
(file "/usr/local/bin/eq3.exp" line 1265)

Reading Firmware Version / Changelog

First of all great repo with great docs. I stumbled here by accident because I tried to find out how to interact with the thermostat.

I currently develop myself a C++ / Qt app which I later want to run on a raspberry webserver to control the thermostats via mobile.

I was using the file eq-3-radiator-thermostat-api.md as a reference to know how the commands work to the thermostat because I develop an C++ / Qt app to manager the thermostats.

However I was wondering if a description is missing on how to read the firmware version of the thremostat?

Also I was wondering if there exists some kind of changelog from the manufacturer on what is different between each firmware version?

PS: I also saw in other issues the complains that gattool is deprecated. Im working on manjaro and it is true. But there is an replacement for it. In theory the script could be ported to use btgatt-client which comes nowadays with bluez.

expect: spawn id exp4 not open

Hi,

the script does not really work for me. I always get the message expect: spawn id exp4 not open:

./eq3.exp myEQ3 status expect: spawn id exp4 not open while executing "expect -re "\[0-9a-f\ ]*" { log "ok" }" (procedure "readHandle" line 10) invoked from within "readHandle $HANDLES(name)" (procedure "readDeviceInfo" line 5) invoked from within "readDeviceInfo" (procedure "init" line 8) invoked from within "init [expr $INIT(device) + $INIT(mode) + $INIT(timer) + $INIT(serial)]" ("^status$" arm line 2) invoked from within "switch -regexp $c { ^sync$ { init $INIT(mode) } ^comforteco.* { checkArgs $c 2 "comforteco" {^comforteco [0-9]{1,2}\.?[05]? [0..." (procedure "doCommand" line 10) invoked from within "doCommand" (file "./eq3.exp" line 1265)

Any hint for solving this issue?

Thanks a lot in advance!

Antwortet nicht

Hallo,
erstmal auch vielen dank für das programm.
ich habe es oft versucht aber kriege leider keine antwort.
ich kann mich verbinden und die befehle senden die nimmt er auch an und ändert die temperatur auf dem display. aber weder bei status noch bei char-write-req 0411 00 bekomme ich eine Antwort.
fehler meldung kommt aber auch nicht.
danke im vorraus.

$1 Variable setzen für Skriptautomation

Der Equiva soll als Frostschutz dienen. Frostschutz wird ausgelöst über ein Skript in Abhängigkeit von der Außentemperatur und der Temperatur am Vorlauf des Heizkörpers via Sensor. Das Skript kann nach Fertigstellung gerne zur Verfügung gestellt werden. Habe das Thermostat erstmal in der App gepaart. Am Raspberry war danach keinerlei Pairing erforderlich, es kann einfachso gesteuert werden. Vielleicht verliert sich dieses Pairing einfach so. Da es ein Skript steuert und damit der Frostschutz funktioniert, wollte ich via $1 überprüfen, ob Fehler aufgetreten sind. Leider ist $1 immer leer, egal ob der Befehl erfolgreich war oder fehlschlug. Daher mein Featurerequest einfach $1 entsprechend setzen, 0 bei keinem Fehler, irgendwas anderes bei Fehler.

Security concerns - Connection without PIN/Pairing

Hello, this is rather a question than a real issue. Hope someone could still share thoughts.

I can use the device from my Raspbian and was able to control the temperature. The device didn't need to be paired, nor did I have to enter the PIN somewhere - like it's mentioned also in the documentation and in other issues. Now I'm a bit concerned about my security, I fear people could drive-by my house and control my radiators from outside. Since I'm not a Bluetooth expert I was wondering whether that is even possible through a wall with the EQ3 device?

Also I updated to latest firmware 1.2 from my mobile phone and was hoping that with that it requires at least a pairing, but still I can control the device without pairing and without PIN...

Does anyone know a more secure alternative device which can also be easily controlled with a Raspberry Pi from the command line? It seems a lot of the devices need additional radio adapters (such as Homematic, Zigbee, etc) or they have no documented interface or work only via some third-party cloud services.

Thanks a lot for your help!

Connection problems

Hi there,

I am using the expect script with iobroker and experience some problems with connectivity.
So I tested the script standalone.

Sometimes this error occurs (debug logging):

doCommand: received command
[ ][LE]> connect 00:1A:22:16:2F:2A
Attempting to connect to 00:1A:22:16:2F:2A
Error: connect error: Function not implemented (38)
[00:1A:22:16:2F:2A][LE]> { "error" : "Connection failed." }

Any idea, what is the cause and what to do?

Thanks in advance.

Batteries last long ?

This thing is physically moving the pin on the radiator valves.
And it's doing it often to stay at the set temperature.
So it probably burns through the batteries fast ??

Timeout when reading status

I can't seem to read status from my eQ3. It always says timeout:

ccrisan@asus430ua:~/downloads/eQ-3-radiator-thermostat-master$ ./eq3.exp 00:1A:22:05:D1:17 status
ERROR: Thermostat hasn't responded after sync request in time (10 sec.)

The weird thing is that other functions, such as lock, seem to work, even though I keep getting the timeout; I see the LOC text appearing on my thermostat when I run:

ccrisan@asus430ua:~/downloads/eQ-3-radiator-thermostat-master$ ./eq3.exp 00:1A:22:05:D1:17 lock
ERROR: Thermostat hasn't responded in time (10 sec.)

I tried digging deeper into this problem and used gatttool manually (I need to interrupt it after waiting more than 1 minute):

ccrisan@asus430ua:~$ gatttool -b 00:1A:22:05:D1:17 --listen --char-write-req --handle=0x0411 --value=03181202151f05
Characteristic value was written successfully
^C

A few remarks:

  • this happens for 3 out of 8 eQ3 thermostats I have installed in my house
  • I tried updating the firmware via the official app to 1.20 - same result
  • I (factory) reset the device many times without any success

Any help would be appreciated.

Domoticz

Great Job...
Have you consider to implement it into domoticz ?
It would be great to have it connected to domoticz in similar way like You have done with KODI.

JSON support

Hi @Heckie75,

It would be great to have support for JSON response from thermostat instead of plain text.
Thanks to that it would be much easier to parse data in external applications (eg. to visualize some data).

I don't know tcl/expect stuff, so it's hard for me to make a pull request with this change.
What do you think about it?

Cheers,
Marcin

Additional values of handle 0x0421 in new versions, what do they mean?

Hallo,

a few years old device

char-write-req 0411 4500
Characteristic value was written successfully
Notification handle = 0x0421 value: 02 01 09 50 04 0c

New device ordered a few weeks ago:

char-write-req 0411 4500
Characteristic value was written successfully
Notification handle = 0x0421 value: 02 01 09 50 04 1e 00 00 00 00 18 03 2a 22 07

So anyone has an idea what these new values 00 00 00 00 18 03 2a 22 07 mean?

Sadly room temperature seems not included. I've warmed the device a bit, but still it is always 00 00 00 00 18 03 2a 22 07 shown.

Feature: manually control the percentage of the valve opening

First of all I wanted to thank you a lot for this script, you really did an amazing job!

Second, I wanted to ask if there is a way to manually control how much the valve is opened and closed. I just bought these radiator valves and before I had the classical manual ones where you could regulate manually from 1 to 5 how much the valve was open. Is there a way to achieve something similar instead of reasoning in having the room to reach a certain temperature?

Firmware Upgrade: Latest versions seem to require pairing

I've upgraded some "new" EQ3 which I ordered a few days ago but still had old firmware where Bluetooth was on by default and didn't report so much information on sync request like window open time.
However after that I was able anymore to control them with raspberry Pi Zero W. Even after resetting thermostat to factory default.
After pairing them via

sudo bluetoothctl
scan on
<wait until mac of new Eqiva EQ3 appears>
scan off
pair <MAC>
<Enter 6 digit number, getting by longpressing control wheel>
disconnect <MAC>

controlling was fine again. Did a test by remove <MAC> in bluetoothctl and then device couldn't be controlled anymore. After repairing it could be controlled again. Important do the disconnect step in bluetoothctl otherwise eQ-3 script can't connect.

However another Rasperry PI 4 with an external bluetooth adapter can sync all 3 updated devices without beeing paired. Very strange.

Hope this information helps someone.

`status` returns `can't read "d": no such variable`

Hallo @Heckie75,

Vielen Dank erstmal für die tolle Arbeit - habe dein Projekt über das FHEM-Forum gefunden und bin gerade dabei es auszuprobieren.

Leider bekomme ich das jedoch nicht hin.
Ich habe zuerst die Adresse von einem meiner Thermostate identifiziert (00:1A:22:06:32:30).
Anschließend die benötigte Software installiert (TCL 8.4 und expect).

Muss ich das Thermostat vorher noch irgendwie anlernen?
Führe ich direkt eine status-Abfrage durch kommen folgende Fehlermeldungen:

$ ./eq3.exp 00:1A:22:06:32:30 status
can't read "d": no such variable
    while executing
"return $d"
    (procedure "hexToDecimal" line 3)
    invoked from within
"hexToDecimal [lindex $raw_status 3]"
    (procedure "parseMode" line 7)
    invoked from within
"parseMode $raw_status"
    (procedure "readMode" line 6)
    invoked from within
"readMode"
    (procedure "init" line 11)
    invoked from within
"init [expr $INIT(device) + $INIT(mode) + $INIT(timer)]"
    ("^status$" arm line 2)
    invoked from within
"switch -regexp $c {
    ^status$ {
      init [expr $INIT(device) + $INIT(mode) + $INIT(timer)]
      dumpThermostat
    }
    ^sync$ {
      init 0
 ..."
    (procedure "doCommand" line 10)
    invoked from within
"doCommand"
    (file "./eq3.exp" line 929)

eQ3 - Connection failed very often

raspberry pi 4b eQ-3 CC-RT-BLE.

2 eQ-3 devices, paired and working, but frequently i get Connection failed (25% of tries)

1/ Connenction Failed, btmon log during connection:

HCI Event: Command Complete (0x0e) plen 14 #425 [hci0] 172.457975
LE Read Remote Used Features (0x08|0x0016) ncmd 1
Status: Success (0x00)
00 00 00 00 00 00 00 00 00 00 ..........
< HCI Command: LE Add Device To White List (0x08|0x0011) plen 7 #426 [hci0] 172.458043
Address type: Public (0x00)
Address: 00:00:00:00:00:00 (OUI 00-00-00)

HCI Event: Command Complete (0x0e) plen 4 #427 [hci0] 172.458441
LE Add Device To White List (0x08|0x0011) ncmd 1
Status: Repeated Attempts (0x17)
HCI Event: LE Meta Event (0x3e) plen 12 #428 [hci0] 172.766608
LE Read Remote Used Features (0x04)
Status: Connection Failed to be Established (0x3e)
Handle: 64
Features: 0x3f 0x00 0x00 0x08 0x00 0x00 0x00 0x00
LE Encryption
Connection Parameter Request Procedure
Extended Reject Indication
Slave-initiated Features Exchange
LE Ping
LE Data Packet Length Extension
Unknown features (0x0000000008000000)
HCI Event: Disconnect Complete (0x05) plen 4 #429 [hci0] 172.767179
Status: Success (0x00)
Handle: 64
Reason: Connection Failed to be Established (0x3e)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0002} [hci0] 172.804587
LE Address: 00:1A:22:11:80:74 (eQ-3 Entwicklung GmbH)
Reason: Unspecified (0x00)
@ MGMT Event: Device Disconnected (0x000c) plen 8 {0x0001} [hci0] 172.804587
LE Address: 00:1A:22:11:80:74 (eQ-3 Entwicklung GmbH)
Reason: Unspecified (0x00)

2/ Second problem - script sometimes is giving an unexpected result:

pi@raspberrypi:~ $ /opt/eQ-3-radiator-thermostat/eq3.exp 00:1A:22:11:80:74 json
^[[6~can't read "d": no such variable
while executing
"return $d"
(procedure "hexToDecimal" line 3)
invoked from within
"hexToDecimal [lindex $raw_timer [expr 2 * $event + 1 ]]"
(procedure "readTimer" line 13)
invoked from within
"readTimer $day"
(procedure "readTimers" line 5)
invoked from within
"readTimers"
(procedure "toJson" line 14)
invoked from within
"toJson"
("^json$" arm line 2)
invoked from within
"switch -regexp $c {
^sync$ {
init $INIT(mode)
}
^comforteco.* {
checkArgs $c 2 "comforteco" {^comforteco [0-9]{1,2}.?[05]? [0..."
(procedure "doCommand" line 10)
invoked from within
"doCommand"
(file "/opt/eQ-3-radiator-thermostat/eq3.exp" line 1157)

is it normal? maybe someone is experiencing the same issue ?

"No such variable" for unstable connection

Hey,
I'm using the tool in conjunction with a device that is almost out of range. Sometimes, instead of outputting a Connection failed., the following error drops:

$ ./eq3.exp AA:BB:CC:DD:EE:FF status
can't read "d": no such variable
    while executing
"return $d"
    (procedure "hexToDecimal" line 3)
    invoked from within
"hexToDecimal [lindex $raw_status 3]"
    (procedure "parseMode" line 7)
    invoked from within
"parseMode $raw_status"
    (procedure "syncTime" line 8)
    invoked from within
"syncTime"
    (procedure "init" line 11)
    invoked from within
"init [expr $INIT(device) + $INIT(mode) + $INIT(timer)]"
    ("^status$" arm line 2)
    invoked from within
"switch -regexp $c {
    ^sync$ {
      init $INIT(mode)
    }
    ^comforteco.* {
      checkArgs $c 2 "comforteco" {^comforteco [0-9]{1,2}\.?[05]? [0..."
    (procedure "doCommand" line 10)
    invoked from within
"doCommand"
    (file "./eq3.exp" line 1014)

It's nothing critical, just a note to let you know.
Great work.

Connection failed

Hello! I am using a Raspberry PI 3 Model B+ and I cannot connect to the thermostat. I run ./eq3.exp 54:4A:16:5C:9E:2C and it says connection failed. The error is: GDBus.Error.bluez.Error.AuthenticationFailed: Authentication Failed. Thank you!

Feature: Get Serial

Hey,

thanks for your work.

i'm also digging in eq3 stuff.
I decompiled the App and found the PIN calculation is made with some XORs from device serial (well...nothing to say).
The serial is the String you can find under at the bottom of your device between the two batteries.

So I guess there is somehow a command to derive the serial from the device as an ASCII byte Array.
If i'm right the command byte is just one byte = 0, which return the device Information.

Maybe you could validate that and implement the Serial Output into your script.

Requires package Tclx

Hi Heckie75,
first i want to thank you for this great script!

I saw that you have a setup section built into the README.md.
But on a fresh RPi we need Tclx, as you write in eq3.exp (Note: requires package Tclx).
So the apt-get part needs to be:
$ sudo apt install expect tclx8.4

(i've the 141771E0 version and no pairing is needed!)

Greetings

status fragt nicht alle Variablen ab

Hallo zusammen,

mir werden leider nicht alle Variablen beim stauts Befehl zurückgegeben, ich wollte mal nachfragen ob jemand ähnliches hat oder mir helfen kann ?

/var/www/html/eq/eq3.exp 00:1A:22:10:71:C8 status

Temperature: 25.0°C
Valve: 100%
Mode: manual dst
Vacation mode: off

can't read "d": no such variable
while executing
"return $d"
(procedure "hexToDecimal" line 3)
invoked from within
"hexToDecimal [lindex $raw_timer [expr 2 * $event + 1 ]]"
(procedure "readTimer" line 13)
invoked from within
"readTimer $day"
(procedure "readTimers" line 5)
invoked from within
"readTimers"
(procedure "init" line 14)
invoked from within
"init [expr $INIT(device) + $INIT(mode) + $INIT(timer) + $INIT(serial)]"
("^status$" arm line 2)
invoked from within
"switch -regexp $c {
^sync$ {
init $INIT(mode)
}
^comforteco.* {
checkArgs $c 2 "comforteco" {^comforteco [0-9]{1,2}.?[05]? [0..."
(procedure "doCommand" line 10)
invoked from within
"doCommand"
(file "/var/www/html/eq/eq3.exp" line 1157)

Der Pfad ist nicht entscheidend, diesen hab ich bewusst geändert.
Auch im Standard Pfad erhalte ich den selben Fehler.
Timer "wed" ist hinterlegt so wie im "Tutorial"
lässt sich auch über den Status timer wed auslesen:
/var/www/html/eq/eq3.exp 00:1A:22:10:71:C8 timer wed

Timer for Wed:
Wed, 00:00 - 05:00: 20.0°C

    Wed, 05:00 - 06:30:     24.0°C

    Wed, 06:30 - 16:30:     19.0°C

    Wed, 16:30 - 23:00:     24.0°C

    Wed, 23:00 - 24:00:     20.0°C

VG
Chriss

can't connect after some minutes

Hi @Heckie75,
thanks for your work, everything with your code works fine.
But my thermostat device doesn't advertise all the time.
When I remove the battery set date, time everything works fine for a unknown time (some minutes).
Put the device in scan mode seems to be useless.

Do you have any experience with a behavior like this ?

Cheers
Julian

Actual Temperature Reading

Hello
One more question is it possible to get the actual temperature from the thermostat not just target one?
Anyway
Great Job

Michal

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.