Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display accessory name in header field? #2254

Open
justjam2013 opened this issue Nov 27, 2024 · 1 comment
Open

How to display accessory name in header field? #2254

justjam2013 opened this issue Nov 27, 2024 · 1 comment
Labels

Comments

@justjam2013
Copy link
Contributor

justjam2013 commented Nov 27, 2024

Current Situation

I opened ticket Enable device section folding.
In the process of investigating the issue, I discovered that I can get that functionality out of the box using both expandable and expanded, and making sure that items had a title property:

        "title": "Accessories",
        "type": "array",
        "items": {
          "title": "Accessory,
          "type": "object",
          "expandable": true,
          "expanded": false,
          "properties": {
            "accessoryName": {
              "title": "Accessory Name",
              "type": "string",
              "required": true
            },
          ...

It's not as pretty as the functionality provided by Homebridge UI, but it is functional:
Screenshot 2024-11-27 at 3 00 19 PM

However, I am unable to figure out how dynamically assign the accessory name to the section header, so all collapsed accessories show Accessory.
I tried using model.devices[arrayIndices].accessoryType.accessoryName but that didn't work as it displayed the string itself, not the accessory name:
Screenshot 2024-11-27 at 3 05 55 PM

How can I get the dynamic name to show up, like "My Suoer Duoer Switch" like in this mockup?
Screenshot 2024-11-27 at 3 05 55 PM copy

Logs

No response

Config

No response

Homebridge UI Version

5.0.0-beta.7

Homebridge Version

1.8.5

Node.js Version

22.9.0

Operating System

macOS

Environment Info

Using hb-service

Raspberry Pi Model

None

@justjam2013
Copy link
Contributor Author

I found that the index of the item is available in the schema as the variable index and can be used as such:

          "title": "{{ $index }}",

What other variables are available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant