joeyhage / homebridge-alexa-smarthome

Connect Alexa devices to HomeKit
MIT License
62 stars 20 forks source link

Fix: Display proper HVAC operation #103

Closed nyirsh closed 4 months ago

nyirsh commented 5 months ago

Description

After updating to the latest version I noticed that my thermostat in KH showed "Cooling off to X" despite being in the HEAT state, confirmed by the Alexa app too.

The code was looking for the first entry in the state that matched the namespace Alexa.ThermostatController.HVAC.Components with name being either primaryHeaterOperation or coolerOperation, without considering its actual status. In the json returned by my Alexa API there were two entries matching those criteria, but the coolerOperation one appeared first and got therefore matched as the current state despite being OFF

...
  {
    "namespace": "Alexa.ThermostatController.HVAC.Components",
    "name": "coolerOperation",
    "value": "OFF"
  },
...
  {
    "namespace": "Alexa.ThermostatController.HVAC.Components",
    "name": "primaryHeaterOperation",
    "value": "STAGE_1"
  },

I changed the code to match any entry that is not set to OFF, built and test locally and the current state is now properly displayed.

shenghan97 commented 5 months ago

I can confirm this is happening to me too. Thank you for this and I hope this can be merged soon!