HABApp
HABApp copied to clipboard
inconsistent handling of "param" folder for "depends on"/"reloads on"
HABApp: 24.08.01 config,yml:
directories:
logging: /etc/openhab/habapp/logging # Folder where the logs will be written to
# logging: /etc/openhab/habapp/log # Folder where the logs will be written to
rules: /etc/openhab/habapp/rules # Folder from which the rule files will be loaded
param: /etc/openhab/habapp/param # Folder from which the parameter files will be loaded
config: /etc/openhab/habapp/config # Folder from which configuration files (e.g. for textual thing configuration) will be loaded
lib: lib # Folder where additional libraries can be placed
...
extract from logFile for the RequestFileLoadEvent
[2025-01-04 16:10:26,711] [ Exceptions] INFO | File loaded: <RequestFileLoadEvent filename: rules/groupCheck.py>
[2025-01-04 16:11:09,128] [ Exceptions] INFO | File loaded: <RequestFileLoadEvent filename: params/groups.yml>
When I want to add a dependency to any file in the "parameter Folder" aka param
I need to add this to the top of my file:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# HABApp:
# depends on:
# - params/groups.yml
# reloads on:
# - params/groups.yml
...
Why is the required "name" of the folder "params" even though in reality it is "param"?
It my seem like the prefix is the key name from the configuration file but the prefix name is an arbitrary prefix and not the config key. It just happens to match with e.g. "rules".
Obviously it would be nice if it aligns with the key for parameter files.
I think the only non breaking way would be to automatically change the key name from paramto params and issue a warning that a manual migration is needed.
But I'm not a hundred percent sure that it's worth the effort.
Well - maybe a note in the documentation is sufficient.
e.g. change
File names are not absolute but relative with a folder specific prefix.
It’s best to use the file name from the [RequestFileLoadEvent](https://habapp.readthedocs.io/en/latest/advanced_usage.html#HABApp.core.events.habapp_events.RequestFileLoadEvent) from the HABApp event bus.
to
File names are not absolute but relative with a folder specific prefix - that do not necessarily match to real folder name.
It’s best to use the file name from the [RequestFileLoadEvent](https://habapp.readthedocs.io/en/latest/advanced_usage.html#HABApp.core.events.habapp_events.RequestFileLoadEvent) from the HABApp event bus.
I would also then revert my change https://github.com/spacemanspiff2007/HABApp/pull/454.
@Rosi2143 I follow your argument that the param config entry should be renamed params.
Dev-5 implements this in a backwards compatible way.
Implemented in HABApp 25