Hi openHAB Community,
I’m encountering an issue with my YAML configuration, and I’m stuck. The error I’m seeing is:
Map keys must be unique at line 68, column 1:
component: div
Configuration Details
Here’s the relevant portion of my YAML file:
timestamp: Jan 1, 2025, 10:44:14 AM
component: oh-context
config:
constants:
widgetID: Number.parseInt(Math.random()*8912).toString(16).padStart(4, '0')
component: div
config:
stylesheet: |
.card:not(.card-opened) .card-content {
width: 100% !important;
}
slots:
default:
- component: f7-card
config:
expandable: true
The Issue
The error seems to point to the component
key being duplicated or misused in the YAML file. Since component
is a required property in multiple parts of the configuration, I’m not sure how to handle this.
What I’ve Tried
- Checked the YAML file for any accidental duplicate
component
keys. - Validated the YAML syntax using an online YAML linter—no syntax issues found apart from the error mentioned.
- Reviewed the openHAB documentation, but couldn’t find specifics about handling multiple
component
entries in this way. - Tried this
mainComponent:
component: oh-context
config:
constants:
widgetID: Number.parseInt(Math.random()*8912).toString(16).padStart(4, '0')
subComponent:
component: div
config:
stylesheet: |
.card:not(.card-opened) .card-content {
width: 100% !important;
}
slots:
default:
- component: f7-card
config:
expandable: true
But without success
Questions
- Is it valid to have multiple
component
keys in openHAB YAML configurations? If not, how should I structure this instead? - Could the use of
slots
or nestedcomponent
definitions be causing this problem? - Are there better practices for organizing a complex YAML configuration like this to avoid such errors?
Any advice or insights would be greatly appreciated. Let me know if more details or a larger portion of the YAML file would help.
Thank you so much!