I waited for the 1.0 release of habApp and installed it immediately after release.
I installed it twice, once on the same vm where openhab 3.3 is running, debian buster, headless. And then I installed it inside of PyCharm on a Macbook. I followed the docu on how to do that.
The idea was to use the IDE for development and then copy everything onto the production system. Same Python version on both machines, 3.10.5
I’m likely to make silly mistakes as I never used HabApp or PyCharm before, I’ve written things in python but mostly in editors like joe or nano or in VSCode (jython for OH-rules)
I now have the inconvenient situation that I have to use different name to access a module on the production install or the devel. install
So, on the PyCharm install the lib folder is at
/Users/dp/PycharmProjects/habApp/conf/lib/ and the rules sit at
config.yml is at
and it defines the directories like so:
directories: lib: lib rules: rules
Now I create a file
test.py in the
lib folder with a minimal content of just one variable,
toast = "taste"
Next I create
demo.py in the
rules folder and I start it with:
from test import toast
The IDE gives me a red underline below toast and hover says:
"Cannot find reference ‘toast’ in ‘_init_.py’ "
However, by trial and error I discovered that this works:
from conf.lib.test import toast
Now the popup on hover is glad to preview :
conf.lib.test toast: str = "taste"
On the production install however it is exactly the other way, as expected test.py in the lib folder can be found with
from test import toast and
conf.lib.test is not a valid reference.
I could live with either but having to edit/change the imports for each rule file that goes from dev. to prod is irritating.
So I wonder if it’s just me, what kind of stupid mistake I may have made and if anyone has an idea to work around the confusion.