homebridge / homebridge-config-ui-x

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

Settings Config Not Rendering #1033

Closed mcclurec closed 3 years ago

mcclurec commented 3 years ago

Describe Your Problem: I have a Homebridge plugin I author called Homebridge Volumio Speakers which is for getting Volumio instances into Homekit. This week, I was doing some dev work for an upcoming version. One of the things I was updating was the config.schema.json to add a new optional field in a fold down layout. I've npm built the dev version, scp'd the update to the homebridge server and npm link'd it. The new code for the plugin is running, but the setting UI now only shows the json text editor instead of the form version.

I've tried rolling back the config.schema.json file, rebuilding and re-uploading, but the settings modal is still broken. I've tested the changes in the Angular Schema Form Playground linked in the developer docs, and my config works there as intended.

Can you think of any reason why the setting config would default back to the json editor?

Old config.schema.json https://github.com/mcclurec/homebridge-volumio-speakers/blob/b4aabbdf115966911cf8cef9310f6182e37e7046/config.schema.json

New config.schema.json

{
  "pluginAlias": "Volumio Speakers",
  "pluginType": "platform",
  "singular": true,

  "schema": {
    "type": "object",
    "properties": {
      "serverURL": {
        "title": "Server URL",
        "description": "Only one Volumio server URL is required. Other instances/zones will be auto discovered from this one",
        "type": "string",
        "default": "http://volumio.local",
        "pattern": "^https?:\/\/(.*)[^/]$",
        "required": true
      },
      "serverPort": {
        "title": "Websocket Port",
        "type": "number",
        "placeholder": 3000,
        "minimum": 0,
        "maximum": 65353
      }
    }
  },

  "layout": [
    {
      "key": "serverURL",
      "validationMessage": {
        "202": "Must include protocol and no trailing slash (e.g. http://volumio.local, https://192.168.1.100, etc)"
      }
    },
    {
      "type": "section",
      "title": "Advanced",
      "expandable": true,
      "expanded": false,
      "items": [
        {
          "key": "serverPort"
        }
      ]
    }
  ]
}

Logs:

[1/19/2021, 12:31:07 PM] Homebridge v1.2.3 is running on port 51426.
[1/19/2021, 12:31:07 PM] [Volumio Speakers] Socket connected: http://volumio.local:3000
[1/19/2021, 12:31:07 PM] [Volumio Speakers] Downstairs Speakers added
[1/19/2021, 12:31:07 PM] Downstairs Speakers A525 is running on port 38205.
[1/19/2021, 12:31:07 PM] Please add [Downstairs Speakers A525] manually in Home app. Setup Code: 031-45-154
[1/19/2021, 12:31:07 PM] [Volumio Speakers] Downstairs Speakers: Socket connected: http://192.168.1.121:3000
[1/19/2021, 12:31:07 PM] [UniFi Protect] Portunus [UCK-G2-PLUS]: Connected to the Protect controller API (address: 192.168.1.7 mac: XXXX).
[1/19/2021, 12:31:07 PM] [UniFi Protect] Portunus [UCK-G2-PLUS]: Discovered camera: Front Yard [UVC G3] (address: 192.168.1.56 mac: XXXX).
[1/19/2021, 12:31:07 PM] [UniFi Protect] Portunus [UCK-G2-PLUS]: Controller refresh interval set to 5 seconds.
[1/19/2021, 12:31:07 PM] [UniFi Protect] Portunus [UCK-G2-PLUS] Front Yard [UVC G3]: Stream quality configured: High.
[1/19/2021, 12:31:11 PM] [Nest] initing thermostat "Downstairs Thermostat": deviceId: XXXX structureId: XXXX
[1/19/2021, 12:31:11 PM] [Nest] initing thermostat "Upstairs Thermostat": deviceId: XXXX structureId: XXXX
[1/19/2021, 12:31:11 PM] [Nest] initing home_away_sensor "Home Occupied": deviceId: XXXX structureId: XXXX

Homebridge Config:

{
    "bridge": {
        "name": "Homebridge 8039",
        "username": "XXXX",
        "port": 51426,
        "pin": "031-45-154"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8081,
            "auth": "none",
            "theme": "green",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config"
        },
        {
            "debug": false,
            "controllers": [
                {
                    "address": "192.168.1.7",
                    "password": "XXXX",
                    "username": "XXXX"
                }
            ],
            "platform": "UniFi Protect"
        },
        {
            "name": "Nest",
            "googleAuth": {
                "issueToken": "XXXX",
                "cookies": "XXXX",
                "apiKey": "XXXX"
            },
            "platform": "Nest"
        },
        {
            "name": "Shelly",
            "username": "XXXX",
            "password": "XXXX",
            "admin": {
                "enabled": true
            },
            "platform": "Shelly"
        },
        {
            "serverURL": "http://volumio.local",
            "platform": "Volumio Speakers"
        }
    ]
}

Screenshots:

image

Environment:

oznu commented 3 years ago

The "new" schema you provided works as expected.

image

You may have to do a full restart of the UI for it to be picked up. Homebridge Settings -> Force Restart.

mcclurec commented 3 years ago

Closing the loop here on what the issue was... The npm linked development version didn't include the schema file. I had mistakenly only scp'd the dist directory, so the new plugin code was running, but the setting were displaying the default editor