homebridge-plugins / homebridge-resideo

The Homebridge Resideo plugin allows you to access your Resideo devices from HomeKit.
ISC License
38 stars 8 forks source link

LCC - T5 devices #213

Closed sdamasoc closed 4 years ago

sdamasoc commented 4 years ago

Describe The Bug:

I have a T5 honeywell thermostat and I got the follow error when try to add it to homebridge: device.groups is not iterable

I found this error on the issue for TCC devices where a special if was added to platform.js.

I switched the "TCC" string with "LCC" string on the platform.js file lines 272 and 402 and now it's working.

I assume that the groups array is not available on the honeywell api and LCC should be handled as a TCC.

To Reproduce:

Expected behavior:

Logs:

{
  displayedOutdoorHumidity: 52,
  vacationHold: { enabled: false },
  currentSchedulePeriod: { day: 'Tuesday', period: 'P1' },
  scheduleCapabilities: {
    availableScheduleTypes: [ 'None', 'Geofenced', 'TimedEmea' ],
    schedulableFan: false
  },
  scheduleType: { scheduleType: 'Timed', scheduleSubType: 'EMEA' },
  scheduleStatus: 'Resume',
  allowedTimeIncrements: 10,
  settings: {
    hardwareSettings: { brightness: 2, maxBrightness: 5 },
    temperatureMode: { air: true },
    specialMode: {},
    devicePairingEnabled: true
  },
  deviceClass: 'Thermostat',
  deviceType: 'Thermostat',
  deviceID: 'LCC-00D02DC1A545',
  userDefinedDeviceName: 'Thermostat',
  name: 'Thermostat',
  isAlive: true,
  isUpgrading: false,
  isProvisioned: true,
  macID: '00D02DC1A545',
  deviceSettings: {},
  service: { mode: 'Up' },
  deviceRegistrationDate: '2018-01-08T20:04:07.3733333',
  dataSyncStatus: 'Initiated',
  units: 'Celsius',
  indoorTemperature: 23,
  outdoorTemperature: 17,
  allowedModes: [ 'Heat', 'Off' ],
  deadband: 0,
  hasDualSetpointStatus: false,
  minHeatSetpoint: 5,
  maxHeatSetpoint: 35,
  minCoolSetpoint: -18,
  maxCoolSetpoint: -18,
  changeableValues: {
    mode: 'Off',
    heatSetpoint: 23,
    coolSetpoint: 10,
    thermostatSetpointStatus: 'NoHold',
    nextPeriodTime: '22:30:00',
    heatCoolMode: 'Heat',
    endHeatSetpoint: null,
    endCoolSetpoint: null
  },
  operationStatus: {
    mode: 'EquipmentOff',
    fanRequest: false,
    circulationFanRequest: false
  },
  deviceModel: 'T5-T6'
}

Homebridge Config:

Show your homebridge config.json here.
Remove any sensitive information, such as your homebridge-gsh / google-smarthome token.

Screenshots:

Thermostat Model:

Environment:

donavanbecker commented 4 years ago

@sdamasoc this is actually not the correct way to fix this. Please provide me more logs in debug mode so that I can work on getting this fixed for you.

sdamasoc commented 4 years ago

Here are my logs:

[9/2/2020, 3:30:11 PM] [HoneywellHome] New refresh token: YYYYYYYYYYYYYYYYYYYYYYYYYYY
[9/2/2020, 3:30:11 PM] [HoneywellHome] Homebridge config.json has been updated with new refresh token.
[9/2/2020, 3:30:12 PM] [HoneywellHome] # of Locations Found: 1.
[9/2/2020, 3:30:12 PM] [HoneywellHome] Getting devices for Mon domicile...
[9/2/2020, 3:30:12 PM] [HoneywellHome] 537879
[9/2/2020, 3:30:12 PM] [HoneywellHome] {
  locationID: 537879,
  name: 'Mon domicile',
  country: 'BE',
  zipcode: '1620',
  devices: [
    {
      displayedOutdoorHumidity: 43,
      vacationHold: [Object],
      currentSchedulePeriod: [Object],
      scheduleCapabilities: [Object],
      scheduleType: [Object],
      scheduleStatus: 'Resume',
      allowedTimeIncrements: 10,
      settings: [Object],
      deviceClass: 'Thermostat',
      deviceType: 'Thermostat',
      deviceID: 'LCC-00D02DC1A545',
      userDefinedDeviceName: 'Thermostat',
      name: 'Thermostat',
      isAlive: true,
      isUpgrading: false,
      isProvisioned: true,
      macID: '00D02DC1A545',
      deviceSettings: {},
      service: [Object],
      deviceRegistrationDate: '2018-01-08T20:04:07.3733333',
      dataSyncStatus: 'Initiated',
      units: 'Celsius',
      indoorTemperature: 23,
      outdoorTemperature: 19.5,
      allowedModes: [Array],
      deadband: 0,
      hasDualSetpointStatus: false,
      minHeatSetpoint: 5,
      maxHeatSetpoint: 35,
      minCoolSetpoint: -18,
      maxCoolSetpoint: -18,
      changeableValues: [Object],
      operationStatus: [Object],
      deviceModel: 'T5-T6'
    }
  ],
  users: [
    {
      userID: 603029,
      username: 'zzzz@xxxxx.com',
      firstname: 'xxxx',
      lastname: 'xxxxx',
      created: 1515441553,
      deleted: -62135596800,
      activated: true,
      connectedHomeAccountExists: true,
      locationRoleMapping: [Array],
      isOptOut: '',
      isCurrentUser: true
    },
    {
      userID: 1182162,
      username: 'zzzz@xxxxx.com',
      firstname: 'xxxx',
      lastname: 'xxxxx',
      created: 1545900958,
      deleted: -62135596800,
      activated: true,
      connectedHomeAccountExists: true,
      locationRoleMapping: [Array],
      isOptOut: 'True',
      isCurrentUser: false
    }
  ],
  timeZone: 'W. Europe Standard Time',
  ianaTimeZone: 'Europe/Berlin',
  daylightSavingTimeEnabled: true,
  geoFenceEnabled: false,
  predictiveAIREnabled: false,
  comfortLevel: 0,
  geoFenceNotificationEnabled: false,
  geoFenceNotificationTypeId: 13,
  configuration: {
    faceRecognition: {
      enabled: false,
      maxPersons: 10,
      maxEtas: 2,
      maxEtaPersons: 1,
      schedules: [Array]
    }
  }
}
[9/2/2020, 3:30:12 PM] [HoneywellHome] # of Thermostats Found at Mon domicile: 1.
[9/2/2020, 3:30:12 PM] [HoneywellHome] {
  displayedOutdoorHumidity: 43,
  vacationHold: { enabled: false },
  currentSchedulePeriod: { day: 'Wednesday', period: 'P1' },
  scheduleCapabilities: {
    availableScheduleTypes: [ 'None', 'Geofenced', 'TimedEmea' ],
    schedulableFan: false
  },
  scheduleType: { scheduleType: 'Timed', scheduleSubType: 'EMEA' },
  scheduleStatus: 'Resume',
  allowedTimeIncrements: 10,
  settings: {
    hardwareSettings: { brightness: 2, maxBrightness: 5 },
    temperatureMode: { air: true },
    specialMode: {},
    devicePairingEnabled: true
  },
  deviceClass: 'Thermostat',
  deviceType: 'Thermostat',
  deviceID: 'LCC-00D02DC1A545',
  userDefinedDeviceName: 'Thermostat',
  name: 'Thermostat',
  isAlive: true,
  isUpgrading: false,
  isProvisioned: true,
  macID: '00D02DC1A545',
  deviceSettings: {},
  service: { mode: 'Up' },
  deviceRegistrationDate: '2018-01-08T20:04:07.3733333',
  dataSyncStatus: 'Initiated',
  units: 'Celsius',
  indoorTemperature: 23,
  outdoorTemperature: 19.5,
  allowedModes: [ 'Heat', 'Off' ],
  deadband: 0,
  hasDualSetpointStatus: false,
  minHeatSetpoint: 5,
  maxHeatSetpoint: 35,
  minCoolSetpoint: -18,
  maxCoolSetpoint: -18,
  changeableValues: {
    mode: 'Heat',
    heatSetpoint: 23,
    coolSetpoint: 10,
    thermostatSetpointStatus: 'HoldUntil',
    holdUntil: '22:30:00',
    nextPeriodTime: '22:30:00',
    endHeatSetpoint: 23,
    endCoolSetpoint: 10,
    heatCoolMode: 'Heat'
  },
  operationStatus: {
    mode: 'EquipmentOff',
    fanRequest: false,
    circulationFanRequest: false
  },
  deviceModel: 'T5-T6'
}
[9/2/2020, 3:30:12 PM] [HoneywellHome] LCC-00D02DC1A545
[9/2/2020, 3:30:12 PM] [HoneywellHome] Failed to refresh access token. device.groups is not iterable
donavanbecker commented 4 years ago

Okay, I totally re-did the device discovery, can you test the latest beta? v7.2.1-beta.0

sdamasoc commented 4 years ago

I've tried latest beta and hit a new issue now:

[9/5/2020, 9:50:56 AM] Homebridge is running on port 51326.
[9/5/2020, 9:50:57 AM] [HoneywellHome] Got access token: XXXXXXXXXXXXXXXXXXXXXXXXXX
[9/5/2020, 9:50:57 AM] [HoneywellHome] New refresh token: XXXXXXXXXXXXXXXXXXXXXX
[9/5/2020, 9:50:57 AM] [HoneywellHome] Homebridge config.json has been updated with new refresh token.
[9/5/2020, 9:50:58 AM] [HoneywellHome] Total Locations Found: 1.
[9/5/2020, 9:50:58 AM] [HoneywellHome] Getting devices for Mon domicile...
[9/5/2020, 9:50:58 AM] [HoneywellHome] Total Devices Found at Mon domicile: 1.
[9/5/2020, 9:50:58 AM] [HoneywellHome] Device ID: LCC-00D02DC1A545
[9/5/2020, 9:50:58 AM] [HoneywellHome] Device Type: Thermostat
[9/5/2020, 9:50:58 AM] [HoneywellHome] Device Class: Thermostat
[9/5/2020, 9:50:58 AM] [HoneywellHome] Device Model: T5-T6
[9/5/2020, 9:50:58 AM] [HoneywellHome] Device Priority Type: undefined
(node:4092) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'allowedModes' of undefined
    at HoneywellHomePlatform.deviceinfo (/usr/lib/node_modules/homebridge-honeywell-home/src/platform.ts:549:27)
    at HoneywellHomePlatform.T5 (/usr/lib/node_modules/homebridge-honeywell-home/src/platform.ts:345:10)
    at /usr/lib/node_modules/homebridge-honeywell-home/src/platform.ts:275:20
    at Array.forEach (<anonymous>)
    at /usr/lib/node_modules/homebridge-honeywell-home/src/platform.ts:265:24
    at Array.forEach (<anonymous>)
    at HoneywellHomePlatform.discoverDevices (/usr/lib/node_modules/homebridge-honeywell-home/src/platform.ts:260:15)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at HomebridgeAPI.<anonymous> (/usr/lib/node_modules/homebridge-honeywell-home/src/platform.ts:69:9)
(node:4092) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4092) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
donavanbecker commented 4 years ago

@sdamasoc, I just pushed out a new beta. can you test it?

To Install:

sudo npm install -g --unsafe-perm homebridge-honeywell-home@beta

To Revert:

sudo npm install -g --unsafe-perm homebridge-honeywell-home@latest
sdamasoc commented 4 years ago

Ok it's better now: [9/5/2020, 7:11:19 PM] [HoneywellHome] Got access token: XXXXXXXXXXXXXXXXXXXXXXXXXX [9/5/2020, 7:11:19 PM] [HoneywellHome] New refresh token: XXXXXXXXXXXXXXXXXXXXXXXXXX [9/5/2020, 7:11:19 PM] [HoneywellHome] Homebridge config.json has been updated with new refresh token. [9/5/2020, 7:11:19 PM] [HoneywellHome] Total Locations Found: 1 [9/5/2020, 7:11:19 PM] [HoneywellHome] Getting devices for Mon domicile... [9/5/2020, 7:11:19 PM] [HoneywellHome] Total Devices Found at Mon domicile: 1 [9/5/2020, 7:11:19 PM] [HoneywellHome] T5 UDID: ThermostatLCC-00D02DC1A545T5-T6 [9/5/2020, 7:11:19 PM] [HoneywellHome] Adding new accessory: Thermostat T5-T6 Thermostat [9/5/2020, 7:11:19 PM] [HoneywellHome] Registering new device: Thermostat T5-T6 Thermostat - LCC-00D02DC1A545 [9/5/2020, 7:11:20 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":22,"coolSetpoint":10,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/5/2020, 7:11:20 PM] [HoneywellHome] "Heat"

But there is another problem the targetting heat temperature shown in homebridge ui is -18 (pictures attached) homebridge1 homebridge2

donavanbecker commented 4 years ago

@sdamasoc what does it look like in in homekit?

sdamasoc commented 4 years ago

DE88A3C0-6531-4AA2-B2FC-2FD945614F77 It shows -18 as in homebridge

donavanbecker commented 4 years ago

@sdamasoc okay, let me look more. Does it all seem to work besides this?

sdamasoc commented 4 years ago

I can see the actual room temperature but can’t change the target heat temperature

donavanbecker commented 4 years ago

@sdamasoc, I release a new beta can you give it a try and let me know.

To Install:

sudo npm install -g --unsafe-perm homebridge-honeywell-home@beta

To Revert:

sudo npm install -g --unsafe-perm homebridge-honeywell-home@latest
sdamasoc commented 4 years ago

Thanks a lot but nothing changed: [9/6/2020, 9:42:25 PM] [HoneywellHome] Initializing HoneywellHome platform... [9/6/2020, 9:42:25 PM] [HoneywellHome] Finished initializing platform: HoneywellHome [9/6/2020, 9:42:25 PM] [HoneywellHome] Config OK [9/6/2020, 9:42:25 PM] Loading 1 accessories... [9/6/2020, 9:42:25 PM] [HoneywellHome] Loading accessory from cache: Thermostat Thermostat [9/6/2020, 9:42:25 PM] [HoneywellHome] Loading accessory from cache: Thermostat Thermostat [9/6/2020, 9:42:25 PM] [HoneywellHome] Executed didFinishLaunching callback [9/6/2020, 9:42:25 PM] Homebridge is running on port 51326. [9/6/2020, 9:42:25 PM] [HoneywellHome] Got access token: XXXXXXXXXXXXXXXXXXXXXXXXXXX [9/6/2020, 9:42:25 PM] [HoneywellHome] New refresh token: XXXXXXXXXXXXXXXXXXXXXXXXX [9/6/2020, 9:42:25 PM] [HoneywellHome] Homebridge config.json has been updated with new refresh token. [9/6/2020, 9:42:26 PM] [HoneywellHome] Total Locations Found: 1 [9/6/2020, 9:42:26 PM] [HoneywellHome] Getting devices for Mon domicile... [9/6/2020, 9:42:26 PM] [HoneywellHome] Total Devices Found at Mon domicile: 1 [9/6/2020, 9:42:26 PM] [HoneywellHome] Adding new accessory: Thermostat T5-T6 Thermostat [9/6/2020, 9:42:26 PM] [HoneywellHome] Registering new device: Thermostat T5-T6 Thermostat - LCC-00D02DC1A545 [9/6/2020, 9:42:26 PM] [HoneywellHome] T5 UDID: Thermostat-LCC-00D02DC1A545-T5-T6 [9/6/2020, 9:42:26 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":20,"coolSetpoint":24,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/6/2020, 9:42:26 PM] [HoneywellHome] "Heat" [9/6/2020, 9:43:26 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":20,"coolSetpoint":24,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/6/2020, 9:43:26 PM] [HoneywellHome] "Heat" [9/6/2020, 9:44:26 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":20,"coolSetpoint":24,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/6/2020, 9:44:26 PM] [HoneywellHome] "Heat" [9/6/2020, 9:45:26 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":20,"coolSetpoint":24,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/6/2020, 9:45:26 PM] [HoneywellHome] "Heat" [9/6/2020, 9:46:28 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":24,"coolSetpoint":24,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/6/2020, 9:46:28 PM] [HoneywellHome] "Heat" [9/6/2020, 9:47:26 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":24,"coolSetpoint":24,"thermostatSetpointStatus":"HoldUntil","holdUntil":"23:30:00","nextPeriodTime":"23:30:00","endHeatSetpoint":23,"endCoolSetpoint":10,"heatCoolMode":"Heat"} [9/6/2020, 9:47:26 PM] [HoneywellHome] "Heat"

In the last line you can see I change the target temp from 20° to 24° but in homebridge ui or homekit temperature is still -18

donavanbecker commented 4 years ago

@sdamasoc Have you cleared the cache on your thermostat? I have changed a few things that may require you to do that. Could be causing this also.

sdamasoc commented 4 years ago

I cleared everything and also reinstall from scratch the plugin and it still show -18. When I set to AUTO mode in HomeKit app I can change the temperature but it seems that heat and cool are inverted.

I took a look at the code for the T5 and I think you can simplify some things:

I think with this you can simplify the code. Hope this can help.

donavanbecker commented 4 years ago

I cleared everything and also reinstall from scratch the plugin and it still show -18. When I set to AUTO mode in HomeKit app I can change the temperature but it seems that heat and cool are inverted.

I took a look at the code for the T5 and I think you can simplify some things:

  • The T5 has only ON /OFF modes, the is no cooling and no AUTO mode on this device

  • There is no fan control with the T5

I think with this you can simplify the code.

Hope this can help.

Are you sure all T5's have no fan? I thought I have seen that?

sdamasoc commented 4 years ago

Indeed, you are right. My T5 is connected to a heat system and so it only heat because I have no fan or no cooling system.

donavanbecker commented 4 years ago

I will keep on working on this, trying to fine tune some other things for v8.0.0.

sdamasoc commented 4 years ago

Hello,

I think I found the issue. I've called the API of my thermostat directly from honeywell web site (https://developer.honeywellhome.com) and found that only the follow values are set to -18: "minCoolSetpoint": -18, "maxCoolSetpoint": -18,

On line 103 of T5.js I see: // Set Min and Max this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature) .setProps({ minValue: this.toCelsius(device.minCoolSetpoint), maxValue: this.toCelsius(device.maxCoolSetpoint), minStep: 0.5, });

I think that min and max should be set in function of the used mode. For me I have only HEAT mode on my thermostat and the code bellow should be: // Set Min and Max this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature) .setProps({ minValue: this.toCelsius(device.minHeatSetpoint), maxValue: this.toCelsius(device.maxHeatSetpoint), minStep: 0.5, }); When I change that code everything works fine.

Also if you can use the variable allowedModes from the API it will be better, for me it has only HEAT and Off modes: "allowedModes": [ "Heat", "Off" ], With this it will better match what I see when I add directly my T5 on HomeKit without passing through homebridge.

donavanbecker commented 4 years ago

With this it will better match what I see when I add directly my T5 on HomeKit without passing through homebridge.

Good find!

I will try to implement this as others probably have the same. If you would like to submit a pull request that would also be helpful.

Direct pull request to beta branch.

sdamasoc commented 4 years ago

Cannot push changes:

git.exe push "origin" beta:beta
remote: Permission to donavanbecker/homebridge-honeywell-home.git denied to sdamasoc.
fatal: unable to access 'https://github.com/donavanbecker/homebridge-honeywell-home.git/': The requested URL returned error: 403

Here's the udiff:

--- a/src/Thermostats/T5.ts
+++ b/src/Thermostats/T5.ts
@@ -102,12 +102,25 @@ export class T5 {
     this.parseStatus();

     // Set Min and Max
-    this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature)
-      .setProps({
-        minValue: this.toCelsius(device.minCoolSetpoint),
-        maxValue: this.toCelsius(device.maxCoolSetpoint),
-        minStep: 0.5,
-      });
+    if (this.device.changeableValues.heatCoolMode === 'Heat') {
+            this.platform.log.debug(`Device is in "Heat" mode`);
+            this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature)
+                .setProps({
+                minValue: this.toCelsius(device.minHeatSetpoint),
+                maxValue: this.toCelsius(device.maxHeatSetpoint),
+                minStep: 0.5,
+            });
+    }
+    else {
+            this.platform.log.debug(`Device is in "Cool" mode`);
+            this.service.getCharacteristic(this.platform.Characteristic.TargetTemperature)
+                .setProps({
+                minValue: this.toCelsius(device.minCoolSetpoint),
+                maxValue: this.toCelsius(device.maxCoolSetpoint),
+                minStep: 0.5,
+            });
+    }
+
donavanbecker commented 4 years ago

Cannot push changes:

I have pushed the changes, let me know if this fixes what you are experiencing.

v7.2.2-beta.0

sdamasoc commented 4 years ago

That works now, I can change de temperature and changes are made on the device., thanks! There's only one point I already mentioned that I can set the device in COOL mode or AUTO mode but it's not supported on my device. I'm still looking how you can use the "allowedModes" variable to configure the device in homebridge.

donavanbecker commented 4 years ago

@sdamasoc, so with the latest beta, I pushed a potential fix for this. can you test it for me? My device supports ['Off','Heat','Cool','Auto'] so I can't test this. v7.2.2-beta.3

sdamasoc commented 4 years ago

I've just tested the last beta but nothing has changed in the behaviour, I still have Off, Heat, Cool and Auto modes...

sdamasoc commented 4 years ago

I've added some debug loggings and I never come in the if-else you add:

        if (this.device.allowedModes === ['Off', 'Heat', 'Cool', 'Auto']) {
            this.platform.log.debug("'Off', 'Heat', 'Cool', 'Auto'");
            this.service.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
                .on('set', this.setHeatingThresholdTemperature.bind(this));
        }
        else if (this.device.allowedModes === ['Off', 'Heat']) {
            this.platform.log.debug("'Off', 'Heat'");
            this.service.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
                .on('set', this.setHeatingThresholdTemperature.bind(this));
        }

I'm not an expert in typescript/javascript but can you compare an array with === ? If so, order doesn't matter? In my case :

"allowedModes": [
  "Heat",
  "Off"
],

First Heat and then Off...

But even when I remove all if-else conditions and just let the command:

this.service.getCharacteristic(this.platform.Characteristic.HeatingThresholdTemperature)
                .on('set', this.setHeatingThresholdTemperature.bind(this));

I still have the 4 modes in homebridge and homekit.

I'm trying to find where this 4 modes are added but don't find it...

donavanbecker commented 4 years ago

I think I have an idea of where it is at. just have to test. Thanks for the info though. I will revert this.

donavanbecker commented 4 years ago

@sdamasoc okay can you give the new beta a try and report back? v7.2.2-beta.6

sdamasoc commented 4 years ago

just tried it now but it is still the same.

[9/11/2020, 8:07:07 PM] [HoneywellHome] Adding new accessory: Thermostat T5-T6 Thermostat
[9/11/2020, 8:07:07 PM] [HoneywellHome] Registering new device: Thermostat T5-T6 Thermostat - LCC-00D02DC1A545
[9/11/2020, 8:07:07 PM] [HoneywellHome] Device is in "Heat" mode
[9/11/2020, 8:07:07 PM] [HoneywellHome] T5 UDID: Thermostat-LCC-00D02DC1A545-T5-T6
[9/11/2020, 8:07:08 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":23,"coolSetpoint":10,"thermostatSetpointStatus":"NoHold","nextPeriodTime":"22:30:00","heatCoolMode":"Heat","endHeatSetpoint":null,"endCoolSetpoint":null}
[9/11/2020, 8:07:08 PM] [HoneywellHome] {"displayedOutdoorHumidity":49,"vacationHold":{"enabled":false},"currentSchedulePeriod":{"day":"Friday","period":"P1"},"scheduleCapabilities":{"availableScheduleTypes":["None","Geofenced","TimedEmea"],"schedulableFan":false},"scheduleType":{"scheduleType":"Timed","scheduleSubType":"EMEA"},"scheduleStatus":"Resume","allowedTimeIncrements":10,"settings":{"hardwareSettings":{"brightness":2,"maxBrightness":5},"temperatureMode":{"air":true},"specialMode":{},"devicePairingEnabled":true},"deviceClass":"Thermostat","deviceType":"Thermostat","deviceID":"LCC-00D02DC1A545","userDefinedDeviceName":"Thermostat","name":"Thermostat","isAlive":true,"isUpgrading":false,"isProvisioned":true,"macID":"00D02DC1A545","deviceSettings":{},"service":{"mode":"Up"},"deviceRegistrationDate":"2018-01-08T20:04:07.3733333","dataSyncStatus":"Initiated","units":"Celsius","indoorTemperature":24.5,"outdoorTemperature":21.5,"allowedModes":["Heat","Off"],"deadband":0,"hasDualSetpointStatus":false,"minHeatSetpoint":5,"maxHeatSetpoint":35,"minCoolSetpoint":-18,"maxCoolSetpoint":-18,"changeableValues":{"mode":"Heat","heatSetpoint":23,"coolSetpoint":10,"thermostatSetpointStatus":"NoHold","nextPeriodTime":"22:30:00","heatCoolMode":"Heat","endHeatSetpoint":null,"endCoolSetpoint":null},"operationStatus":{"mode":"EquipmentOff","fanRequest":false,"circulationFanRequest":false},"deviceModel":"T5-T6"}
[9/11/2020, 8:07:32 PM] [Config] [admin] Accessory layout changes saved.
[9/11/2020, 8:07:53 PM] [HoneywellHome] Set TargetHeatingCoolingState: 1
[9/11/2020, 8:07:53 PM] [HoneywellHome] Set TargetTemperature:': 23
[9/11/2020, 8:07:53 PM] [HoneywellHome] Set HeatingThresholdTemperature: 23
[9/11/2020, 8:07:53 PM] [HoneywellHome] Set CoolingThresholdTemperature: 10
[9/11/2020, 8:07:53 PM] [HoneywellHome] Sending request to Honeywell API. mode: Heat, coolSetpoint: 10, heatSetpoint: 23
[9/11/2020, 8:07:53 PM] [HoneywellHome] {"mode":"Heat","thermostatSetpointStatus":"TemporaryHold","heatSetpoint":23,"coolSetpoint":10}
[9/11/2020, 8:07:55 PM] [HoneywellHome] Fetched update for Thermostat from Honeywell API: {"mode":"Heat","heatSetpoint":23,"coolSetpoint":10,"thermostatSetpointStatus":"TemporaryHold","nextPeriodTime":"22:30:00","heatCoolMode":"Heat","endHeatSetpoint":null,"endCoolSetpoint":null}
[9/11/2020, 8:07:55 PM] [HoneywellHome] {"displayedOutdoorHumidity":49,"vacationHold":{"enabled":false},"currentSchedulePeriod":{"day":"Friday","period":"P1"},"scheduleCapabilities":{"availableScheduleTypes":["None","Geofenced","TimedEmea"],"schedulableFan":false},"scheduleType":{"scheduleType":"Timed","scheduleSubType":"EMEA"},"scheduleStatus":"Resume","allowedTimeIncrements":10,"settings":{"hardwareSettings":{"brightness":2,"maxBrightness":5},"temperatureMode":{"air":true},"specialMode":{},"devicePairingEnabled":true},"deviceClass":"Thermostat","deviceType":"Thermostat","deviceID":"LCC-00D02DC1A545","userDefinedDeviceName":"Thermostat","name":"Thermostat","isAlive":true,"isUpgrading":false,"isProvisioned":true,"macID":"00D02DC1A545","deviceSettings":{},"service":{"mode":"Up"},"deviceRegistrationDate":"2018-01-08T20:04:07.3733333","dataSyncStatus":"Initiated","units":"Celsius","indoorTemperature":24.5,"outdoorTemperature":21.5,"allowedModes":["Heat","Off"],"deadband":0,"hasDualSetpointStatus":false,"minHeatSetpoint":5,"maxHeatSetpoint":35,"minCoolSetpoint":-18,"maxCoolSetpoint":-18,"changeableValues":{"mode":"Heat","heatSetpoint":23,"coolSetpoint":10,"thermostatSetpointStatus":"TemporaryHold","nextPeriodTime":"22:30:00","heatCoolMode":"Heat","endHeatSetpoint":null,"endCoolSetpoint":null},"operationStatus":{"mode":"EquipmentOff","fanRequest":false,"circulationFanRequest":false},"deviceModel":"T5-T6"}

I read a bit of homebridge documentation and I think that you use the Thermostat generic type from homebridge and then you have automatically the 4 modes.

donavanbecker commented 4 years ago

@sdamasoc, beta v7.2.2-beta.11 should definitely work for you. Please report back. You should only see Heat and Off.

sdamasoc commented 4 years ago

I think you are almost there. In homekit I have a switch now but with modes: Heat, Auto instead of Heat,Off... And in homebridge I still see the 4 modes.

Also when I change the mode in homekit it runs in an infinite loop Heat to Auto and Auto to Heat...

sdamasoc commented 4 years ago

I think the follow code:

    if (this.device.allowedModes.includes('Heat')) {
      TargetState.push(1);
    }
    if (this.device.allowedModes.includes('Off')) {
      TargetState.push(3);
    }

For my case, Off should be 0 and Heat should be 1...

sdamasoc commented 4 years ago

I confirm the follow code works for me:

    TargetState() {
        this.platform.log.debug(this.device.allowedModes);
        const TargetState = [4];
        TargetState.pop();
        if (this.device.allowedModes.includes('Cool')) {
            TargetState.push(2);
        }
        if (this.device.allowedModes.includes('Heat')) {
            TargetState.push(1);
        }
        if (this.device.allowedModes.includes('Off')) {
            TargetState.push(0);
        }
        if (this.device.allowedModes.includes('Auto')) {
            TargetState.push(3);
        }
        this.platform.log.debug(JSON.stringify(TargetState));
        return TargetState;
    }
donavanbecker commented 4 years ago

Wow for some reason I must of got it mixed up. push a new beta v7.2.2-beta.12 and just used:

  private TargetState() {
    this.platform.log.debug(this.device.allowedModes);

    const TargetState = [4];
    TargetState.pop();
    if (this.device.allowedModes.includes('Cool')) {
      TargetState.push(this.platform.Characteristic.TargetHeatingCoolingState.COOL);
    }
    if (this.device.allowedModes.includes('Heat')) {
      TargetState.push(this.platform.Characteristic.TargetHeatingCoolingState.HEAT);
    }
    if (this.device.allowedModes.includes('Off')) {
      TargetState.push(this.platform.Characteristic.TargetHeatingCoolingState.OFF);
    }
    if (this.device.allowedModes.includes('Auto')) {
      TargetState.push(this.platform.Characteristic.TargetHeatingCoolingState.AUTO);
    }
    this.platform.log.debug('Only Show These Modes:', JSON.stringify(TargetState));
    return TargetState;
  }
sdamasoc commented 4 years ago

It's working now in Homekit! 👍

But in homebridge UI it is still showing the 4 modes I don't know if this is normal or not.

donavanbecker commented 4 years ago

@sdamasoc, yeah I think that is the default. You could always submit a feature request over there.

donavanbecker commented 4 years ago

@sdamasoc So I think we should be good right? good to close this issue?

sdamasoc commented 4 years ago

It’s good for me. Thanks for all