Refactored Honeywell evohome custom_component (EU-only)


#1

[ Final edit 2018/09/17 - I can no longer update this post as it is > 2 months old ]

Component, or Custom Component?
Until this component is fully integrated into HA (an initial PR has been sent), you’ll very likely want to use the custom_component version; for the latest instructions on how to install/configure it, please go to:

GitHub

zxdavb/evohome

Home Assistant Custom Component for Honeywell Evotouch - zxdavb/evohome

I will edit the README.md there when I recommend switching over to the HA component version.

Please also report any issues there.

NOTE: You should ignore any installation instructions, below - they may well be hopelessly out-of-date.

[ Edited 2018/09/04 with two options to install ]

I know it’s Summer, but I am hoping to get this accepted into HA before next cold season.

This is for EU only as is uses: https://github.com/watchforstock/evohome-client … and so supports only installations available from: https://international.mytotalconnectcomfort.com

It has many improvements over the existing ‘honeywell’ compnent, and it definitely worth a look:

  • slightly limited (i.e. no high-precision temperatures) support for accounts with multiple locations (you can specify which location)
  • exposes the controller, allowing access to your location’s operating modes (e.g. Eco/Away/Off modes)
  • exposes the DHW controller, if any (can read temperature & state, and set operating mode)
  • and more!

**configuration.yaml**
I recommend the following configuration (only `username`, `password` is required).  The old honeywell component should be 'runnable' can run side-by-side with this (new) evohome component:

evohome:
username: !secret evohome_username
password: !secret evohome_password

All following config parameters are presented with their default values:

scan_interval: 300 # seconds, you can probably get away with 60

high_precision: true # tenths instead of halves

location_idx: 0 # if you have more than 1 location, use this

These config parameters are YMMV:

use_heuristics: false # this is for the highly adventurous person

use_schedules: false # this is for the adventurous person

away_temp: 15.0 # if you have a non-default Away temp

off_temp: 5.0 # if you have a non-default Heating Off temp


A lot of debug data can be had by turning on logging, and trying `cat home-assistant.log | grep evohome`:

logger:

default: warn

logs:
homeassistant.components.evohome: debug
homeassistant.components.climate.evohome: debug

evohomeclient2: debug


If you find a bug that persists after updating to the latest version of the component, please report it via github, _after_ checking: 
https://github.com/zxdavb/home-assistant

Thanks to @matthewcky2k and @jarrah (who since chickened-out) for allowing me to use their DHW!

**Exceeding api limits, Unavailable devices, and HTTP 503s**
The component one of many that polls a web site for the status of a IoT device in your home.  This causes issues with propagation delay, and relative unreliability of the Internet.  

With this in mind, this component gracefully handles the following two issues:
  a) exceeding api call limits (will throw a warning and 'back off')
  b) installation/component unavailable for whatever reason (e.g. HTTP 503s), for example:

`2018-09-01 09:00:50 DEBUG (MainThread) [homeassistant.components.evohome] available(3449703) = False, self._status = {'zoneId': '3449703', 'temperatureStatus': {'isAvailable': False}, 'activeFaults': [{'faultType': 'TempZoneSensorCommunicationLost', 'since': '2018-08-30T22:13:59'}, {'faultType': 'TempZoneActuatorCommunicationLost', 'since': '2018-08-30T22:44:00'}], 'setpointStatus': {'targetHeatTemperature': 15.0, 'setpointMode': 'FollowSchedule'}, 'name': 'Bathroom', 'setpoint': 15.0}, self._timers = {'statusUpdated': datetime.datetime(2018, 9, 1, 9, 0, 49, 425578)}`

Honeywell Evohome thermostat: work started, need advice
#2

This is working great on my setup, thank you very much for all your work!!!

Unfortunately this message still appears when doing the configuration check:

Testing configuration at /home/homeassistant/.homeassistant
Failed config
  evohome:
    - Invalid config for [evohome]: required key not provided @ data['platform']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/evohome/

Also, is it possible to move some of these console messages to debug please?

2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] should_poll(TCS=1261191) = True
2018-07-15 19:14:54 INFO (Thread-10) [custom_components.evohome] update(TCS=1261191)
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] state(TCS=1261191) = AutoWithEco
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] supported_features(TCS=1261191) = 1152
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] current_operation(TCS=1261191) = AutoWithEco
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] operation_list(TCS=1261191) = ['Auto', 'AutoWithEco', 'AutoWithReset', 'Away', 'DayOff', 'HeatingOff', 'Custom']
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] state_attributes(TCS=1261191) = {'operation_list': ['Auto', 'AutoWithEco', 'AutoWithReset', 'Away', 'DayOff', 'HeatingOff', 'Custom'], 'operation_mode': 'AutoWithEco'}
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] supported_features(TCS=1261191) = 1152
2018-07-15 19:14:54 INFO (MainThread) [custom_components.evohome] force_update(TCS=1261191) = False

Just to say, I love the built-in menu options which are available when I click “_home” for example.


#3

One quick thing I’ve noticed - if for example I go to “heating off”, the reported state within HA always shows AutoWithEco. The internal controller does correctly show heating off though. You can see some examples in these logs where it sets the state but keeps showing AutoWithEco:

https://hastebin.com/sawipekovu.sql

Thanks in advance!


#4

I just fixed a few bugs. Can you test it again, but make sure you use this configuration:

  scan_interval: 60
  high_precision: true
  use_heuristics: true
  use_schedules: false

Re: the logspam - fair enough - I will start moving to them to debug.


#5

Thanks, I’ll test that tonight.

Quick question, where do I put those configuration options please?


#6

Under evohome:, just like the username & password.


#7

Hi,

I just “installed” your component: evohome
This is my entry in my config.yaml file :

  climate:
    - platform: evohome
      username: !username
      password: !password
      scan_interval: 60
      high_precision: true
      use_heuristics: true
      use_schedules: false

I also copied evohome.py from your github project page, into /myhomeasssistanthomedirectory/custom_components

I must add here, that there is / was some confusion about that evohome.py file, because you have one evohome.py “in the open”, outside any directory and one evohome.py file in the climate directory, on your github page. I copied the “big one” … :slight_smile: … the one “in the open”.

I get a few error messages in Home Assistant dev-log, after restart, but one of them is clear:

Cannot setup platform evohome !

I’m running Home Assistant from a docker container and everything else is set up and running smooth.
Even the old climate: - honeywell component, was working fine … but I have to try your version, I must ! … :slight_smile:

I have no idea what am I doing wrong, any thoughts ?! Thank You.


#8

Your configuration file is called:configuration.yaml it should be in /.homeassistant. I am not sure if yours is correct, see my example, above. Please edit your entry, above to have username: !secret username, and password: !secret password, so others are not confused.

You must have both files. The easiest way is:

cd .homeassistant
mkdir custom_components
cd custom_components
git clone https://github.com/zxdavb/evohome .

#9

Thanks, now we are getting somewhere.

Now it throws an error like this : Error while setting up platform evohome
At least it’s loading / doing something … :slight_smile:

Log Details (ERROR)
Mon Jul 16 2018 16:56:05 GMT+0300 (Eastern European Summer Time)

Error while setting up platform evohome
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climate/evohome.py", line 26, in setup_platform
    ec_api = hass.data[DATA_EVOHOME]['evohomeClient']
KeyError: 'data_evohome'

#10

Actually, I can reproduce your error if I use:

climate:
  - platform: evohome
    username: !secret evohome_username
    password: !secret evohome_password

… instead of:

evohome:
  username: !secret evohome_username
  password: !secret evohome_password

–SNIP–

There must be an error message before that one? You can turn on debugging by adding:

logger:
  logs:
    custom_components.evohome: debug
    custom_components.climate.evohome: debug

Then try: cat home-assistant.log | grep "Config data"


#11

lol … I thought you will take much longer to reply, so I left home for a walk. I see that my phone is already logged in with my other account. So … Smoculetz = SMARTMEDIA … :slight_smile:

On topic :

At first, I did append my configuration.yaml file, just like you stated in your github tutorial. (without climate and all …) but the component would not even try to load and the HA instance would not restart, stating that was an error in my config file. But then again, I must have not copied both evohome.py files back then and the climate directory didn’t made it, also … :slight_smile: . But now I did. It’s all in there now.
As soon as I return home, I’ll revert back to the original input in my configuration.yaml (the one from github). I’m on my way. Thank You for your patience.

By the way, this is all running in a Docker container, on a Synology machine, which is not easy to interact with, as with a normal linux distribution. (at least for me, as a non-programmer, it isn’t).


#12

So I got home and did the following:

I edited the configuration.yaml file, so now it looks like this:

evohome:
  username: myusername
  password: mypassword
  scan_interval: 120
  high_precision: true
  use_heuristics: false
  use_schedules: false

I checked again for the files and paths, and all looks like this:

Inside /pathtohomeassistant/custom_components

Inside /pathtohomeassistant/custom_components/climate

Homeassistant is throwing this, right in the frontend:
image

And in the dev-log, I have this:
image

The first error is detailed here:

Log Details (ERROR)
Mon Jul 16 2018 19:04:15 GMT+0300 (Eastern European Summer Time)

Error during setup of component evohome
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/setup.py", line 146, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/evohome.py", line 184, in setup
    _updateStateData(hass.data[DATA_EVOHOME])
  File "/config/custom_components/evohome.py", line 211, in _updateStateData
    debug=False
  File "/usr/local/lib/python3.6/site-packages/evohomeclient2/__init__.py", line 18, in __init__
    self._login()
  File "/usr/local/lib/python3.6/site-packages/evohomeclient2/__init__.py", line 76, in _login
    self.installation()
  File "/usr/local/lib/python3.6/site-packages/evohomeclient2/__init__.py", line 86, in installation
    r = requests.get('https://tccna.honeywell.com/WebAPI/emea/api/v1/location/installationInfo?userId=%s&includeTemperatureControlSystems=True' % self.account_info['userId'], headers=self.headers)
TypeError: list indices must be integers or slices, not str

The second error, is detailed here:

Log Details (ERROR)
Mon Jul 16 2018 19:04:15 GMT+0300 (Eastern European Summer Time)

Connect to client (Honeywell web) API: failed!

Please, if I can help with anything else, I’m right here ! … :slight_smile:


#13

Just to double check, are the file permissions set correctly to “homeassistant”?

[email protected]:/home/homeassistant/.homeassistant/custom_components $ ls -al
total 88
drwxr-xr-x  4 homeassistant homeassistant  4096 Jul 15 18:49 .
drwxr-xr-x 10 homeassistant homeassistant  4096 Jun 15 07:52 ..
drwxr-xr-x  3 homeassistant homeassistant  4096 Jul 15 18:54 climate
-rw-r--r--  1 homeassistant homeassistant 64445 Jul 15 18:49 evohome.py

#14

The updates have fixed the reported schedule - thanks!

Do you know if the current schedule could be shown next to _Home in the same way that temperature and status is for Hallway and DHW please?

On a side note, I’m currently using the following yaml to display the sensor data - is this the best way or do you have better suggestions? I realise the sensor entities are redundant now - I included them before I realised this information was displayed with climate as well.

group:
  heating_sensors:
    name: Central Heating Status
    entities:
      - sensor.heating_demand
      - sensor.heating_actual
      - sensor.dhw_actual
      - climate._home
      - climate.hallway
      - climate.dhw
      - climate.dhw_sensor
sensor:
  - platform: template
    sensors:
      heating_demand:
        value_template: '{{ states.climate.hallway.attributes["temperature"] | replace(" c", "") | float }}'
        unit_of_measurement: '°C'
        friendly_name: "Heating Demand"

      heating_actual:
        value_template: '{{ states.climate.hallway.attributes["current_temperature"] | replace(" c", "") | float }}'
        unit_of_measurement: '°C'
        friendly_name: "Heating Actual"

      dhw_actual:
        value_template: '{{ states.climate.dhw_sensor.attributes["current_temperature"] | replace(" c", "") | float }}'
        unit_of_measurement: '°C'
        friendly_name: "Hot Water Actual"

#15

I guess that is the first ERROR message? Can you check your username & password? Have you redacted your configuration.yaml, or did you really forget to put !secret in there?

The underlying client api does not provide any means to notify that authentication has failed.

Or it could be a 503…

In any case, you’re close (and your file permissions are OK).


#16

Yeah, about that secrets.yaml file, I never got to implement that component. Every time I need to post some piece of coded *.yaml entry, I need to be careful and edit those lines. But now that you mentioned it, I upgraded to it. I have a secrets.yaml file as we speak, and it’s working great. Thanks for pushing me … :slight_smile: … and about those credentials, I’ve just checked them against the Honeywell login site : Honeywell International Login and I can login just fine.
I just restarted the docker container. I cannot restart via the restart button in the Home Assistant interface because every time I try, it’s giving me this error:

Log Details (ERROR)
Tue Jul 17 2018 06:11:39 GMT+0300 (Eastern European Summer Time)

Invalid config for [evohome]: required key not provided @ data['platform']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/evohome/

… and it will not permit the Home Assistant instance to restart. So I just restart the docker container from the Synology Docker Interface.

On topic: Same errors as above, with the !secrets in place. I’ll have to get dirty and keep digging … :slight_smile:


#17

SOLVED … yeah baby, yeah ! … :slight_smile:

So what was it ?, well, it was a file. This file : evohome.cpython-36.pyc

I started looking for changes, things that were not there before the evohome component. Among other things, in the custom_components directory, there was another directory that I did not create or put there. The directory name is : __pycache__
Inside this odd named thing, there were 2 files, one of them, our culprit, the one mentioned above. I was pretty sure, it was created by our new component. So I think mine was somehow not right, because of my first attempt of configuring the evohome component in my configuration.yaml file (where I wrote it with - climate … and stuff, the first time). So I went ahead and deleted the damn thing. I then went right along and restarted the HA Docker Container and voila ! … no errors this time !! The file appeared again … I think is following me, but I’ve got my eye on him ! … :slight_smile:

image

Took me long enough but if I can help anyone in the future, there it is … my solution to my own problem.

Thank you for your patience guys and for your help.


#18

Sorry guys, there was a bug where state was updated only when HA was started, and (mostly) never after that. I have found the cause, and now current_temperature is working.

A full fix is in progress, I just gotta work out why a = b['x'] (shallow copy) is acting like a = dict(b['x']) (deep copy) and then we’re good for the other state parameters.

If your component is missing def getZoneById(), then you’re affected, and you can simply update to the latest repo.


#19

You can see from the following screen grab, the problem was fixed just after 8pm, and any variation from a straight line before that time was effected only by restarting HA.

I have 12 zones, and I record temps (recorded in DB to 0.01 but displayed to 0.1 of precision) every 60s. The number of zones is irrelevant (it is just a single api call, or 3 calls for higher-precision temps) every minute, or 180 per hour.


#20

I keep getting the following error, i did a reboot a couple of time and this error continue happening:

Fri Jul 27 2018 16:09:55 GMT+0200 (Ora legale dell’Europa centrale)

Update for climate._home fails
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 196, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 319, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/evohome.py", line 901, in update
    _updateStateData(self.hass.data[DATA_EVOHOME])
  File "/config/custom_components/evohome.py", line 314, in _updateStateData
    ec2_status = client.locations[idx].status()
  File "/config/deps/lib/python3.6/site-packages/evohomeclient2/location.py", line 29, in status
    r.raise_for_status()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 939, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 503 Server Error: Service Unavailable for url: https://tccna.honeywell.com/WebAPI/emea/api/v1/location/2618468/status?includeTemperatureControlSystems=True

Also having this warning:

Log Details (WARNING)
Fri Jul 27 2018 15:58:44 GMT+0200 (Ora legale dell’Europa centrale)

Failed to increase precision of temperatures via the v1 api.  Continuing with v2 temps.

keep in mind that I have very low programming skill so i’m not sure if i reported the log correctly.
If you need additional information or different report please advice.