openhab-google-assistant icon indicating copy to clipboard operation
openhab-google-assistant copied to clipboard

Adding AC_UNIT type

Open adobito opened this issue 2 years ago • 4 comments

Was trying to figure out how to get my AC to work like they do in my Sensibo and got suggestion that I needed the AC_UNIT type from this thread.

After digging into the Air Conditioning Unit guide I felt pretty confident that this is pretty much a combination of the Fan device type and the Thermostat device type, plus an added Power Switch (it looks like Fan uses fanSpeed for on/off state). I set the base class as DefaultDevice because I didn't know how to handle the double inheritance, but I understand this might be a bad way to do it.

I have not tested this PR yet since the steps to get a test Instance running don't seem trivial and wanted to get feedback on my approach first before committing that much effort.

adobito avatar Apr 26 '22 23:04 adobito

Thanks for your contributions. Just letting you know that I saw your PR.

As I am kinda busy right now it will likely take a little time to provide you with some feedback.

michikrug avatar Apr 28 '22 20:04 michikrug

Well I get your idea here. Unfortunately, we will run into some issues with that...

The current Fan implementation is only based on a single Dimmer item and thus will not work with a group and child items which would be necessary for the AC_UNIT device. This limitation also applies to the command SetFanSpeed. We will need to either wait for the completion of the fan rework in #221 which will also implement the device based on a group or implement some more custom logic on the AC_UNIT device.

For the thermostat part I believe it may work in the sketched way.

michikrug avatar May 03 '22 20:05 michikrug

Well I get your idea here. Unfortunately, we will run into some issues with that...

The current Fan implementation is only based on a single Dimmer item and thus will not work with a group and child items which would be necessary for the AC_UNIT device. This limitation also applies to the command SetFanSpeed. We will need to either wait for the completion of the fan rework in #221 which will also implement the device based on a group or implement some more custom logic on the AC_UNIT device.

For the thermostat part I believe it may work in the sketched way.

Which approach would you suggest? I was trying to avoid code duplication as much as possible to reduce maintenance overhead but I'm not sure how often Google updates their end. If the maintenance burden is low, then having some duplicate code might not be so bad.

adobito avatar May 04 '22 21:05 adobito

Hi @adobito and again sorry for the waiting time.

I just spend some minutes and used your initial idea to implement a (hopefully) working AC_UNIT device. You can have a look at #358. I still need to do some real world testing and add some documentation around the usage.

Again I want to thank you for your initial spark.

michikrug avatar May 25 '22 20:05 michikrug