Dear developers
Im trying to update an abandoned custom_components integration but since my programming skills in python / hassio are limited I need some guidance.
Even though i managed to update the file structure and other python functions of the integration to work in the latest version of hassio, there’s this code:
from my_custom_lib import MyClient
which fails the initial setup procedure.
my_custom_lib folder is inside hassio/config/deps/lib/python3.6/site-packages/ and contains library python files.
yes, you’re right
Once i copy/pasted the code from inventor_hub.py to init.py it changed the error to:
[homeassistant.setup] Unable to prepare setup for platform inventor_hub.climate: Platform not found (cannot import name ‘SUPPORT_TARGET_HUMIDITY_LOW’ from ‘homeassistant.components.climate’ (/usr/src/homeassistant/homeassistant/components/climate/init.py))
which probably means that i need to find the equivalent names of the latest hassio for
unfortunately it requires advanced knowledge of python for it to work with the latest version of hassio, which I dont have.
Not only files and folders structure have changed but also the havc functions.
Old version of the integration has functions and calls which no longer exist.
Did some more digging to it.
Seems that both the structure and the commands have changed. What I did with the same module (Πατριδα υποθετω ετσι?) since I have the EVA II dehumidifier, is that I copied both folders (midea_dehumi & midea_inventor_lib) in the custom_components folder. Before I had the midea_inventor_lib in the /config/deps/lib… etc and it couldn’t find it. I guess another upgrade broke that.
Also, you’ll need to rename the midea_dehumi.py to init.py and create a manifest.json with the following:
In every folder (climate folder, sensor folder) you take the .py files and rename them to it’s component file (eg. climate.py, sensor.py)
In final terms, you’ll need to have the midea_dehumi folder inside custom_components folder with the following files: init.py
manifest.json
climate.py
sensor.py
And of course the midea_inventor_lib inside custom_components too.
Now the first module will load and find your dehumidifier from the cloud (yay!).
The second and real PITA problem is that, apart from hass upgrading and breaking the custom_components tree, it also changed naming and structure of the climate control. …Sigh…
SUPPORT_TARGET_HUMIDITY_LOW has been removed
SUPPORT_TARGET_HUMIDITY_HIGH has been removed
SUPPORT_OPERATION_MODE I guess has become HVAC_MODES
SUPPORT_ON_OFF I guess has become HVAC_MODE_OFF
ATTR_FAN_LIST I guess has become ATTR_FAN_MODES
ATTR_OPERATION_MODE I guess has become ATTR_HVAC_MODE
ATTR_OPERATION_LIST I guess has become ATTR_HVAC_MODES
I don’t know a lot of python, but I’m good with programming logic, so I’ll give it a shot if I can convert it to something workable. Of course it will take a very long time since I’ll go by chances and not by programming knowledge!
I hope a person with knowledge can do it though! That would be heaven!
Not from me (yet anyway). Since I don’t have programming skills, I’m working with logic and comparing with other climate devices which are updated. So far I’ve done nothing but a hole!
Good news everybody! (I hope you read that with the proffessors voice from Futurama)
I’ve successfully converted the script to properly recognise the Midea Dehumidifier and be able to see the humidity percentage and set fan speeds. Seems I’ve surpassed the problem that hvac_mode was not implemented. Current problem to solve is setting power modes (smart mode, clothes dry etc) and be able to turn it on or off. But we’re on a good path!
If someone wants, I can post the current zip which is working like I said above until I fix it completely!
Ok, I’ve made a hole so far. For some reason other climate devices use proper HVAC modes and our isn’t. Which is correct, since it was created pre-hvac mode era, but I can’t figure out how to both get HVAC modes for Hass to be happy AND Midea operation modes to be happy. For now Only current humidity works and fan set works. You cannot turn it on or off from hass or set a mode.
Anyway, here’s the link for the partially working component, since the wall I hit will probably take a long time to resolve. Hope someone with knowledge can do better than me. Click to Download