Evohome client (August 2017 update)

For heating/cooling related questions in Domoticz
gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Evohome client (August 2017 update)

Post by gordonb3 » Saturday 26 November 2016 18:15

Just to let you all know: I'm rewriting the Evohome (web) client to C++. My primary goal is to replace the python scripts from the wiki by a binary, but it may also be possible to integrate the library in the main Domoticz code some time later.

Project is here on Github. Suggestions and feedback are welcome.
Last edited by gordonb3 on Wednesday 09 August 2017 16:53, edited 4 times in total.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client

Post by gordonb3 » Wednesday 30 November 2016 15:58

Got my first working application out

Code: Select all

b3 ~ # time source/evo-update -c evoconfig.py

real	0m2.202s
user	0m0.260s
sys	0m0.040s

Code: Select all

b3 ~ # time ./evo-update.sh 

real	0m13.462s
user	0m6.920s
sys	0m0.690s
Quite a difference on my little machine. And subsequent calls are even faster because I create a local cache of the schedules.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client

Post by gordonb3 » Thursday 01 December 2016 0:45

Speed increment is even better than I thought at first. I've just been looking at my Last Seen stats, and where I used to get times of up to 45 seconds after firing of the python script through cron this is now down to 3 seconds! I knew python was sluggish, but I did not expect this result. Wow!

Pushing data to the Evohome system proved to be something of a challenge. I kept receiving weird responses even when sending datagrams generated through the working python client. But I finally figured it out and I just managed to change the mode of my system and upload a schedule to one of my zones. Things should be a breeze from here.

I've been asked whether this code will run on Windows as well. In essence it should, but minor adaptations might be required. I'm not really a Windows guy, so I can't give any pointers on how to make a Windows executable from this. If anybody can give some tips or hints I'd be happy to put up a binary once I mark a release on GitHub..
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client

Post by gordonb3 » Tuesday 06 December 2016 22:11

Library for API version 1 is complete.

And I have a full working replacement for the set of python scripts to let Domoticz communicate with Evohome web.

Bonus:
  • neatly formatted error messages instead of python core dumps
  • status updates include next switch time from schedule
  • when changing a setpoint, the Evohome client will correct the (faulty) UTC end time in Domoticz
  • when cancelling an override, the Evohome client will update the target temperature in Domoticz from the regular schedule.
Example make command:

Code: Select all

make EXTRAFLAGS="-DCONF_FILE=\\\"/etc/domoticz/evoconfig\\\" -DSCHEDULE_CACHE=\\\"/var/lib/domoticz/evohome-schedules.json\\\""
(note the double escapes)

Example crontab:

Code: Select all

*/2 * * * * /opt/domoticz/scripts/evohome/evo-client -k
1 3  * * * /opt/domoticz/scripts/evohome/evo-client --reload-cache
(updates the Evohome statuses in your screen every two minutes and updates the locally cached schedule at 3:01 AM)

Note that if you like to update every minute and also be able to reload the schedule cache you must make sure that the daily routine is run before the each minute routine. To prevent overloading your Evohome account there is a safety mechanism in place that prevents running an update within a minute of any previous action.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client

Post by gordonb3 » Thursday 08 December 2016 18:06

I've got some additional work done. If you left the default for the config file, the application will now also search the application path if it cannot find the evoconfig file in the current path. There is now a port to Windows as well

I have marked a release with prebuilt binaries for
  • Windows x86
  • Linux x86
  • Linux x64
  • Linux armv5te
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client

Post by gordonb3 » Friday 09 December 2016 11:51

Minor fix to the Windows version:

Due to an incorrect path setting for Windows the lock file to prevent overloading your Evohome account could not be written or checked. As a result you could run the previous version in a continuous loop, which will surely get you blacklisted by Honeywell.


Direct link to the updated version
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

Gabriel77
Posts: 2
Joined: Thursday 15 December 2016 15:17
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Evohome client (release)

Post by Gabriel77 » Thursday 15 December 2016 15:23

Excellent work!
I would like to try it, I have Domoticz in Rpi3 and RFG100.
How would I have to do to install it?
Thank you!

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Thursday 15 December 2016 18:23

To compile it on the Pi you need to `apt-get install build-essential` You will also need the dev libraries for json-c and curl. As an option you could cross-build it on another Linux machine. Sorry to say it is currently impossible for me to supply a prebuilt binary for Pi. I do not expect the armv5te binary to run on it.

Once compiled, edit the evoconfig.sample file and rename it to evoconfig. The default for this file is to look in the current directory and if it is not found it will try to find it in the same directory as the executable. It will be okay to put both files in the scripts directory of your Domoticz installation. If you already had the python scripts running, the application will continue to run with the existing Evohome objects in Domoticz. If not, run the application with parameter `--init` to create the Evohome objects in Domoticz (after editing evoconfig).


PS I have added a new feature for easier command line operation: when setting overrides you may now also specify the time until values as +nn minutes.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Thursday 15 December 2016 18:26

New release: version 1.1.0

This adds a new command line option to specify the time until value as +nn minutes in the future.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Friday 16 December 2016 18:35

I have been informed that there is an issue with the init routine. The current version will only allow adding one zone at a time as each new zone is configured to use the same unoccupied ID in Domoticz. You can still add them all though by running the init routine multiple times in a row (ignore warnings).

A fix is available in the current source on the master branch. New binaries for platforms I can verify myself will be available soon.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Tuesday 20 December 2016 20:19

New hotfix version: https://github.com/gordonb3/evohomeclie ... ag/1.1.0.4

This release fixes various issues with the init procedure and adds support for zone names containing spaces and other special characters. An attempt was made to allow the script to be called on a Windows path containing space characters (i.e. C:\Program Files (x86)\Domoticz\scripts\) but it appears this is blocked from within Domoticz. If someone does like to use this on Windows I therefore suggest you place this application on a path that does not contain any spaces (e.g. C:\ProgramData\Domoticz\scripts\). As an alternative you may also reference the DOS compatible path C:\Progra~1 (or ~2) if this is available on your system (it might not be!).
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Friday 30 December 2016 20:04

Tip for Windows users:

Due to a piece of code in Domoticz that does not work very well with Windows paths you cannot use a full application path containing a drive letter to point to the evohome client. As a result you must put the evohome client in a folder that is on the same drive as your Domoticz installation. You can also not use paths containing spaces, but it should also work with paths like "progra~1"

If you have Domoticz installed in C:\Program Files (x86)\Domoticz my advise is that you create a folder C:\ProgramData\Domoticz\scripts (may also be a junction) and use the following matching srt entry in evoconfig:

Code: Select all

srt = 'script:///ProgramData/Domoticz/scripts'
Note the triple slash and conversion from backslashes to forward slashes.

New version with added logging feature
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

DanM
Posts: 74
Joined: Thursday 23 October 2014 22:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Evohome client (release)

Post by DanM » Sunday 01 January 2017 18:19

Hi,

Ive complied the code on the pi and everything seems to be OK apart from the ability to set overrides from within domoticz. Anything blindingly obvious I may have missed?

Thanks for making this - it looks great

Dan.

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Sunday 01 January 2017 20:22

If you look at the onAction property in the Evohome controller switch, does it show the correct path to the evohome client? If not this would mean that the value for `srt` is incorrectly set in evoconfig. Another possible fault may be that evoconfig is not found when the application is accessed from Domoticz. I don't really know how raspbian is organised - I think it is common to run Domoticz from /home/pi while in normal Linux you are most likely to run it from /usr/local or /opt - and it might be possible that Domoticz is running in a chroot environment where the path you are calling for the evohome client does not exist.

If you like you can add a logging parameter to the onAction property in the switch, which should show what is wrong. If the application is in fact called of course. Check Domoticz log for failures finding the evohome client.

Note that if you had the python based client from the wiki running before, this client should run straight out of the box with your existing evoconfig.py (just clear the .py extension) and Domoticz objects as it was built to replace that set of scripts. It has been running like that on my own installation since even before I created the 1.0 release.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

DanM
Posts: 74
Joined: Thursday 23 October 2014 22:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Evohome client (release)

Post by DanM » Sunday 01 January 2017 21:11

I had my config wrong - all working 100% now on the pi. I didnt install the python version first - went straight for yours. Works great - thanks.

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Sunday 01 January 2017 21:59

Good man. 8-)

Could you clarify what was wrong? I may place it in a wiki page if it is a pitfall that others are likely to encounter as well.

PS would you be willing to share the binary you built?
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

DanM
Posts: 74
Joined: Thursday 23 October 2014 22:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Evohome client (release)

Post by DanM » Tuesday 03 January 2017 0:02

I was just pointing at the wrong directory in the config. Literally a typo! Happy to share the binary - DM me how best to send it to you.

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Thursday 05 January 2017 14:36

Regarding the tip for Windows users:

It appears different Windows versions may respond different to the suggested input. That is: while it was reported to run on Windows 10, on a Windows 7 x64 I could not make the change temperature call work whatever I threw at it. The good news is that the issue is solved in the latest Domoticz beta. Please use absolute paths, e.g. C:\Progra~2\Domoticz\scripts\evohome, as relative paths do tend to not fire even though the log claims it does.

I have a new update that addresses some minor issues in the client, including fixating the location of the lockfile `evo-lastup` and the schedule cache to the same directory as the client (on linux the lockfile will use the fixed location /tmp) so these don't pop up on various locations on your system. Lock time is reduced from 60 to 50 seconds so you can now do one minute updates if you like.

Version 1.1.0.6 can be downloaded from this location
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

Gabriel77
Posts: 2
Joined: Thursday 15 December 2016 15:17
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Evohome client (release)

Post by Gabriel77 » Thursday 05 January 2017 15:18

DanM wrote:I had my config wrong - all working 100% now on the pi. I didnt install the python version first - went straight for yours. Works great - thanks.
Hello!
Could you share the steps to follow to install it on the raspberry pi?

Thank you!

gordonb3
Posts: 500
Joined: Friday 22 January 2016 11:15
Target OS: Linux
Domoticz version: custom
Location: The Netherlands
Contact:

Re: Evohome client (release)

Post by gordonb3 » Thursday 05 January 2017 17:59

Hi,

Are you running Raspbian? It's been a while since I did any Debian based stuff, but the first thing you'll need is a dev environment (if you did not install that already)

Code: Select all

apt-get install build-essential
To build this particular project you'll also need the developer libraries for curl and json-c. I had to look these up, but I think this should do it:

Code: Select all

apt-get install json-c-dev libcurl4-openssl-dev
Then run `make` from the main project folder (where `Makefile` is in). It's not a very big compile job - it will probably finish in about a minute.
Excito B3 running Gentoo Linux, P1, Rfxtrx433 to read and control TFA, KaKu, EvoHome RFG100
Custom patched Domoticz v3.8000

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests