homebridge / homebridge-config-ui-x

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

Array in config.schema display only first value #856

Closed grzegorz914 closed 4 years ago

grzegorz914 commented 4 years ago

Describe The Bug: If create config.schema.json with 'layout view' then array displays only first value in Config UI X after open some plugin settings. This happened for all 'appButtons', 'channelButtons'.... All checked in ANGULAR Json Schema Form and all passed correct.

Expected behavior: Display all values of array after open it in Config UI X

Logs: no logs

Homebridge Config:

{
    "pluginAlias": "plugin",
    "pluginType": "platform",
    "headerDisplay": "",
    "footerDisplay": "",
    "schema": {
        "type": "object",
        "properties": {
            "devices": {
                "title": "Devices",
                "buttonText": "Add device",
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "title": "Name",
                            "description": "The name.",
                            "type": "string",
                            "default": "My LG TV",
                            "minLength": 1,
                            "required": true
                        },
                        "ip": {
                            "title": "TV ip address",
                            "description": "The ip address.",
                            "type": "string",
                            "format": "ipv4",
                            "required": true
                        },
                        "mac": {
                            "title": "TV mac address",
                            "description": "The mac addres.",
                            "type": "string",
                            "required": true
                        },
                        "broadcastAdr": {
                            "title": "Broadcast address",
                            "description": "If homebridge runs on a host with more than one network interface use this to specify the broadcast address.",
                            "type": "string",
                            "format": "ipv4"
                        },
                        "keyFile": {
                            "title": "Key file location",
                            "description": "The location where to store",
                            "type": "string"
                        },
                        "prefsDir": {
                            "title": "Prefs directory",
                            "description": "The location where to store",
                            "type": "string"
                        },
                        "pollingInterval": {
                            "title": "Background polling interval",
                            "description": "How often to check the status of the tv in seconds.",
                            "type": "number",
                            "default": 5
                        },
                        "deepDebugLog": {
                            "title": "Enable deep debug log.",
                            "description": "Enables additional more detailed debug log. Useful when trying to figure out issues with the plugin.",
                            "type": "boolean"
                        },
                        "hideTvService": {
                            "title": "Hide the TV service",
                            "description": "Recommended when the TV already supports native HomeKit integration to prevent double TV accessories.",
                            "type": "boolean"
                        },
                        "volumeLimit": {
                            "title": "Volume limit for the volume service",
                            "description": "Allows to limit the volume which can be set using the volume service.",
                            "type": "integer",
                            "default": 100,
                            "maximum": 100,
                            "minimum": 1
                        },
                        "volumeControl": {
                            "title": "Volume control service",
                            "description": "Whether to enable additional volume control. Button - adds volume up/down buttons, Slider - adds a light bulb which acts as a volume controller.",
                            "type": "string",
                            "oneOf": [
                                {
                                    "title": "None",
                                    "const": "none"
                                },
                                {
                                    "title": "Both - slider and buttons",
                                    "const": "both"
                                },
                                {
                                    "title": "Slider",
                                    "const": "slider"
                                },
                                {
                                    "title": "Buttons",
                                    "const": "buttons"
                                }
                            ],
                            "default": "both",
                            "required": true
                        },
                        "channelControl": {
                            "title": "Channel control service",
                            "description": "Whether to show channel up/down buttons.",
                            "type": "boolean",
                            "default": true
                        },
                        "mediaControl": {
                            "title": "Media control service",
                            "description": "Whether to show media control buttons.",
                            "type": "boolean"
                        },
                        "screenControl": {
                            "title": "Screen control service",
                            "description": "Whether to show the screen control button. Allows to turn on/off the tv screen.",
                            "type": "boolean"
                        },
                        "screenSaverControl": {
                            "title": "Screen saver control service",
                            "description": "Whether to show the screen saver control button. Allows to instantly activate the screen saver on the TV. Can be used only when no content is playing on the tv.",
                            "type": "boolean"
                        },
                        "ccRemoteRemap": {
                            "title": "Remap control center remote buttons",
                            "description": "Allows to remap the control center remote buttons. For possible values check the README.",
                            "type": "object",
                            "properties": {
                                "arrowup": {
                                    "title": "Arrow up button",
                                    "type": "string"
                                },
                                "arrowdown": {
                                    "title": "Arrow down button",
                                    "type": "string"
                                },
                                "arrowleft": {
                                    "title": "Arrow left button",
                                    "type": "string"
                                },
                                "arrowright": {
                                    "title": "Arrow right button",
                                    "type": "string"
                                },
                                "select": {
                                    "title": "Select button",
                                    "type": "string"
                                },
                                "back": {
                                    "title": "Back button",
                                    "type": "string"
                                },
                                "playpause": {
                                    "title": "PlayPause button",
                                    "type": "string"
                                },
                                "information": {
                                    "title": "Information button",
                                    "type": "string"
                                }
                            }
                        },
                        "appButtons": {
                            "title": "App buttons",
                            "description": "Dedicated app buttons which will appear for the TV. Params needs to be added manually in the config.json",
                            "type": "array",
                            "buttonText": "Add app button",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "appId": {
                                        "title": "Application Id",
                                        "type": "string",
                                        "required": true
                                    },
                                    "name": {
                                        "title": "Application name",
                                        "type": "string"
                                    }
                                }
                            }
                        },
                        "channelButtons": {
                            "title": "Channel buttons",
                            "description": "Allows to create buttons for specific channels.",
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "channelNumber": {
                                        "title": "Channel number",
                                        "type": "number",
                                        "required": true
                                    },
                                    "channelId": {
                                        "title": "Channel Id",
                                        "type": "string"
                                    },
                                    "name": {
                                        "title": "Channel name",
                                        "type": "string"
                                    }
                                }
                            }
                        },
                        "notificationButtons": {
                            "title": "Notification buttons",
                            "description": "Allows to create buttons that show notifications on your TV.",
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "message": {
                                        "title": "Message",
                                        "type": "string",
                                        "required": true
                                    },
                                    "name": {
                                        "title": "Notification name",
                                        "type": "string"
                                    },
                                    "appId": {
                                        "title": "Application Id",
                                        "type": "string"
                                    }
                                }
                            }
                        },
                        "remoteControlButtons": {
                            "title": "Remote control buttons",
                            "description": "Allows to create buttons that emulate remote control presses.",
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "action": {
                                        "title": "Action",
                                        "type": "string"
                                    },
                                    "name": {
                                        "title": "Remote control name",
                                        "type": "string"
                                    }
                                }
                            }
                        },
                        "remoteSequenceButtons": {
                            "title": "Remote sequence buttons",
                            "description": "Allows to create buttons that run a specified remote control sequence.",
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "sequence": {
                                        "title": "Sequence",
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "required": true
                                        }
                                    },
                                    "name": {
                                        "title": "Remote sequence name",
                                        "type": "string"
                                    },
                                    "interval": {
                                        "title": "Interval",
                                        "type": "array",
                                        "items": {
                                            "type": "number"
                                        },
                                        "default": 500
                                    }
                                }
                            }
                        },
                        "soundOutputButtons": {
                            "title": "Sound output buttons",
                            "description": "Allows to create buttons that can switch between sound outputs.",
                            "type": "array",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "soundOutput": {
                                        "title": "Sound output",
                                        "type": "string",
                                        "enum": [
                                            "tv_speaker",
                                            "external_optical",
                                            "external_arc",
                                            "external_speaker",
                                            "lineout",
                                            "headphone",
                                            "tv_external_speaker",
                                            "tv_speaker_headphone",
                                            "bt_soundbar"
                                        ]
                                    },
                                    "name": {
                                        "title": "Name",
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "layout": [
        {
            "type": "section",
            "title": "Devices",
            "expandable": true,
            "expanded": true,
            "items": [
                {
                    "key": "devices",
                    "type": "array",
                    "orderable": false,
                    "buttonText": "Add device",
                    "items": [
                        "devices[].name",
                        "devices[].ip",
                        "devices[].mac",
                        {
                            "key": "devices[]",
                            "type": "section",
                            "title": "Buttons",
                            "expandable": true,
                            "expanded": false,
                            "items": [
                                {
                                    "key": "devices[]",
                                    "type": "section",
                                    "title": "App buttons",
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "devices[].appButtons",
                                            "type": "array",
                                            "orderable": false,
                                            "buttonText": "Add app button",
                                            "items": [
                                                "devices[].appButtons[].appId",
                                                "devices[].appButtons[].name"
                                            ]
                                        }
                                    ]
                                },
                                {
                                    "key": "devices[]",
                                    "type": "section",
                                    "title": "Channel buttons",
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "devices[].channelButtons",
                                            "type": "array",
                                            "orderable": false,
                                            "buttonText": "Add channel button",
                                            "items": [
                                                "devices[].channelButtons[].channelNumber",
                                                "devices[].channelButtons[].channelId",
                                                "devices[].channelButtons[].name"
                                            ]
                                        }
                                    ]
                                },
                                {
                                    "key": "devices[]",
                                    "type": "section",
                                    "title": "Notification buttons",
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "devices[].notificationButtons",
                                            "type": "array",
                                            "orderable": false,
                                            "buttonText": "Add notification button",
                                            "items": [
                                                "devices[].notificationButtons[].message",
                                                "devices[].notificationButtons[].name",
                                                "devices[].notificationButtons[].appId"
                                            ]
                                        }
                                    ]
                                },
                                {
                                    "key": "devices[]",
                                    "type": "section",
                                    "title": "Sound output buttons",
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "devices[].soundOutputButtons",
                                            "type": "array",
                                            "orderable": false,
                                            "buttonText": "Add sound output button",
                                            "items": [
                                                "devices[].soundOutputButtons[].soundOutput",
                                                "devices[].soundOutputButtons[].name"
                                            ]
                                        }
                                    ]
                                },
                                {
                                    "key": "devices[]",
                                    "type": "section",
                                    "title": "Remote control buttons",
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "devices[].remoteControlButtons",
                                            "type": "array",
                                            "orderable": false,
                                            "buttonText": "Add remote control button",
                                            "items": [
                                                "devices[].remoteControlButtons[].action",
                                                "devices[].remoteControlButtons[].name"
                                            ]
                                        }
                                    ]
                                },
                                {
                                    "key": "devices[]",
                                    "type": "section",
                                    "title": "Remote sequence button",
                                    "expandable": true,
                                    "expanded": false,
                                    "items": [
                                        {
                                            "key": "devices[].remoteSequenceButtons",
                                            "type": "array",
                                            "orderable": false,
                                            "buttonText": "Add remote sequence button",
                                            "items": [
                                                {
                                                    "key": "devices[].remoteSequenceButtons[].sequence",
                                                    "title": "Sequence",
                                                    "type": "array",
                                                    "items": [
                                                        "devices[].remoteSequenceButtons[].sequence[]"
                                                    ]
                                                },
                                                {
                                                    "key": "devices[].remoteSequenceButtons[].name",
                                                    "title": "Name",
                                                    "items": [
                                                        "devices[].remoteSequenceButtons[].name"
                                                    ]
                                                },
                                                {
                                                    "key": "devices[].remoteSequenceButtons[].interval",
                                                    "title": "Interval",
                                                    "type": "array",
                                                    "items": [
                                                        "devices[].remoteSequenceButtons[].interval[]"
                                                    ]
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "key": "devices[]",
                            "type": "section",
                            "title": "Remote control",
                            "expandable": true,
                            "expanded": false,
                            "items": [
                                {
                                    "key": "devices[].ccRemoteRemap",
                                    "type": "section",
                                    "items": [
                                        "devices[].ccRemoteRemap.arrowleft",
                                        "devices[].ccRemoteRemap.arrowup",
                                        "devices[].ccRemoteRemap.arrowright",
                                        "devices[].ccRemoteRemap.arrowdown",
                                        "devices[].ccRemoteRemap.select",
                                        "devices[].ccRemoteRemap.back",
                                        "devices[].ccRemoteRemap.playpause",
                                        "devices[].ccRemoteRemap.information"
                                    ]
                                }
                            ]
                        },
                        {
                            "key": "devices[]",
                            "type": "section",
                            "title": "Advanced Settings",
                            "expandable": true,
                            "expanded": false,
                            "items": [
                                "devices[].pollingInterval",
                                "devices[].broadcastAdr",
                                "devices[].prefsDir",
                                "devices[].keyFile",
                                "devices[].volumeLimit",
                                "devices[].volumeControl",
                                "devices[].mediaControl",
                                "devices[].channelControl",
                                "devices[].screenControl",
                                "devices[].screenSaverControl",
                                "devices[].hideTvService",
                                "devices[].deepDebugLog"
                            ]
                        }
                    ]
                }
            ]
        }
    ]
}

Screenshots:

Environment:

stale[bot] commented 4 years 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.

AntonioMeireles commented 2 years ago

@grzegorz914 did you ever managed to get around this ? (having same issue in my plugin :|)

Thanks in advance!

grzegorz914 commented 2 years ago

I have 5 plugins which uses same config.schema and in some plugin is working correct in other not. This is very strange behavior.

grzegorz914 commented 1 year ago

fixed with #1504