kongo09 / philips-airpurifier-coap

💨 Philips AirPurifier custom component for Home Assistant. Supports local CoAP protocol.
188 stars 29 forks source link

Represent humidifiers by humidifier entity instead of fan entity #198

Open kongo09 opened 6 days ago

kongo09 commented 6 days ago

Currently, all devices are represented as fan entities in HA. However, there is also a humidifier entity that could be used for the humidifier devices. Right now, the candidates are:

kongo09 commented 6 days ago

Following the description here: https://developers.home-assistant.io/docs/core/entity/humidifier it appears that a humidifier lacks many properties of a fan, like speeds, etc... The Philips devices are 2-in-1 so the question is:

kongo09 commented 5 days ago

First humidifier beta release as v0.25.0-beta.1

GSzabados commented 5 days ago

I think that the current implementation is accurate, as there is a select entity for selecting which function the unit uses, purification or purification and humidification.

The idea of introducing these separate categories for everything is making things more complicated and forces developer to put devices into their seperate categories, meanwhile some devices had functions from multiple categories. And of course these overlaps are not covered. (One of the reasons why the official SmartThings integration is a dumpster fire due to the attitude and thinking of the person who developed it and abandoned it during this year.)

If you would like to have a complete solution with a single entity and multiple preset controls, like the climate_ip integration. That could be a way, but it keeps people seeing what is actually on or off.

Screenshot_20241122_090940_Home Assistant

GSzabados commented 5 days ago

Following the description here

I've looked at that article and the imagination of some of the official HA developer is daunting.

MODE_BOOST - Device turn all valve full up

They are literally reaching as low as SmartThings' developers (and this is a live capability for years!)

wrinklePrevent - The dishwasher machine is in "wrinklePrevent" mode airwash - The dishwasher machine is in "airwash" mode spin - The dishwasher machine is in "spin" mode

https://developer.smartthings.com/docs/devices/capabilities/capabilities-reference

kongo09 commented 5 days ago

Ah, interesting, you're suggesting to converge everything on https://developers.home-assistant.io/docs/core/entity/climate/

From a quick check, the only thing that seems to be missing are speed settings for the fan?

merquel commented 4 days ago

This is a really nice addition. The humidifier entity definitely improves user friendliness. The 5% button increments work very well too.

I know I'm in the minority (maybe the only one) who has a single purpose humidifier, HU5710. Since there's no option to set a custom speed it doesn't need anything the fan entity provides. In that case it would make sense to only have the humidifier entity exposed and the power and modes being set from there. It seems like no humidifier support custom fan speeds with the exception of AC3420/AC3421.

I've looked at the manuals for the 2-in-1 devices and as far as I understand the only difference is that they have a toggle between 2-in-1 mode and purification only? Maybe setting humidity to 0 or a separate switch could be an option but that's more for the owners of these devices to weigh in on whether two entities are preferable.

GSzabados commented 4 days ago

This is how on the 2-in-1:

Screenshot_20241123_191144_Home Assistant

And I meant that climate entity as an example. If the fan entity supports multiple preset options.

kongo09 commented 3 days ago

Function and target as shown above are now removed and part of the new humidifier entity.

I could double the presets into the humidifier entity if it exists and also make power true power while for the 2-in-1 devices the state would go to idle if the humidifying function is off.

You could then ignore or hide the fan entity.

Alternatively, we could stick everything into a climate entity and get rid of both, fan and humidifier. There is not a single device with arbitrary speed setting, it's always in steps like a preset.

GSzabados commented 3 days ago

The issue with the climate is the focus on temperature control... As I told, trying to push devices into these categories is just an overkill. The previous selector were perfectly good.

kongo09 commented 3 days ago

Are you fine with the double solution of fan plus humidifier?

merquel commented 3 days ago

I could double the presets into the humidifier entity if it exists and also make power true power while for the 2-in-1 devices the state would go to idle if the humidifying function is off.

You could then ignore or hide the fan entity.

For single purpose humidifiers this solution would be ideal.

kongo09 commented 3 days ago

I've now played quite a bit with this but a truly good solution requires quite some rework. I've now at least changed the humidifier entity to control the power. It's thus redundant to the power setting of the fan entity as both do the same thing.

Internally, I've also refactored a little bit to pull the fan modes into the humidifier class. However, pulling this all the way to the frontend created some confusion for 2-in-1 devices as the fan modes are independent from the humidification function and the humidifier mode setting is needed to select between humidifying or not. In consequence, you still need the fan entity to control the fan speed of your humidifier.

But maybe we now have a compromise that can work for everyone?

kongo09 commented 3 days ago

I've merged this in now and did a release. Let's reopen if this isn't practical.

kongo09 commented 3 days ago

Ok, the current implementation is annoying. Having a 2-in-1 device I now have a redundant power setting, which is confusing. Users who only have a humidifier find the fan entity confusing. New plan is the following:

kongo09 commented 3 days ago

I've done a new beta with the plan from above: v0.29.0-beta.1

Please give feedback, especially if you have one of the HU.... devices. You should not get a fan entity anymore.

merquel commented 2 days ago

Nice work, for a single purpose humidifier this is the best solution in my opinion.

Feedback:

I don't know if there is a way to set the icons for the modes though? Only solution I could find is remapping the unsupported modes to the most appropriate from the built in ones:

Screenshot 2024-11-24 at 23 28 58Screenshot 2024-11-24 at 23 19 39

``` elif self._function_key == self._power_key: self._attr_supported_features = HumidifierEntityFeature.MODES key_replacements = { 'high': 'boost', 'medium': 'normal', } self._available_preset_modes = { key_replacements.get(key, key): value for key, value in available_preset_modes.items() } self._attr_available_modes = list(self._available_preset_modes.keys()) ```

Not an ideal approach in any way so it probably shouldn't be used, but it solved it for me temporarily.

kongo09 commented 2 days ago

Interesting. I wasn't even aware that there are icons in the drop-down. Very inconsistent to the preset modes of the fan.

I'll take a look at the rest.

kongo09 commented 23 hours ago

I guess I need to start working on icon translations to get this right: https://developers.home-assistant.io/blog/2024/01/19/icon-translations/

Let's take that to a separate issue: #211

kongo09 commented 40 minutes ago

@merquel : please check if new beta v0.29.0-beta.2 works or if you (or anyone else) spots more bugs. If not, I'll do a proper release and close this issue.