Eq3 eqiva Bluetooth radiator

hey,

I received my thermostat and tried to use it via the eq3.exp script. But i always run into the following error:

eq3.exp: command not found

Were you faced with the same issue?
It seems, that expect is not correctly installed or anything else, but google search results in nearly no helpful thread.

When i install expect via this command:

sudo apt install expect

I get this:

Reading package lists… Done
Building dependency tree
Reading state information… Done
expect is already the newest version (5.45-7+deb9u1).
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.

So expect is correclty installed?
Any ideas?

I get the same “command not found” if I try to run eq3.exp from the commandline.

You need to put the scripts somewhere within your webserver path, and the call the PHP script from your webserver in a webbrowser, like this:-
http://xxx.xxx.xxx.xx/eq3/php/eq3.php?mac=00-11-22-33-44-55&temperature=20
(with your IP address and your RadStat’s mac address)

And you need to edit the eq3.php script to give the $script variable the full path to where you’ve placed the eq3.exp file.

From what I can remember when I set mine up, I think that should do it.

thanks for that info! i will try that, when i get the device to be connected with my rpi. at the moment i found out that the connection is not established correctly.

for all the others being faced with the same problem, i followed this tutorial here to connect the radiator to my pi:
https://unix.stackexchange.com/questions/258074/error-when-trying-to-connect-to-bluetooth-speaker-org-bluez-error-failed

But infortunately, bluetoothctl does not ask for a pair code, but the display of the radiator shows one which need to be entered.

At the moment im stuck here, but this should be fixable…
after that i try your solution.

this issue could be related to bluetooth le devices, where the question for the pair code is not asked. but this is not clear for me at the moment.

It doesn’t need pairing to work with the script.

hi Vlad, I’m happy to chip in for device that you can use for testing.

Anyone else?

1 Like

I’ll also be happy to help and contribute a few euros.

sure, me too! paypal?

Hi to all!

many thanks once again for this great support here!
I placed both files eq3.exp & eq3.php in /etc/openhab2/html/, which is accessible via http://[your OH server]:8080/static/[the file name] (see the following link)

And I think the files are correctly accesible via this, meaning that when i try to run this script via the following url= http://XXX.XXX.X.XX:8080/static/bluetooth/eq3.php?mac=XX-XX-X-X-XX-XX&temperature=20
i get the following:

"auto", "OFF" => "manual"); function readShortStatus($mac) { global $script; $cmd = $script . $mac . " devjson"; return shell_exec($cmd); } function setTemperature($mac, $temp) { global $script; $cmd = $script . $mac . " temp " . $temp; return shell_exec($cmd); } function setComforteco($mac, $comfort, $eco) { global $script; $cmd = $script . $mac . " comforteco " . $comfort . " " . $eco; return shell_exec($cmd); } function setMode($mac, $mode) { global $script; $cmd = $script . $mac . " " . $mode; return shell_exec($cmd); } function setBoost($mac, $off) { global $script; $cmd = $script . $mac . " boost"; if ($off) { $cmd .= " off"; } return shell_exec($cmd); } if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') == 0){ $request_parameters = $_POST; } else if(strcasecmp($_SERVER['REQUEST_METHOD'], 'GET') == 0) { $request_parameters = $_GET; } $mac = str_replace("-", ":", $request_parameters['mac']); if (isset($request_parameters['temperature'])) { $temperature = str_replace(",", ".", $request_parameters['temperature']); } if (isset($request_parameters['mode'])) { $mode = $request_parameters['mode']; } if (isset($request_parameters['boost'])) { $boost = $request_parameters['boost']; } if (isset($mac)) { if (preg_match($mac_regex, $mac)) { // temperature if (isset($temperature)) { $temperature = floatval($temperature); $result = setTemperature($mac, $temperature); } // mode if (in_array($mode, array_keys($modes))) { $result = setMode($mac, $modes[$mode]); } // boost if (isset($boost)) { if (strcasecmp($boost, "ON") == 0) { $result = setBoost($mac, 0); } if (strcasecmp($boost, "OFF") == 0) { $result = setBoost($mac, 1); } } $response = readShortStatus($mac); } } header('Content-Type: application/json'); echo $response; ?> 

which should be the content of the eq3.php.

i adapted the link to the exp-file, see
grafik

but unfortunately, it does not work, meaning that the radiator does not change the temperature to 20°.
any help?

hi hans,

the output you’ve got is the content of the php file, which is being displayed as text - so php isn’t set-up properly on your system.
I’m not sure if you can run php from within the OH ‘static’ directory.

I’ve got a ‘normal’ (not OH) webserver running on my server with php already configured and installed the scripts there.

hey man, many thanks for all these tips!

I add the code lines needed for me to set this up (a bit like a tutorial), so others can be helped here too.

  1. Set up an apache2 webserver by:
sudo apt-get install apache2

Test if eveything is installed properly by tiping your rpi-url in the webbrower ) e.g.
http://raspberrypi

grafik

Now, html files can be placed here: /var/www/html

  1. install php, i did this with the following code fence:
sudo apt-get -t stretch -y install php7.0 php7.0-mysql php7.0-curl php7.0-gd php7.0-zip php7.0-fpm php7.0-cli php7.0-opcache php7.0-json php7.0-mbstring php7.0-xml libapache2-mod-php7.0
  1. create the following file via
sudo nano /var/www/html/info.php

and add the following code

<?php 
phpinfo(); 
?>
  1. go to your rpi webser again with the following link, e.g.
http://raspberrypi/info.php
  1. check if everything is working:

At the end, for me the above mentioned code fence remains, after having set up the php webserver, in a completely empty, blank, webpage, and nothing did change to the radiator.

the files are located here:
grafik

and eq3.php refers to
grafik

any more ideas? :confused:

what happens if you run ‘hcitools lescan’ from the commandline? Does the bluetooth see the Radstat?

If so, what happens if you run

./eq3.exp 11:22:33:44:55:66 sync

(with your RadStat’s mac-address, from the directory that eq3.exp is in)

Note that running eq3.exp might not work everytime, so try a few times. If that reports back with temperature, etc, as detailed in the readme for the code, then it should work.

Many thanks again, i appreciate your help a lot!!

hcitools lescan gives me:

sudo hcitool lescan
LE Scan ...
2A:C1:95:8B:5D:71 (unknown)
F1:97:98:1A:35:0E (unknown)
5C:49:7D:8A:37:02 (unknown)
88:0F:10:4F:75:99 (unknown)
88:0F:10:4F:75:99 MI
00:1A:22:0F:3D:71 (unknown)
00:1A:22:0F:3D:71 CC-RT-BLE
F1:97:98:1A:35:0E Amazfit Bip Watch

Meaning, the radiator is found…

when i try to run

./eq3.exp 11:22:33:44:55:66 sync

i get

[19:23:00] openhabian@openHABianPi:/var/www/html/eq3/php$ ./eq3.exp 00-1A-22-0F-3D-71 sync
-bash: ./eq3.exp: Permission denied

ls -l gives me

ls -l
total 36
-rw-r--r-- 1 openhab openhabian 31232 Oct 13 07:11 eq3.exp
-rw-r--r-- 1 openhab openhabian  2087 Oct 14 08:56 eq3.php

after having done

chmod 777 eq3.exp & chmod 777 eq3.php

theres something going on :smiley:

but no i get

./eq3.exp 00:1A:22:0F:3D:71 sync
Connection failed.

also this (“-” instead of “:”)

./eq3.exp 00-1A-22-0F-3D-71 sync
Connection failed.

results in a failure.

you are 100% sure that you are not connected/ paired with this radiator??
i tried to do that, but whenever i try to run

sudo bluetoothctl 

and then

pair "my mac adress"

bluetoothctl does not ask me to enter a pairing code, but the display of the radiators give me one (long press on the round button); meaning that after a 5 seconds timeout, i lose connection to the radiator.

Im quite happy because i managed it to get status information on the terminal level!
what i have done is (only once, after reboot the following are also working)

gatttool -I
connect "my mac adress"

now i can exetuting this (i need to use the “-”, the “:” are not working!!!

./eq3.exp 00:1A:22:0F:3D:71 sync

and gets that:

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

hey!!

any idea about the error i still get when running the php command via the webpage?
see: https://community.openhab.org/t/eq3-eqiva-bluetooth-radiator/52728/26?u=baggerfahrer

after executing the command via the webpage, i still get an empty page and the radiator does not change the values, but when executing the command via the terminal, i receive data from the radiator…
meaning there must be a mistake…

I have my eq3.exp script in the ‘eq3’ directory and the eq3.php script in the ‘php’ subdirectory - so I’m guessing that’s the structure it unzips in. You have both scripts in the php directory.

So try moving eq3.exp to the ‘eq3’ directory and adjust the $script variable in the php script to reflect that.

seriously, im not quite sure if this change made the difference or not, but after having changed this what you mentioned it works!!!
but additional to that, i completely deleted the eq3.php file again and created it once more with the correctly set up path to the eq3.exp.

now it works!! great man, i really really appreciate your help!

right, let’s get Vlad sorted with a radstat that he can use for testing.

Who’s going to take charge (I’d prefer not to), and how much do the three of us need to chip in?