homebridge / homebridge-config-ui-x

The Homebridge UI. Monitor, configure and backup Homebridge from a browser.
https://homebridge.io
MIT License
2.61k stars 372 forks source link

Homebridge 2.0 Beta Child Bridge Naming #2109

Closed andrewk123 closed 1 week ago

andrewk123 commented 1 month ago

Describe The Bug

In 2.0 Beta if you do not have a plugin "name" assigned an error is raised (see below) on starting the plugin. Note that the child bridge is named correctly in the list of Child Plugins (in this case homebridge-phantom-switch-wsm) and everything seems to work correctly. However, you have to add a plugin name in config.js eg

"platform": "Phantom_Switch",
"name": "Phantom Switch",

to (without '-' in the name) to remove the error on boot. Note that this plugin is a private plugin used internally, however I see the same issue on plugins downloaded from NPM.

The issue does not appear on v1.8.4.

Note that this is a standard (apt based) Raspi install on bookworm.

Logs

HAP-NodeJS WARNING: The accessory 'homebridge-phantom-switch-wsm 77FA' has an invalid 'Name' characteristic ('homebridge-phantom-switch-wsm 77FA'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness.

Config

{
    "platform": "Phantom_Switch",
    "devices": [
        {
            "name": "Phantom 1",
            "delay": 120,
            "hasMotion": true
        },
        {
            "name": "Phantom 2",
            "delay": 180
        }
    ],
    "_bridge": {
        "username": "XX:XX:XX:XX:XX:XX",
        "port": 58202
    }
}

Homebridge UI Version

v4.56.4

Homebridge Version

v2.0.0-beta.8

Node.js Version

v20.15.1

Operating System

Raspberry Pi OS / Raspbian

Environment Info

None

Raspberry Pi Model

Raspberry Pi 4 B

mkz212 commented 1 month ago

As far as I know, the 'platform' should:

The plugin should also contain 'name'. The value 'name' means the name of the child bridge and also the name displayed in logs.

so for me it should be:

{
    "platform": "homebridge-phantom-switch",
    "name": "Phantom Switch",
    "devices": [
        {
            "name": "Phantom 1",
            "delay": 120,
            "hasMotion": true
        },
        {
            "name": "Phantom 2",
            "delay": 180
        }
    ],
    "_bridge": {
        "username": "XX:XX:XX:XX:XX:XX",
        "port": 58202
    }
}
bwp91 commented 1 month ago

The child bridge can be named with a name property inside the _bridge object. although I'm going slightly off-topic in this issue.

The beta version of the UI allows for child bridge details to be modified in the UI:

Screenshot 2024-07-30 at 11 15 04

tbmopa commented 1 month ago

Thanks for that. I typically always set a child bridge name anyway for clarity, however it appears that there is a change from 1.8.3 to 2.0.0 in homebridge which throws an error on startup if a child bridge name is not added and the plugin name is the typical homebridge-xxxxxx etc. If it is not possible to fix this in homebridge or the underlying code then I would suggest the name field is made mandatory when adding a child bridge.

donavanbecker commented 1 month ago

Let's clarify... this isn't an error it a warning. This can easily be mitigated by adding a default name parameter in your config.schema.json file:

https://github.com/bwp91/homebridge-govee/blob/5ce1b5c4586c64ce227b44c08cdf6d989f2bf336/config.schema.json#L11

And if you use layout it won't even display the name config option:

https://github.com/bwp91/homebridge-govee/blob/5ce1b5c4586c64ce227b44c08cdf6d989f2bf336/config.schema.json#L1409

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 week ago

This issue has been closed as no further activity has occurred.