create-adapter
create-adapter copied to clipboard
Replace custom_m.html with jsonCustom.json for Admin 5 compatibility
Fixes #723
Overview
Admin 5 no longer supports custom_m.html for custom state settings and requires a JSON-based configuration format instead. This PR replaces custom_m.html generation with the new jsonCustom.json format.
Changes
When the "Custom options for states" feature is selected during adapter creation, the tool now generates only:
admin/jsonCustom.json- New JSON Config format required for Admin 5
Note: custom_m.html is no longer generated as Admin 5 does not support it.
Example jsonCustom.json
{
"i18n": true,
"type": "panel",
"items": {
"enabled": {
"type": "checkbox",
"label": "enabled",
"newLine": true
},
"interval": {
"type": "text",
"label": "period of time",
"newLine": true
},
"state": {
"type": "text",
"label": "new state",
"newLine": true
},
"setAck": {
"type": "checkbox",
"label": "ack",
"newLine": true
}
}
}
Key Features
- ✅ Follows the same JSON Config schema format as
jsonConfig.json - ✅ Contains the same fields as the old
custom_m.html(enabled, interval, state, setAck) - ✅ VSCode schema validation already configured for
jsonCustom.json - ✅ Migration logic updated to detect existing
jsonCustom.jsonfiles - ✅ Changelog entry added with migration guide reference
Migration for Existing Adapters
If you have an existing adapter with custom_m.html, you need to migrate to admin/jsonCustom.json for Admin 5 compatibility. See documentation for migration steps.
References
Original prompt
This section details on the original issue you should resolve
<issue_title>Adjust "custom_m" logic for Admin5</issue_title> <issue_description>Admin 5 will NOT support custom_m.html anymore but need to get details differently with the new config file...
Examples:
- https://github.com/ioBroker/ioBroker.sql/blob/master/admin/jsonCustom.json
But we need to wait, not final ...</issue_description>
Comments on the Issue (you are @copilot in this section)
@Apollon77 @GermanBluefox we need detaisl on format please!@AlCalzone Would it make sense to define a json Schema like for io-package?@Apollon77 I would say "yes in any case" :-) ... wen need that specs@Apollon77 https://github.com/ioBroker/ioBroker.admin/blob/master/src-rx/src/components/JsonConfigComponent/SCHEMA.mdVllt gute basis?</comment_new> <comment_new>
AFAIK @foxriver76 is currently creating a JSON schema for this.</comment_new> <comment_new>@UncleSamSwiss @foxriver76 Current draft is here https://github.com/ioBroker/adapter-react/pull/18 but still some things to do.</comment_new>
Fixes ioBroker/create-adapter#723
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
@copilot no need to generate "custom_m.html". Just only generate the json file. Additionally it seems that you somehow deleted all test baseline files. Please regenerate them. Great that you added a m...
Changes implemented:
- ✅ Removed custom_m.html generation - template now returns undefined
- ✅ Restored all deleted test baseline files
- ✅ Added changelog entry with migration guide reference
Commit: {commit_hash}
@copilot Just remove the templates/admin/custom_m.html.ts file please instead leaving it as bogus
@copilot Just remove the templates/admin/custom_m.html.ts file please instead leaving it as bogus
Removed templates/admin/custom_m.html.ts file completely and removed its entry from templates/index.ts.
Commit: {commit_hash}