luc-ass / homebridge-evohome

Homebridge plugin for Honeywell Evohome
29 stars 16 forks source link

Homekit loosing thermostats if Honeywell server is unreachable #79

Closed Maykel1969 closed 1 year ago

Maykel1969 commented 3 years ago

Hi, I ran into a situation where at first I didn't know what was happening. My logfile was full of error messages as you can read further in this post. Luckily I still have the honeywell home app on my iphone so I found out that they are doing some maintenance. (looks unschedueled to me). My thermostat in the home app is gone and my automations for temperature are partly deleted.

The silly messages I got were:

27-1-2021 14:31:11 [MYNAME] Error during Login: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse () at Request._callback (/home/hoobs/.hoobs/node_modules/homebridge-evohome/lib/evohome.js:356:23) at Request.self.callback (/home/hoobs/.hoobs/node_modules/request/request.js:185:22) at Request.emit (events.js:315:20) at Request. (/home/hoobs/.hoobs/node_modules/request/request.js:1154:10) at Request.emit (events.js:315:20) at IncomingMessage. (/home/hoobs/.hoobs/node_modules/request/request.js:1076:12) at Object.onceWrapper (events.js:421:28) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)

luc-ass commented 3 years ago

Thank you for reporting the issue. I will try to have a look into it as soon as possible.

Maykel1969 commented 3 years ago

The whole website is down! https://www.mytotalconnectcomfort.com/ ---> Http/1.1 Service Unavailable

JesseRiemens commented 3 years ago

This is correct, it coincidentally went down with some other services I use so they might be correlated.

However, the main issue here is that whenever the plugin loses contact with the server it reports back to homekit as "not containing accessories". This in turn destroys any adjustments you've made to them in homekit. It would be really neat if it 'caches' the accessories and sends them back as 'not responding' whenever no connection with honeywell can be made. Could you add that or should I make a seperate feature request?

You would save me an hour or two every month or so when it reconnects, I could imagine more people would benefit from this! Edit: it seems to be the same issue as #61 , this should be fixed when that is.

Maykel1969 commented 3 years ago

Just noticed that the website is back online and also the connection to homekit works again. Now I need to re-set my automations...

luc-ass commented 3 years ago

@JesseRiemens, you are absolutely right. This is a major annoyance. I'll have a look into this and report back as soon as I have more information about it.

luc-ass commented 3 years ago

Just an additional note: I have not been home all day and my system did not loose the assigned rooms for some reason. The connection loss seems to have happened here as well... still investigating...

luc-ass commented 3 years ago

Okay - so I got in contact with the guys at the Homebridge Discord. The basic solution to our problem is to rewrite the plugin using the new "dynamic-platform". This is done in typescript and needs large parts of the code reinvented so this won't happen over night. As I don't have loads of time on my hands I will give my best, but help is very much appreciated! There is a typescript branch from where I will try to do something so keep an eye on that one. In the mean time here are some examples:

https://github.com/homebridge/homebridge-examples/tree/master/dynamic-platform-example-typescript https://github.com/donavanbecker/homebridge-honeywell-home

JesseRiemens commented 3 years ago

To be fair I don't have a lot of experience in JS or Typescript but I'd love to help and learn something new. I'll see if I have an evening or two to help with this issue. In the meantime, how do I build this from source?

luc-ass commented 3 years ago

Sounds great! As of now there is no "building" involved. This plugin basically logs into Honeywell via the api and then either requests the data or posts data to change values. If you are looking for a starting point, look into the /typescript branch and then into lib/evohome.js

Maykel1969 commented 3 years ago

My coding skills are very dusty, I'm from the age of Basic, Pascal and assembler on 8085, Z80 etc. But I'll can test whatever you want!

luc-ass commented 3 years ago

Some more reading material: https://developers.homebridge.io/#/

luc-ass commented 3 years ago

Okay. So our "dev" branch is now "refactoring". I will put a base structure into that folder. Let's see how fast we progress...

luc-ass commented 1 year ago

As far as I am concerned this has the same root cause as #61. Closing because v0.9.0 should fix it.