Eq3 Max - control with php scripts

For heating/cooling related questions in Domoticz
TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Eq3 Max - control with php scripts

Post by TikTicz » Sunday 18 September 2016 18:08

As summer is coming to an end, I wanted to share these php scripts with you. I use it to control the eq3 max valves/thermostats. Only the php scripts and a little (easy) blockly scripting in Domoticz is needed.

Attached a zip file with the php scripts and a readme.doc with a setup explanation.

I took this approach because I could not get de Max Buddy implementation to run (stable) in my environment. Furthermore I am not familiar with Python and Bash, so I decided to go forward with php.

The scripts (eq3………php) can also be used without Domoticz in case you want to write you own applications. The scripts reads values from your cube, and you will be able to set temperature of the valves. The scripts lacks functionality like holiday modus, etc. I use Domoticz for this kind of logic (and various other scenario’s).

As I only own a Eq3 Max cube and some valves, I developed code for this setup. In case you want to control other Eq3 Max devices, for example a wall thermostat you will need to do some additional coding.

The eq3class.php is based on code created by Mega (http://www.mega-nas.de/max/). I Just took his code and isolated the logic from the html. Did some rewriting to get a better understanding. Also solved some issues I ran into.

It runs very stable in my environment (rPi 3) and PHP also running on the Pi. While developing, I ran the php scripts on a Windows environment, also without any troubles.

I hope this helps to get the maximum comfort out of your Eq3 Max devices. I needed it to automate temperature in my house. Furthermore with the Domoticz mobile app, you can also control the Eq3 Max valves from a remote location. Although an Eq3 Max mobile app is in the appstore I am not a fan of Eq3 mobile app. Often temperature set in mobile app is not executed and the app lacks several options.
Attachments
eq3.zip
(239.68 KiB) Downloaded 213 times
Last edited by TikTicz on Wednesday 21 September 2016 19:26, edited 1 time in total.

User avatar
Westcott
Posts: 547
Joined: Tuesday 09 December 2014 18:04
Target OS: Raspberry Pi
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: Eq3 Max - control with php scripts

Post by Westcott » Sunday 18 September 2016 20:09

Hi TikTicz,

It's also possible to read/write the Cube using Lua directly.
See -
http://www.domoticz.com/forum/viewtopic ... &start=160
Zwave - Sigma Z+ stick, Fibaro 2x FGSD002, FGMS001
Horstmann - 2x HRT4, 2x C-stat-11, 4x ASR-ZW, TKB 2x TZ56, 2x TZ68E
Max-EQ Cube, Valve, Neo 2x door
RFXtrx433E, RFlink - 1byone driveway, doorbell, Oregon and BangGood temp
Wifi - YeeLight RGB, 3x ESP8266

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Wednesday 21 September 2016 19:37

Hi Westcott,

I noticed. Good jod, no doubt. I went for PHP, because that is my personal favour. LUA will be a better approach for many. I just wanted to share this peace of code, for those also using PHP.

bearded
Posts: 13
Joined: Tuesday 28 June 2016 17:22
Target OS: Windows
Domoticz version:
Location: Huddersfield, UK
Contact:

Re: Eq3 Max - control with php scripts

Post by bearded » Saturday 29 October 2016 15:38

Hi TikTicz,

Thanks for the .php code! I'm trying to integrate the MAX! system into my Domoticz automations. I've been using one-way JSON commands through the MAX! home automation software but without any feedback / control through Domoticz.

With my very limited scripting knowledge I have followed your helpful guide and have installed XAMPP as a .php server on my windows 10 machine. All .php scripts are saved in the domoticz/scripts\eq3 folder and also in the \xampp\htdocs folder too. I've updates the appsettings.php file with the ip addresses and ports for the cube and domoticz.

When running eq3read.php I get the following error in my browser:

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\eq3class.php on line 69

Fatal error: Call to undefined method Eq3Class::CloseSock() in C:\xampp\htdocs\eq3read.php on line 15

Do you have any idea where I might be going wrong? It's my nirvana to get full heating control though Domoticz and I'm trying desperately to find a solution!

Thanks in anticipation!

Skippiemanz
Posts: 278
Joined: Sunday 14 July 2013 20:21
Target OS: Raspberry Pi
Domoticz version: 3.5859
Location: Alkmaar, The Netherlands
Contact:

Re: Eq3 Max - control with php scripts

Post by Skippiemanz » Saturday 29 October 2016 15:42

Check the last posts in this topic! http://www.domoticz.com/forum/viewtopic.php?t=841

bearded
Posts: 13
Joined: Tuesday 28 June 2016 17:22
Target OS: Windows
Domoticz version:
Location: Huddersfield, UK
Contact:

Re: Eq3 Max - control with php scripts

Post by bearded » Sunday 30 October 2016 8:24

Skippiemanz wrote:Check the last posts in this topic! http://www.domoticz.com/forum/viewtopic.php?t=841
Thanks @Skippiemanz but I'm a bit confused by that whole thread (it doesn't take much) and I'm even less familiar with lua than I am with php! Unless there's a step by step wiki I'm lost! Thanks for the head's up though.


Sent from my iPhone using Tapatalk

Skippiemanz
Posts: 278
Joined: Sunday 14 July 2013 20:21
Target OS: Raspberry Pi
Domoticz version: 3.5859
Location: Alkmaar, The Netherlands
Contact:

Re: Eq3 Max - control with php scripts

Post by Skippiemanz » Sunday 30 October 2016 14:48

They are going to write it all up in a wiki and maybe even making a plugin! So keep youre eye on the updates of that thread

bearded
Posts: 13
Joined: Tuesday 28 June 2016 17:22
Target OS: Windows
Domoticz version:
Location: Huddersfield, UK
Contact:

Re: Eq3 Max - control with php scripts

Post by bearded » Sunday 30 October 2016 14:57

Skippiemanz wrote:They are going to write it all up in a wiki and maybe even making a plugin! So keep youre eye on the updates of that thread

Brilliant! Will do. Thanks again. :-)


Sent from my iPhone using Tapatalk

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Sunday 30 October 2016 20:53

Hi Beared,

I have the same error when I configure a wrong ip or port for the cube in appsettings.php

Add this line of code in eq3read.php below line 13 ("$eq3arr = $eq3->OpenSock($cubehost,$cubeport);" ):
print_r($eq3->retarr);

This will print the array with the connection error message, or an empty array if no errors occur.
In case the cube ip is wrong, the message will be something like "10061Connection Error .............................. "
In case the cube port is wrong, the message will be something like "10060Connection Error .............................."

Also be aware the cube ip can change whenever the router is rebooted, or the cube is rebooted.
If you want always want the same ip address for the cube give the cube a static ip address in the router. A static ip address is preferred.

Hope this helps,
TikTicz

bearded
Posts: 13
Joined: Tuesday 28 June 2016 17:22
Target OS: Windows
Domoticz version:
Location: Huddersfield, UK
Contact:

Re: Eq3 Max - control with php scripts

Post by bearded » Tuesday 01 November 2016 10:45

@TiktTicz. Working perfectly now, thank you very much! As you suspected there was simply a small error in my i.p. addresses. Thanks very much for a great bit of scripting and a superb user guide. It's just what I've been looking for and I now have full individual control of my rad. Now I've achieved this level of control I'll be ordering another 5 eQ3 valves this week and adding them to the system.

// Just thinking, it would be great if we could read the actual temp of each valve along with the set temp. Therefore we could then write a blockly that would switch off the boiler at a 'boiler switch' when all valves were reading an actual temp within 20% of their set temp and if any dropped lower than this % the boiler could switch on! //

Once again, thank you for your efforts, really appreciate it! :D

User avatar
blackdog65
Posts: 535
Joined: Tuesday 17 June 2014 18:25
Target OS: Raspberry Pi
Domoticz version:
Location: Norfolk, UK
Contact:

Re: Eq3 Max - control with php scripts

Post by blackdog65 » Tuesday 01 November 2016 18:05

Skippiemanz wrote:They are going to write it all up in a wiki and maybe even making a plugin! So keep youre eye on the updates of that thread
Just an update, the wiki for the lua version is up
https://www.domoticz.com/wiki/EQ3_MAX!
Good luck with the PHP, maybe we'll see some cross pollination in the future :D
Sean
CubieTruck Master
RasPi slaves
Aeon Labs Z-Stick, multi sensor
Fibaro Dimmers, relays, Universal sensors
EQ3 MAX!
TKB Sockets
RFXCOM
LightwaveRF sockets, switches, relays, doorbell
MySensors
ESPEasy ESP8266-12E

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Saturday 05 November 2016 0:01

Hi Beared,

// Just thinking, it would be great if we could read the actual temp of each valve along with the set temp. Therefore we could then write a blockly that would switch off the boiler at a 'boiler switch' when all valves were reading an actual temp within 20% of their set temp and if any dropped lower than this % the boiler could switch on! //

Since I like the idea, I have been looking into this. However it seems not possible the read the actual temperature from the valve.

jack74
Posts: 9
Joined: Wednesday 16 November 2016 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by jack74 » Sunday 20 November 2016 11:56

Hi TikTicz,

first of all I would say "very very good job"... ;) then I followed your instructions and I tried the script to read the Qube status and it worked very well (it showed all the status valves), then I tried to use the domocreatenewhardw.php and after few seconds it said "done" but when I go in domoticz I can't se any devices... :roll: :roll: what I'm wronging? Could you help me?

Thanks a lot,

Jack

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Sunday 20 November 2016 19:08

Hi Jack74,

I investigated the script and noticed I did not implement error handling very well. But my best guess for now is to make sure the ipaddress and port of the domoticz server are set to the good values in script appsettings.php.

If you think they are o.k., verify by entering this url in your browser http://ipaddress:port ( for example http://192.168.1.34:8080 )
Replace "ipadress" by the ipaddress you configured in appsettings.php at variable: $domoticzhost
Replace "port" by the port you configured in appsettings.php at variable: $domoticzport
To be sure copy and paste the values in the url. If these are set to the proper values, your browser should show the Domoticz Dashboard page.

Hope this helps,
TikTicz

jack74
Posts: 9
Joined: Wednesday 16 November 2016 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by jack74 » Sunday 20 November 2016 19:28

Hi TikTicz,
thanks a lot for your quickly answer... :)

I attached my configuration and I think that it should be correct.
Can you indicate me where I should find the files generated by the script? Is it possible that I have some permission limits?


Jack
Attachments
domoticz_appsettings.jpg
domoticz_appsettings.jpg (282.59 KiB) Viewed 2952 times

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Sunday 20 November 2016 20:00

The syntax seems ok. Did you try "http://192.168.1.4:8080" in your browser and did it show the Domoticz dashboard?

I am not aware of any permission limits.

The script does not generate files. It creates devices in Domoticz. You can check this by selecting tabmenu "Setup" in domoticz and in the dropdownlist choose "Devices" and in one of the pages you should see something like on the screen print I included.
Klembord-2.jpg
Klembord-2.jpg (38.06 KiB) Viewed 2947 times
Also in tabmenu "Setup", option "Hardware" you should find "Eq3Virtual".
Klembord-4.jpg
Klembord-4.jpg (8.47 KiB) Viewed 2947 times

jack74
Posts: 9
Joined: Wednesday 16 November 2016 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by jack74 » Sunday 20 November 2016 20:40

Yes, I tried and it works...

I attached the http://192.168.1.4/eq3/eq3read.php results...

I don't know how to go on...

:roll:
Attachments
eq3read.php_results.txt
(83.78 KiB) Downloaded 38 times

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Sunday 20 November 2016 20:52

The eq3read.php results are fine.

Did you find "Eq3Virtual" in your Domoticz hardware tab? Can you provide a screenshot of your Domoticz hardware page?

jack74
Posts: 9
Joined: Wednesday 16 November 2016 13:27
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by jack74 » Sunday 20 November 2016 20:56

I attached two screnshots...

I hope that you can understand why the script doesn't work...

Thanks a lot for your support...
Attachments
dev.jpg
dev.jpg (366.51 KiB) Viewed 2937 times
hw.jpg
hw.jpg (388.16 KiB) Viewed 2937 times

TikTicz
Posts: 14
Joined: Friday 16 September 2016 20:35
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Eq3 Max - control with php scripts

Post by TikTicz » Sunday 20 November 2016 21:28

Attached a new version of the script files. As they contain some minor (not related) improvements replace your script files with the new ones. Also find an additional script domocreatenewhardwx.php
This is the same code as domocreatenewhardw.php but with some additional print instructions for debugging. Run domocreatenewhardwx.php and see if the result makes sense to you. If not upload the result of this script and I will take a look.
Attachments
eq3.zip
(279.13 KiB) Downloaded 55 times

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests