chrisjshull / homebridge-nest

Nest plugin for HomeBridge
700 stars 112 forks source link

Siri sets thermostat to auto (heat/cool) mode when asking it to change temperature and it is set on Cool #47

Closed ersan closed 6 years ago

ersan commented 6 years ago

I don't use Auto mode - I live in a warm area and I always leave the system on 'cool'. If I ask siri to "set the thermostat to 70" it will turn on auto (heat/cool) mode. Changing temperature via the slider doesn't do this.

EDIT: I realized that this happens when you set the temperature to be higher than the current ambient temperature. See my comment below.

I tried setting the low end temperature to 50 as a workaround but this royally screws up my Alexa integration, which apparently puts the target temperature halfway between the low and high end when you ask it to change the temperature and heat/cool mode is enabled.

This started happening after I upgraded homebridge-nest, I assume because this fork has auto mode implemented.

To Reproduce Steps to reproduce the behavior:

  1. Set thermostat to 'cool'
  2. Ask Siri to "set the thermostat to 70" or "set the temperature to 70"

Expected behavior I expect the thermostat to stay on 'cool', not switch to 'auto'

Include with your bug report this version info:

node --version - v7.7.4
homebridge --version - 0.4.42

Make sure you have the latest LTS from https://nodejs.org and the latest packages: npm upgrade -g homebridge homebridge-nest

Also include debug log output from startup through seeing the issue: DEBUG=* homebridge -D

  EventedHTTPServer [::ffff:192.168.1.89] HTTP request: /characteristics?id=32.11,32.9,32.15,32.16 +191ms
  HAPServer [CD:33:3D:E3:CE:30] HAP Request: GET /characteristics?id=32.11,32.9,32.15,32.16 +1ms
  Accessory [Homebridge] Getting value for Characteristic "Current Temperature" +3ms
  Accessory [Homebridge] Got Characteristic "Current Temperature" value: 21.1 +2ms
  Accessory [Homebridge] Getting value for Characteristic "Current Heating Cooling State" +1ms
  Accessory [Homebridge] Got Characteristic "Current Heating Cooling State" value: 0 +2ms
  Accessory [Homebridge] Getting value for Characteristic "Cooling Threshold Temperature" +1ms
  Accessory [Homebridge] Got Characteristic "Cooling Threshold Temperature" value: 20 +2ms
  Accessory [Homebridge] Getting value for Characteristic "Heating Threshold Temperature" +1ms
  Accessory [Homebridge] Got Characteristic "Heating Threshold Temperature" value: 17.7 +2ms
  EventedHTTPServer [::ffff:192.168.1.89] HTTP Response is finished +2ms
  EventedHTTPServer [::ffff:192.168.1.89] HTTP request: /characteristics +141ms
  HAPServer [CD:33:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":32,"iid":15,"value":20}] +3ms
  Accessory [Homebridge] Setting Characteristic "Cooling Threshold Temperature" to value 20 +1ms
[6/20/2018, 12:02:18 AM] [Nest] Queuing to set cooling threshold temperature 20
  EventedHTTPServer [::ffff:192.168.1.89] HTTP Response is finished +10ms
  EventedHTTPServer [::ffff:192.168.1.89] HTTP request: /characteristics +133ms
  HAPServer [CD:33:3D:E3:CE:30] HAP Request: PUT /characteristics +1ms
  Accessory [Homebridge] Processing characteristic set: [{"aid":32,"iid":12,"value":20}] +2ms
  Accessory [Homebridge] Setting Characteristic "Target Temperature" to value 20 +1ms
[6/20/2018, 12:02:19 AM] [Nest] Queuing to set temperature 20
  EventedHTTPServer [::ffff:192.168.1.120] Sending HTTP event '32.12' with data: {"characteristics":[{"aid":32,"iid":12,"value":20}]} +12ms
  EventedHTTPServer [::ffff:192.168.1.89] Muting event '32.12' notification for this connection since it originated here. +4ms
[6/20/2018, 12:02:19 AM] [Nest] Target temperature for Nest Thermostat is: 20 °C and 68 °F
ersan commented 6 years ago

I was digging through the commit history to see what was causing this and I found this: https://github.com/chrisjshull/homebridge-nest/commit/7c72502d626b64d479b65ede5921ca43ab2234b4

My Node/JS isn't great, but from what I can tell it was decided that if the current ambient temperature was below what you were setting it to then homebridge-nest should turn on heat/cool mode automatically? This is very much unwanted behavior from me, and probably most people that live in warmer climates. We tend to let the house warm up on its own rather than turning on the heater and wasting energy to get it to the target temperature. Most of us don't run our heaters ever and when they turn on it smells like the house is burning down (which is what happened to me today).

I'm going to try and roll back those changes for my setup, but there are at least two other people unhappy with this idea here https://github.com/KraigM/homebridge-nest/issues/169#issuecomment-398623230

Update: I personally checked out https://github.com/chrisjshull/homebridge-nest/commit/356e13ebb3ffb703cfc8a2ddfdc0b5988f750258 and am using that instead because that was the last version before the code that automatically sets heat/cool was added. I don't have the newer minor fixes but it works as expected now.

chrisjshull commented 6 years ago

Hmm, thanks for the logs and good sleuthing! I swear at the time I wrote 7c72502 Siri knew that when you were in a heat-only or cool-only mode and it would only set "TargetTemperature" and not the "Heating/CoolingThresholds". You can see now it's doing both "Cooling Threshold Temperature" followed by "Target Temperature". Unfortunately we can't just ignore "Target Temperature" since that's still the only thing set via the GUI slider. I'm also seeing that if you tell Siri to target a range it first sets the mode to auto (which I don't recall it doing before). I'm thinking the setHeatCoolIfNeeded() calls can be removed now. (though it would be esp. good to test what happens if you tell Siri to target a range when you are in single-type modes, and when you target a temp or range and the nest is off or in eco - there could be a race condition.) Let me know if you start working on a PR for this? (If not I'll get to it as soon as I can.)

ersan commented 6 years ago

I'm afraid I'd make a mess of things because I don't know Node/JS all that well (and I'm not totally sure on how to fix it anyway). I'd be happy to do any testing that might be needed.

On this old version when I told siri to "set the thermostat between 66 and 72 degrees" it said "The nest thermostat is not responding", but it did actually work (from the Cool state it was set in, it changed it to auto with the appropriate temperatures). I've now hit the API limit and I'm banned for an hour (and this would be the 10th time I've setup a new app in developer). I'll post a debug log when I'm unbanned again if you need it.

leehendricks commented 6 years ago

Same issue here. Something must have changed on Apple's end.

leehendricks commented 6 years ago

https://github.com/chrisjshull/homebridge-nest/pull/48

Just removed those calls as you suggested, @chrisjshull. Did not test the changes exhaustively, but if I'm in COOL mode, I stay in COOL mode after asking Siri to set a target temperature.

chrisjshull commented 6 years ago

fix has been deployed in v2.1.4: npm i -g homebridge-nest

Thanks @leehendricks!

RushHour2k5 commented 6 years ago

I confirm this issue has been resolved for me as well. Was only occurring on my iOS 11.4 devices and iOS 10.1.1 did not appear to be affected.