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 4 forks source link

[Beta] v3.3.0-beta Testing #45

Closed mitch7391 closed 2 years ago

mitch7391 commented 2 years ago

3.3.0-beta.2 (2022-02-18)

Special thanks to the amazing uswong and ztalbot2000 for adding these new features!

Notable Changes

Other Changes

Bug Fixes

uswong commented 2 years ago

but now about 20m later I got a notification on my phone saying "Garage Door Opened", even though it wasn't. Now when I check on Home App it says Garage Door is open whilst its closed..

Okay, a bit strange! Let me have a closer look at the script and will get back to you.

kaim2000 commented 2 years ago

Unfortunately I don't think so. You will need to have a second homebridge running on a different machine.

Okay no problem, thought this might be the case.

kaim2000 commented 2 years ago

Okay, a bit strange! Let me have a closer look at the script and will get back to you.

Great, thanks so much

uswong commented 2 years ago

Hi @kaim2000, my advice right now is not to use the flip for now until we get back to you. Let me have a closer look tomorrow. It is late night here in Australia.

uswong commented 2 years ago

Fixed the bug and will get @mitch7391 to push another beta version later today.

mitch7391 commented 2 years ago

We have 2 advantage air setups in our house! One runs on the tablet I've been configuring, and another runs on a separate tablet (the other system just controls 2 additional AC's).

@kaim2000 sorry for the late reply, my commitments this weekend ran later than expected and I have not been able to check in here at all. We could see in your getSystemData that you have two aircons, but these should both be controllable from the one tablet. You have another tablet with another aircon (a third or more?)? If you have another tablet, then I imagine you have another IP address associated with this system and we could create a second IP key and a second queue (let’s say B); unless I am missing something silly I think it could be set up alongside your current working one. I would need more info on what’s going on.

Ung Sing has put together a fix for the flip bug, looking over the PR for it was due to a little typo and I just have not noticed in my approval of it. I am off to bed soon but will publish this fix tomorrow and that should have you sorted. Again, thanks @uswong for tacking this one for me!

ztalbot2000 commented 2 years ago

Hi,

Well that goes to show that while we can change the meaning on the Cmd4 side. IOS still thinks otherwise. Not anything I can do, even changing the code as redifining the table does exactly that.

Ttyl, John

On Sat, Feb 26, 2022 at 9:19 AM kaim2000 @.***> wrote:

Possible issue with the garage door flip -- it worked fine at first, saying that the door was closed when it was, but now about 20m later I got a notification on my phone saying "Garage Door Opened", even though it wasn't. Now when I check on Home App it says Garage Door is open whilst its closed..

— Reply to this email directly, view it on GitHub https://github.com/mitch7391/homebridge-cmd4-AdvantageAir/issues/45#issuecomment-1052139891, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX33SQR2LDGJGWHMCHDU5DOORANCNFSM5OWXMEFQ . You are receiving this because you commented.Message ID: @.***>

mitch7391 commented 2 years ago

@kaim2000 I have just published v3.3.0-beta.6 which contains the bug fix for the flip typo; this should work as intended now and solve your issue. Sorry for the hold up on my end for the publishing!

kaim2000 commented 2 years ago

@mitch7391 @uswong the flip fix works perfectly. The set up has been running really well since! Only issue is that I'm currently running via a MacBook Pro with caffeinate to keep it on but every now and then it restarts for no apparent reason 😊. Hopefully I'm able to get a raspberry pi soon (all out of stock in SA) and then I'll have the perfect set up thanks to you!

kaim2000 commented 2 years ago

You have another tablet with another aircon (a third or more?)? If you have another tablet, then I imagine you have another IP address associated with this system and we could create a second IP key and a second queue (let’s say B); unless I am missing something silly I think it could be set up alongside your current working one. I would need more info on what’s going on.

Yup! There is a separate tablet which only controls two AC units (each with a single zone) on the top floor of the house. I don't know why AdvAir thought it was necessary, since all the lights in the entire house + the two downstairs AC units run on one tablet and I'm sure they could've just added the other two AC units to the main tablet. Regardless, I actually tried adding a 2nd queue and IP before you suggested it but HomeBridge said I couldn't have two cmd4 platforms - I presume this isn't something on your side but rather with HomeBridge itself. I configured it something like this: (excuse me if there are issues with commas or brackets/aligment, just threw this together quickly as I don't have the previous version of config file, but I know that that was all fine with regards to brackets and alignment, home bridge just threw an error about having two CMD4's)

{
    "bridge": {
        "name": "Homebridge",
        "username": "0E:B3:EA:DB:32:C2",
        "port": 51124,
        "pin": "662-37-163"
    },
    "platforms": [
        {
            "platform": "Cmd4",
            "name": "Cmd4",
            "outputConstants": false,
            "statusMsg": true,
            "timeout": 100000,
            "stateChangeResponseTime": 0,
            "constants": [
                {
                    "key": "${IP}",
                    "value": "192.168.1.34"
                }
            ],
            "queueTypes": [
                {
                    "queue": "A",
                    "queueType": "WoRm2"
                }
            ],
            "accessories": [
                {
                ...
                }
            ]
        {
            "platform: "Cmd4"
            "name": "Cmd4",
            "outputConstants": false,
            "statusMsg": true,
            "timeout": 100000,
            "stateChangeResponseTime": 0,
            "constants": [
                {
                    "key": "${IP}",
                    "value": "192.168.1.28"

                }
            ],
            "queueTypes": [
                {
                    "queue": "B",
                    "queueType": "WoRm2"
                }
            ],
            "accessories": [
                {
                ...
                }
            ]
        }
    }
}

Anyway, unless there's something stupid I did and you have an easy fix for me its really not much of an issue, I can live with having those two AC's on the MyPlace app only.

EDIT: No idea why code is formatting like that on this page, added Screenshot to be more readable

image
mitch7391 commented 2 years ago

I don't know why AdvAir thought it was necessary, since all the lights in the entire house + the two downstairs AC units run on one tablet and I'm sure they could've just added the other two AC units to the main tablet.

Sounds crazy and I agree, sounds like they could have done it all on one tablet; must be some reason they did not. Your house must be massive by the sounds! Haha...

I actually tried adding a 2nd queue and IP before you suggested it but HomeBridge said I couldn't have two cmd4 platforms - I presume this isn't something on your side but rather with HomeBridge itself.

What you did was a good attempt with little guidance from me, but you do not need to add a second cmd4 platform area; that is what Homebridge is not happy about. You just add them like new accessories in the cmd4 area like you were before, but you give them the second IP address and queue. It would look something more like this:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    "platforms": [
        {
            "platform": "Cmd4",
            "name": "Cmd4",
            "outputConstants": false,
            "statusMsg": true,
            "timeout": 60000,
            "stateChangeResponseTime": 0,
            "constants": [
                {
                    "key": "${IP}",
                    "value": "192.168.1.34"
                },
                {
                    "key": "${IP2}",
                    "value": "192.168.1.28"
                },
            ],
            "queueTypes": [
                {
                    "queue": "A",
                    "queueType": "WoRm"
                },
                {
                    "queue": "B",
                    "queueType": "WoRm"
                }
            ],
            "accessories": [
                {
                    "type": "Thermostat",
                    "displayName": "Aircon",
                    "currentHeatingCoolingState": "OFF",
                    "targetHeatingCoolingState": "OFF",
                    "currentTemperature": 25,
                    "targetTemperature": 25,
                    "temperatureDisplayUnits": "CELSIUS",
                    "name": "Aircon",
                    "manufacturer": "Advantage Air Australia",
                    "model": "e-zone",
                    "serialNumber": "Fujitsu e-zone2",
                    "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": "${IP}",
                    "linkedTypes": [
                        {
                            "type": "Fan",
                            "displayName": "Fan Speed",
                            "on": "TRUE",
                            "rotationSpeed": 100,
                            "name": "Fan Speed",
                            "manufacturer": "Advantage Air Australia",
                            "model": "e-zone",
                            "serialNumber": "Fujitsu e-zone2",
                            "queue": "A",
                            "polling": [
                                {
                                    "characteristic": "on"
                                },
                                {
                                    "characteristic": "rotationSpeed"
                                }
                            ],
                            "state_cmd": "'/usr/local/lib/node_modules/homebridge-cmd4-advantageair/AdvAir.sh'",
                            "state_cmd_suffix": "${IP} fanSpeed"
                        }
                    ]
                },
                {
                    "type": "Thermostat",
                    "displayName": "Aircon 2",
                    "currentHeatingCoolingState": "OFF",
                    "targetHeatingCoolingState": "OFF",
                    "currentTemperature": 25,
                    "targetTemperature": 25,
                    "temperatureDisplayUnits": "CELSIUS",
                    "name": "Aircon",
                    "manufacturer": "Advantage Air Australia",
                    "model": "e-zone",
                    "serialNumber": "Fujitsu e-zone2",
                    "queue": "B",
                    "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}",
                    "linkedTypes": [
                        {
                            "type": "Fan",
                            "displayName": "Fan Speed 2",
                            "on": "TRUE",
                            "rotationSpeed": 100,
                            "name": "Fan Speed",
                            "manufacturer": "Advantage Air Australia",
                            "model": "e-zone",
                            "serialNumber": "Fujitsu e-zone2",
                            "queue": "B",
                            "polling": [
                                {
                                    "characteristic": "on"
                                },
                                {
                                    "characteristic": "rotationSpeed"
                                }
                            ],
                            "state_cmd": "'/usr/local/lib/node_modules/homebridge-cmd4-advantageair/AdvAir.sh'",
                            "state_cmd_suffix": "${IP2} fanSpeed"
                        }
                    ]
                }                
            ]
        }
    ]
}

Notice how I have added two IP addresses constants and two queues in the one instance of cmd4? I have only added two Thermostats to demonstrate the use of the two IP addresses and queues; but you would add them in with the rest as you have prior making sure to reference the correct IP address and queue. Also make sure not to double up on displayName across accessories!

EDIT: No idea why code is formatting like that on this page, added Screenshot to be more readable

To format the configs as I have been doing for you (I have been editing your comments to format the code) you need to add the code between the following:

image

You can change the the json to shell if you are pasting logs from your terminal too; I am sure there are also other types for other formats.

mitch7391 commented 2 years ago

Oh one point I will make is I have not tested adding a second IP address constant before and I only assume it should work that way haha we will find out if it does not like being called ${IP2}, but I think it should be fine. Let's see how you go :)

uswong commented 2 years ago

Oh one point I will make is I have not tested adding a second IP address constant before and I only assume it should work that way haha we will find out if it does not like being called ${IP2}, but I think it should be fine.

That is a really good idea and I expect $IP2 is absolutely fine but I think it is going to work for only one tablet at a time and not both at the same time. The one working is the one getting the getSystemData at the beginning of the myAirData.txt cache cycle.

To get it working for both tablets at all time, the AdvAir.sh needs to be modified to cater for 2 IP addresses. I think it is not too hard to build that in but as we do not have a system to test, it will take a few cycles of testing with @kaim200 to get it working properly.

mitch7391 commented 2 years ago

The one working is the one getting the getSystemData at the beginning of the myAirData.txt cache cycle.

I didn’t think of this aspect of it Ung Sing, I was thinking about the the cmd4 side of things and treating it as a separate device entirely, but it does still need to be handled by the script that is already handling another AC!

I think it is not too hard to build that in but as we do not have a system to test, it will take a few cycles of testing with @kaim200 to get it working properly.

Considering Kai doesn’t sound too bothered about this feature, I might suggest we hold it off for the time being and look at it is a future feature to be tested with Kai if they so choose to be a tester. We have packed so much into this release as it is haha…

uswong commented 2 years ago

We have packed so much into this release as it is haha…

Yes, fully agreed.

mitch7391 commented 2 years ago

Hey everyone, after some much deserved time away from this project; I have finally put together what hopefully will be the last beta bump for this feature. It includes a bug fix for setting 'auto' in HomeKit for your Thermostat (not supported by Advantage Air) and also the Configuration Check Tool will no longer throw an error for the MyPlace lights and garage door/gate; it should also check that your config for those is correct.

Latest version is v3.3.0-beta.7. @kaim2000 could you try the Configuration Check Tool please for me? For your system it should just come up as passed, but please let me know if it does not. @uswong could you please check it with JohnW when you get a chance or you can mock it up by adding the accessories in your config, clicking save but not rebooting Homebridge (that is all that is required for the tool to pick it up and won't break you system).

The wiki had been updated to much all the work here and if no issues are faced, then we will push this to the stable version soon enough :)

uswong commented 2 years ago

Hey Mitch, 

I have installed the latest beta and tested the configuration check tool on both mine and JohnW.   

No error on the lights and things 😊. 

However, it complains about the WoRm and state_cmd_suffix has no zone for: “Fan” accessory. I am using WoRm2 and I think we should all use it.  I found WoRm2 is slightly better than WoRm because Worm2 uses the cache data within Cmd4 rather than waiting for the info to be retrieved from the aircon system.  As such, the state is correctly reflected on homekit immediately. I think we should allow both WoRm and WoRm2 to pass.

Zone is actually not required in “stat_cmd_suffix” in “Fan” accessory and in fact we should NOT allow to have any zone defined for “Fan” accessory because if we do, the “Fan” will NOT turn on or off but the zone specified will open or close. This is because if there is a zone specified, the “zoneSpecified” will be set to “true” and “fanSpecified” will be set to “false”, as such, nothing will happen to the “Fan” accessory but since “zoneSpecified” is “true” and through the “On” characteristic, a specified zone will be opened or closed. 

Apart from that everything seems to work fine. 

Cheers,Ung Sing

mitch7391 commented 2 years ago

Hey @uswong, I actually forgot about WoRm2 and in the chaos of all the changes for this feature I realised I still have not been using it lol that can be easy enough to add.

I have no zones in any of my fans and do not have this issue; it is not the fan that you have as a switch (no one else has this in there setup at present)? If it is a switch accessory, it will flag for not having a zone haha...

Also your email reply did something really crazy with your reply, I have edited it to fix it :p

uswong commented 2 years ago

If it is a switch accessory, it will flag for not having a zone haha...

Ohh... I see. No worries then, it is only me and JohnW uses a "Switch" as a proxy to the "Fan" accessory .

Also your email reply did something really crazy

Oops! What happen?? May be because I used email to reply instead of using GitHub which has the advantage of a Preview. In any case, sorry about that.

mitch7391 commented 2 years ago

@uswong no stress, I will add it in as I will need to add to WoRm2 to it now anyway! :) will shoot you a message when the next one is ready to try!

mitch7391 commented 2 years ago

@uswong what is the displayName you and JohnW use for your fan switch? I will use this as the trigger for the logic for you two; otherwise it might get complicated.

uswong commented 2 years ago

We have used Aircon Fan as the name and displayName.

The config.json is as follow:

            {
                "type": "Switch",
                "displayName": "Aircon Fan",
                "on": "FALSE",
                "name": "Aircon Fan",
                "manufacturer": "Advantage Air Australia",
                "model": "e-zone",
                "serialNumber": "Daikin e-zone",
                "queue": "A",
                "polling": [
                    {
                        "characteristic": "on"
                    }
                ],
                "state_cmd": "'/usr/local/lib/node_modules/homebridge-cmd4-advantageair/AdvAir.sh'",
                "state_cmd_suffix": "${IP}",
                "linkedTypes": [
                    {
                        "type": "Fan",
                        "displayName": "Fan Speed",
                        "on": "TRUE",
                        "rotationSpeed": 100,
                        "name": "Fan Speed",
                        "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": "${IP} fanSpeed"
                    }
                ]
            },
mitch7391 commented 2 years ago

Thanks Ung Sing :) very helpful! I will have something for you and Kai tomorrow.

kaim2000 commented 2 years ago

Hi @mitch7391, thank you again - everything has been working so insanely well. I installed beta 7 and yeah I had the same issue as @uswong with the configuration check tool and WoRm2. Let me know whenever I can do some more testing for you!

mitch7391 commented 2 years ago

@uswong and @kaim2000 new beta bump to v3.3.0-beta.8. The check tool will now accept "WoRm2" and advise the user to switch to it if they are not using it.

Ung Sing, the Fan Switch that you and JohnW use will now be accepted by check tool; but only if you keep the name/displayName Aircon Fan, otherwise it will flag again.

uswong commented 2 years ago

Yayyyy! Tested both on mine and JohnW's, the check tool now passed without any complain :)