mitch7391 / homebridge-cmd4-AdvantageAir

Catered shell script to integrate air conditioner control units by Advantage Air into HomeKit using the plug-in homebridge-cmd4.
MIT License
38 stars 5 forks source link

[Pull Request] Additional Functionalities and Performance Enhancement #57

Closed uswong closed 2 years ago

uswong commented 2 years ago

name: Pull Request about: Resolve an issue and add improvements to homebridge-cmd4-AdvantageAir. title: "New Additional Functionalities and Performance Enhancement to v3.3.0" labels: pull-request assignees: mitch7391


Additional functionalities and performance enhancement to v3.3.0

Is your pull request related to a problem or a new feature? Please describe: This version added new features and improved performance for a big AirCon system.

Describe the solution you'd have implemented:

Do your changes pass local testing:

Additional context: All enhancements are under the hook improvements which require no change to the config file, hence no action required for all existing users.

However, for users who has a second AirCon control unit and would like to add it to the Homekit can do so by defining an extra IP key and associated accessories in the config file. An example sample config file for the 2nd control unit is shown below. Please note the additional constants key is defined as ${IP2} and be sure to use ${IP2} in state_cmd_suffix in all the accessories pertaining to that 2nd control unit.

 {
     "platform": "Cmd4",
     "name": "Cmd4",
     "debug": false,
     "outputConstants": false,
     "statusMsg": true,
     "timeout": 60000,
     "stateChangeResponseTime": 0,
     "constants": [
         {
            "key": "${IP}",
            "value": "192.168.0.31"
         },
         {
             "key": "${IP2}",
             "value": "192.168.0.173"
         }
     ],
     "queueTypes": [
         {
             "queue": "A",
             "queueType": "WoRm2"
         }
     ],
     "accessories": [
         {
             "type": "Thermostat",
             "displayName": "Aircon2",
             "currentHeatingCoolingState": "OFF",
             "targetHeatingCoolingState": "OFF",
             "currentTemperature": 24,
             "targetTemperature": 24,
             "temperatureDisplayUnits": "CELSIUS",
             "name": "Aircon2",
             "manufacturer": "Advantage Air Australia",
             "model": "e-zone",
             "serialNumber": "Daikin e-zone",
             "queue": "A",
             "polling": [
                 {
                     "characteristic": "currentHeatingCoolingState"
                 },
                 {
                     "characteristic": "targetHeatingCoolingState"
                 },
                 {
                     "characteristic": "currentTemperature"
                 },
                 {
                     "characteristic": "targetTemperature"
                 }
             ],
             "state_cmd": "'/usr/local/lib/node_modules/homebridge-cmd4-advantageair/AdvAir.sh'",
             "state_cmd_suffix": "${IP2} ac1",
             "linkedTypes": [
                 {
                     "type": "Fan",
                     "displayName": "Fan Speed2",
                     "on": "TRUE",
                     "rotationSpeed": 100,
                     "name": "Fan Speed2",
                     "manufacturer": "Advantage Air Australia",
                     "model": "e-zone",
                     "serialNumber": "Daikin e-zone",
                     "queue": "A",
                     "polling": [
                         {
                             "characteristic": "on"
                         },
                         {
                             "characteristic": "rotationSpeed"
                         }
                     ],
                     "state_cmd": "'/usr/local/lib/node_modules/homebridge-cmd4-advantageair/AdvAir.sh'",
                     "state_cmd_suffix": "${IP2} fanSpeed ac1"
                 }
             ]
         },
         {
                "type": "Fan",
                "displayName": "Fan2",
                "on": "FALSE",
                "brightness": 50,
                "name": "Fan2",
                "manufacturer": "Advantage Air Australia",
                "model": "e-zone",
                "serialNumber": "Daikin e-zone",
                "queue": "A",
                "polling": [
                    {
                        "characteristic": "on"
                    },
                    {
                        "characteristic": "brightness"
                    }
                ],
                "state_cmd": "'/usr/local/lib/node_modules/homebridge-cmd4-advantageair/AdvAir.sh'",
                "state_cmd_suffix": "${IP2} ac1"
             } 
          ]
      }
uswong commented 2 years ago

Good point Mitch!

I have been running both tablets on one queue (queue A) and they both work fine.

And I just tried to run the 2nd tablet on another queue (queue B) and works fine also.

I like it. I think it has advantages running them in separate queue. I can imagine that when running them in separate queue, one will not interfere with the other adversely especially if you are setting on one, the other can just carry on without needing to wait for the Set to complete.

As such, we should recommend users to use separate queue for the 2nd tablet.

mitch7391 commented 2 years ago

I can imagine that when running them in separate queue, one will not interfere with the other adversely especially if you are setting on one, the other can just carry on without needing to wait for the Set to complete.

Exactly what I was thinking and hoping; just had to double check :) I will merge this now!