seydx / homebridge-philipsair-platform

Homebridge plugin for philips air purifier and humidifier.
MIT License
26 stars 15 forks source link

[Multiple BUGs] - Not all speed options available [Model Phillips AC4236/10] #40

Open ghost opened 2 years ago

ghost commented 2 years ago

Overview - The slider problem

The device AC4236/10 has the following speed options (don't ask me why):

Speed options day mode:

Speed options night mode:

The "problem(s)"

Expected behavior Since Philips air purifiers have different speed options in older and newer models this may be the cause. At 80% or at least over 51% the air purifier should work at maximum speed. The automatic mode should be working via manual/automatic switch.

The solution

Activating debbuger mode shows the following API output of my device with Homekit device slider at 100%:

[DEBUG] Philips: {"name": "XXXX", "type": "AC4236", "modelid": "AC4236/14", "swversion": "Ms4406", "language": "EN", "DeviceVersion": "4.0.6", "range": "MarteHE", "Runtime": 7517029, "WifiVersion": "AWS_Philips_AIR@64.3", "ProductId": "XXXXX", "DeviceId": "XXXXX", "StatusType": "control", "ConnectType": "Online", "om": "2", "pwr": "1", "cl": false, "aqil": 100, "uil": "1", "uaset": "P", "mode": "M", "pm25": 1, "iaql": 1, "aqit": 7, "tvoc": 1, "ddp": "1", "rddp": "1", "err": 0, "fltt1": "A3", "fltt2": "none", "fltsts0": 662, "fltsts1": 4800, "fltsts2": 65535, "filna": "AC3036", "filid": "XXXXX", "flttotal0": 720, "flttotal1": 4800, "flttotal2": 65535}

At least for my device these are the correct strings:

Turbo mode (day):

{"name": "XXXX", ...., "om": "t", "pwr": "1", "cl": false, "aqil": 100, "uil": "1", "uaset": "P", "mode": "T", ...}

"om": "t",
"mode": "T"

Automatic mode (day):

{"name": "XXXX", ...., "om": "s", "pwr": "1", "cl": false, "aqil": 100, "uil": "1", "uaset": "P", "mode": "AG", ....}

"om": "s",
"mode": "AG"

Silent mode (night)

{"name": "XXXX", ...., "om": "s", "pwr": "1", "cl": false, "aqil": 0, "uil": "0", "uaset": "P", "mode": "S", ....}

"om": "s",
"mode": "S"

Allergic sleep mode (night)

{"name": "XXXX", ...., "om": "as", "pwr": "1", "cl": false, "aqil": 0, "uil": "0", "uaset": "P", "mode": "AS", ....}

"om": "as",
"mode": "AS"

Air quality

A further air quality value is "tvoc" (device has no temperature or humidity sensors).

Filter Life Level

As with everyone else, the problem with fltsts[0-2]life divisor arises for me. The solution has already been presented with flttotal[0-2]... My device does not have any second filter. So the assumption of @ideabucket could be correct.

Environment

Conclusion

Please don't get me wrong, your plugin is great and super responsive. Thanks for all your kick-ass work in this project. 👍 🥇 Maybe you can implement these small improvements in your plugin e.g. by getting "type" or "modelid". Thanks a lot!

ideabucket commented 2 years ago

I've been trying to figure out how to model all the possible config states of recent purifier models using HomeKit's rather limited set of characteristics off and on for a while now, so I thought I'd chime in and braindump what I have so far.

As best I can break it down there are four different characteristics that need to be modeled:

One option would be to model all five of the speed options as percentages on the RotationSpeed characteristic:

Then you just need a TargetAirPurifierState characteristic to differentiate between Auto and Manual.

However I think this is a bad idea; first, it's brittle (what happens if there's a new model with more than three Day speeds?), and second, there's no way of communicating the speed scale in the Home app UI since there's no way I'm aware of to give RotationSpeed levels names.

IMO a better approach would be something similar to what's done in lukasroegner/homebridge-dyson-pure-cool, and expose extra switch accessories to control night mode, so you'd have:

This is what I plan to try to put together as a PR if I get the chance, but I'd welcome somebody else stealing the idea and doing all the work instead…

andycylam commented 2 years ago

My om is set to a and this plugin always says This plugin generated a warning from the characteristic 'Rotation Speed': characteristic value expected valid finite number and received "NaN" (number). See https://homebridge.io/w/JtMGR for more info.