Over the past weekend I’ve been working on setting up my own integration with my internet enabled heatpump. Because I’m a developer and wanted to do a project with python, great fun, or so I thought.
home assistant itself is running in a docker container on a raspberry pi btw so it’s just the core.
In any case, I forked someone else’s api implementation and tweaked it to my liking. Grabbed a somewhat outdated climate entity integration for HA and updated it.
Don’t pay too close attention to the commit logs, I’ve been fucking around hard trying to get this to work…
In any case, if you want the code:
And the integration:
So far so good. I think. Now when it got time to get home assistant to do anything with it that’s where the fun starts.
I’ve added the following to my config.yaml:
climate:
- platform: pyfgl
username: <my email>
password: !secret fujitsu_password
Furthermore, in the same config folder I’ve created the necessary folder structure: /custom_components/pyfgl
where you can find the code from the integration project:
- climate.py (fujitsu_general_heatpump.py from the HA integration project renamed to climate.py)
- init.py (empty)
- manifest.json
manifest.json is simple:
{
"version": "1.0.0",
"domain": "pyfgl",
"name": "pyfgl",
"documentation": "https://github.com/thierryvt/pyfujitsu_for_homeassistant/blob/c7dc069ccf8aee94a2313ba690fb557c59e280ef/README.md",
"dependencies": [],
"codeowners": [],
"requirements": ["pyfgl @ git+https://github.com/thierryvt/pyfujitsu.git"]
}
And I figured that was it, commented out the climate config bit for a sec, restarted HA, uncommented the config and refreshed. It thought about it for a while and then came up with the error:
Platform error climate.pyfgl - No module named 'constants'
Very descriptive… Nothing in the logs btw.
I went into the HA container, looked at the installed python libraries and it is there.
I tried the in-terminal python thing where I import the module, no issues either.
So you guys are my last hope basically. What am I doing wrong? What am I missing?
EDIT Figured it out.
After almost a week of googling, debugging, searching, crying, … I found the issue.
In the api.py and splitAC.py modules I attempt to import the constants as such:
From constants import *
This works while I’m working on it in intellij but this is apparently not ok for HA.
I had to add a ‘.’
From .constants import *
That’s it, that fixed it.
Can you guess who feels like an idiot right about now?
Hint: it’s me.