NorthernMan54 / node-red-contrib-homebridge-automation

Homebridge and Node-RED Integration
Apache License 2.0
107 stars 18 forks source link

Unable to select device from list due to multiple devices having the same name #96

Closed Automayted closed 1 year ago

Automayted commented 2 years ago

I'm have four Harmony Hubs setup with homebridge-harmony and would like to trigger an automation when the PowerOff activity (which is published as a switch) from any of the hubs turns on. I can currently do this in HomeKit as an automation for each of the four hubs (when PowerOff turns ON, do x) but would like to move this automation to Node-RED.

The problem I'm facing is during setup of the hb-event node I see all four PowerOff switches in the dropdown list, but I'm effectively unable to choose anything but the first one in the list.

image

If I select the first PowerOff switch and deploy the flow, the first Harmony Hub accessory in my configuration reports its PowerOff state correctly when toggled.

image

However, if I try to choose the second, third, or forth PowerOff switch, the first one is automatically reselected (as noted by the checkmark) after the hb-event node setup is closed. I assume the fact that all accessories have the same name is causing this, so I manually renamed the PowerOff switches with a unique name in Homebridge, deployed my changes, and rebooted Node-RED. However, the same PowerOff names are reflected in the device dropdown list in the setup of the hb-event node.

Here's the device details as seen in Homebridge for one of the renamed PowerOff switches:

Screen Shot 2021-08-31 at 1 57 58 PM

Here is the output of my Harmony Hub devices at startup:

automayted@homebridge:~$ tail -f /var/lib/homebridge/homebridge.log | grep PowerOff

[8/31/2021, 1:30:08 PM] [Theater Harmony Hub] (Sunroom Harmony Hub)INFO - Discovered Activity : PowerOff
[8/31/2021, 1:30:08 PM] [Theater Harmony Hub] (Media Room Harmony Hub)INFO - Discovered Activity : PowerOff
[8/31/2021, 1:30:09 PM] [Theater Harmony Hub] (Office Harmony Hub)INFO - Discovered Activity : PowerOff
[8/31/2021, 1:30:09 PM] [Theater Harmony Hub] (Theater Harmony Hub)INFO - Discovered Activity : PowerOff

I'm not aware of any way to rename the PowerOff activity switch from the Harmony app or the HB-Harmony plugin.

This leads to my core question: Is this limitation caused by the homebridge-harmony plugin, or this plugin? If it is this plugin, is there any possible way to select anything other than the first PowerOff switch accessory in the device list?

For reference (if it's relevant in this context) here's my homebridge-harmony config:

        {
            "name": "Theater Harmony Hub",
            "hubIP": "10.10.86.68",
            "cleanCache": false,
            "TVAccessory": true,
            "mainActivity": "AppleTV",
            "switchAccessories": true,
            "showCommandsAtStartup": true,
            "numberOfCommandsSentForVolumeControl": 3,
            "activitiesToPublishAsAccessoriesSwitch": [
                "AirPlay",
                "Standby",
                "AppleTV"
            ],
            "showTurnOffActivity": "true",
            "otherPlatforms": [
                {
                    "name": "Sunroom Harmony Hub",
                    "hubIP": "10.10.86.66",
                    "TVAccessory": true,
                    "mainActivity": "AirPlay",
                    "activitiesToPublishAsAccessoriesSwitch": [
                        "AirPlay",
                        "Standby"
                    ],
                    "showTurnOffActivity": "true"
                },
                {
                    "name": "Media Room Harmony Hub",
                    "hubIP": "10.10.86.67",
                    "TVAccessory": true,
                    "mainActivity": "AppleTV",
                    "activitiesToPublishAsAccessoriesSwitch": [
                        "Standby"
                    ],
                    "showTurnOffActivity": "true"
                },
                {
                    "name": "Office Harmony Hub",
                    "hubIP": "10.10.86.69",
                    "TVAccessory": true,
                    "mainActivity": "AppleTV",
                    "activitiesToPublishAsAccessoriesSwitch": [
                        "AirPlay",
                        "Standby"
                    ],
                    "devicesToPublishAsAccessoriesSwitch": [
                        "Office Stereo;Mute"
                    ],
                    "showTurnOffActivity": "true",
                    "publishSwitchActivitiesAsIndividualAccessories": "true"
                }
            ],
            "platform": "HarmonyHubWebSocket",
            "_bridge": {
                "name": "Logitech Harmony",
                "username": "00:11:11:11:11:11",
                "port": 51344
            }
        },
NorthernMan54 commented 2 years ago

This leads to my core question: Is this limitation caused by the homebridge-harmony plugin, or this plugin? If it is this plugin, is there any possible way to select anything other than the first PowerOff switch accessory in the device list?

It is a limitation of the plugin, as their is no method of accurately determining which device is which without taking into account the name. The Home App has some tricks up its sleeve which this plugin does not have access to.

For your device, is the name changed in the Home App, when you look at the "poweroff" switch ? It sometimes take some time to refresh the devices in node-red, and sometimes you need to restart node-red to kick it.

If it is a unique name in the home app and you have restarted node-red, and tried selecting them again in node-red can you send me an accessory dump from the homebridge instance running Homebridge-harmony ? Details on collecting an accessory dump are here

https://github.com/NorthernMan54/homebridge-alexa#homebridge-accessory-dump

Automayted commented 2 years ago

For your device, is the name changed in the Home App, when you look at the "poweroff" switch ?

Yes, all four switches are renamed in the Home app.

It sometimes take some time to refresh the devices in node-red, and sometimes you need to restart node-red to kick it.

Yes, after the naming changes I've rebooted Homebridge and Node-RED (restarted the Docker container). This has been attempted multiple times over the last few weeks - no change in the NR hb-event dropdown

If it is a unique name in the home app and you have restarted node-red, and tried selecting them again in node-red can you send me an accessory dump from the homebridge instance running Homebridge-harmony ?

Dump is located here.

Thank you!

NorthernMan54 commented 2 years ago

Tks for the dump, what I see is 2 different name objects listed

At the accessory level - "Theater Harmony Hub-PowerOff" At the service level - "PowerOff"

And Homebridge-automation is picking the name at the service level

Let me look at this further

NorthernMan54 commented 2 years ago

If you use the Eve app, do the names appear correctly ?

Automayted commented 2 years ago

If you use the Eve app, do the names appear correctly ?

Eve appears to mirror what I've setup in HomeKit: image

Automayted commented 1 year ago

Moved to Home Assistant - no longer an issue.