bstillitano / homebridge-actron-neo

Homebridge plugin for Actron Neo Controller
Apache License 2.0
2 stars 1 forks source link

Only first zone detected? #1

Closed andrew-burgher closed 1 year ago

andrew-burgher commented 1 year ago

My system has multiple (n=7) zones. Appears that only the first zone has been detected and registered as an accessory.

Homebridge Version: 1.6.1 Plugin Version: 1.2.13

domalab commented 1 year ago

@bstillitano Same with my system.

I have 5 zone sensors and only 1 zone has been detected / registered.

I noticed it detected outdoor unit and registered as sensor.

Please let me know if I need to send you any log files.

bstillitano commented 1 year ago

Have dug into this and it appears that the original Que code this is forked from relies on Zone.sensorId. The problem here is that with the Neo systems, unless you have a wall controller for every zone, each zone has a sensorId value that pertains to the serial number of the Neo wall controller. This is problematic because the original plugin iterates over each value where the sensorId is presumed to be unique:

for (const zone of this.zoneData) {
      const targetInstance = this.zoneInstances.find(zoneInstance => zoneInstance.sensorId === zone.sensorId);
      if (targetInstance) {
        targetInstance.pushStatusUpdate(zone);
        this.log.warn('Skipping zone push for zone:', JSON.stringify(zone));
      } else {
        this.zoneInstances.push(new HvacZone(this.log, this.apiInterface, zone));
        this.log.warn('Pushing zone:', JSON.stringify(zone));
      }
    }
    return status;

This issue occurs in a few places throughout the code base. As such, I have made a change to this in release 0.0.14 which appears to fix the issue of only the first zone showing up, with the caveat that zone names must be unique. All my zones are now showing up in the "Home" app on iOS 17.0. There are a few duplicates in my Home app that I need to figure out where they are coming from but for now it appears that each zone is able to be monitored from HomeKit.

image

There is a secondary issue that has now popped up, which is that the APIs for the Que system aren't compatible with the Neo system for updating zone states. When toggling zone states we get:

Maximum retries exceeded -> Actron Neo API returned a server side error: http status code = 504
[9/14/2023, 12:27:44 AM] [ActronNeo] API Error when attempting command send:
 {"command":{"UserAirconSettings.EnabledZones[1]":true,"type":"set-settings"}}
[9/14/2023, 12:27:44 AM] [ActronNeo] API responded with:

The body of the request here is wrong. I need to spend some time tweaking the request in order to pass it in in the right format as below:

{
  "command": {
    "type": "set-settings",
    "UserAirconSettings.EnabledZones": [
      false,
      false,
      false,
      false,
      false,
      false,
      false,
      true
    ]
  }
}
bstillitano commented 1 year ago

Ok, version 0.0.16 fixes this. You can now set zones on/off. Duplicate zone issue was because I had some old bridges still configured in my Home app so after removing those it all worked properly. After cleaning out the old data and setting up the new bridge we're left with this image

bstillitano commented 1 year ago

Please note also @ruaandeysel @andrew-burgher you'll need to remove @bstillitano/homebridge-actron-neo and install homebridge-actron-neo to get the newer versions.

I know this is annoying but was a requirement as part of the Homebridge verification process.

domalab commented 1 year ago

Thank you very much for all the work you are putting into this plugin @bstillitano

domalab commented 1 year ago

@bstillitano not sure if this will be of any future help. Here's code repo for ActronAir Que/Neo Home assistant add-on

https://github.com/MikeJMcGuire/HASSAddons/tree/master/hass-actronque/hass-actronque