audiconnect / audi_connect_ha

Adds an audi connect integration to home assistant
MIT License
245 stars 100 forks source link

AudioLock and AudiSensor deprecated #36

Closed lokibot closed 4 years ago

lokibot commented 4 years ago

Got these after upgrade to supervisor224 and hassio 0.110.2.:

Protokolldetails ( WARNING ) Logger: homeassistant.components.lock Source: components/lock/init.py:72 Integration: Schloss (documentation, issues) First occurred: 15:02:33 (1 occurrences) Last logged: 15:02:33

LockDevice is deprecated, modify AudiLock to extend LockEntity Verbindung getrennt. Verbinde erneut...

Protokolldetails ( WARNING ) Logger: homeassistant.components.binary_sensor Source: components/binary_sensor/init.py:139 Integration: Binärsensor (documentation, issues) First occurred: 15:02:33 (1 occurrences) Last logged: 15:02:33

BinarySensorDevice is deprecated, modify AudiSensor to extend BinarySensorEntity

heymoe commented 4 years ago

Until @arjenvrh gets some time to update their code in this repository, here is how you can manually update the code installed in your local HA instance to fix them.

NOTE: I recommend making a backup and of course make these changes at your own risk. I've personally made these changes to my local copy of the audi_connect_ha code and I no longer get the deprecated messages and the integration functionally still works fine as far as I can tell so far.

First you need a way to edit the audi_connect_ha code located in the \config\custom_components\audiconnect directory of your HA install. There are several ways to do this. For example you can use the "Visual Code Studio" or "Samba Share" Add-on.

Once you have a way to access the files in \config\custom_components\audiconnect you need to update 2 files in that directory: binary_sensor.py and lock.py

Open binary_sensor.py in a text / file editor of your choice (or from within Visual Code Studio). There are two instances of "BinarySensorDevice" in this file. One one line 4 and one on line 30. You need to replace "BinarySensorDevice" with "BinarySensorEntity". Once you make those changes, save and close the file.

Next, open lock.py and similar to the last file, there are two instances of "LockDevice" in that file also on line 4 and 30 that you need to change to "LockEntity". Once you make those changes, save and close the file.

This step may not be needed but I did them so if you skip this and the issue isn't fixed / the integration doesn't work then come back to this step. After you update the two files above, go into the directory: \config\custom_components\audiconnect__pycache__ . You'll want to delete two files in this directory. One starts with binary_sensor.cpython (mine was named: binary_sensor.cpython-37.pyc) and the other starts with lock.cpython (mine was named: lock.cpython-37.pyc). These files will get re-generated upon reboot.

The last step is to restart HA. If all goes well, you will no longer get the deprecated errors in the HA logs and this integration will continue to work as normal (well at least I haven't notice any issues since making the changes) after the reboot.

As for the translations issue, I've also posted a comment in the open issue on how to fix / work around that one too.

lokibot commented 4 years ago

Awesome, all worked fine for me, no more warnings. 😃