kongo09 / philips-airpurifier-coap

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

Support Request for AMF870/15 #107

Closed Uwe1971R closed 8 months ago

Uwe1971R commented 8 months ago

Dear All,

I woud like to ask if the AMF870 also could be supported. It looks like this system is about the same as the previously added AMF765/10 with additional heating function.

This is what I so far have been able to confirm:

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

Field | Value | Mappping | Comment -- | -- | -- | -- "D01102" | 6 |   |   "D01S03" | "Schlafzimmer" | given name |   "D01S04" | "Pegasus" |   |   "D01S05" | "AMF870/15" | Model Id |   "D01107" | 0 |   |   "D01108" | 3 |   |   "D01109" | 1 |   |   "D0110A" | 0 |   |   "D0110B" | 10 |   |   "D0110C" | 23 |   |   "D0110F" | 3 |   |   "D01S12" | "0.8.6" | Device Firmware |   "D01213" | 0 |   |   "D01R22" | "0.1.5" |   |   "D01223" | 0 |   |   "D01R32" | "0.3.0" |   |   "D01233" | 0 |   |   "D01R42" | "0.4.1" |   |   "D01243" | 0 |   |   "ProductId" | "c19d675e116411ed9acf06d016384e4a" |   |   "DeviceId" | "b6d828ad2bb911eeabc745d46df5561a" |   |   "MCUBoot" | true |   |   "Runtime" | 66543677 |   |   "rssi" | -46 |   |   "wifilog" | false |   |   "free_memory" | 49736 |   |   "WifiVersion" | "AWS_Philips_AIR@78" |   |   "StatusType" | "status" | "control" if Auto+ Mode is activated |   "ConnectType" | "Online" |   |   "D03102" | 1 | On /Off | 1=On, 0=Standby "D03103" | 0 | Child Lock | 1=On, 0=Off "D03106" | 0 |   |   "D0310A" | 2 | System Mode | Fan 1, Circulation 2, Heater 3 "D0310C" | 0 | Fan Mode | Auto=0, Quiet=17, Turbo=18 "D0310D" | 1 | Fan Speed | 1-10 "D0310E" | 20 | Heating Temperature | 1-37 "D0320F" | 0 | Fan Oscillation Angle | 0-350 "D03110" | 0 | Timer | 0=off, 1=30min, 2=1h,…,13=12h "D03113" | 0 |   |   "D03114" | 0 |   |   "D0311F" | 0 |   |   "D03120" | 1 | Allergens Level | 0-12 (IAI) "D03221" | 1 | PM2.5 | µg/m³ "D03122" | 1 | Gas Level | 1-4 (L1-L4) "D03123" | 50 |   |   "D03224" | 169 | Temperature * 10 |   "D03125" | 56 | Humidity % |   "D0312A" | 1 | Preferred Index | 0=Allergene, 1=PM2.5, 2=Gas "D0312B" | 1 | Preferred Index | 0=Allergene, 1=PM2.5, 2=Gas "D0312C" | 10 |   |   "D0312D" | 100 | Brightness | 0-100, steps 10 "D0312E" | 0 |   |   "D0312F" | 0 |   |   "D03130" | 100 | Sound Volume | 0-100 "D03131" | 0 |   |   "D03134" | 1 | Sensors active in Standby | 1=On, 0=Off "D03240" | 0 |   |   "D03180" | 0 | Auto+ Mode | 1=On, 0=Off "D03182" | 1 |   |   "D03R81" | "AwACBAYABAYIAAAAAAAAAAA… etc. |   |   "D05102" | 0 |   |   "D05207" | 720 | Cleaning Pre-Filter Interval |   "D05408" | 14400 | Replacing Main Filter Interval |   "D0520D" | 649 | Cleaning Pre-Filter Remaining hours |   "D0540E" | 10944 | Replacing Main Filter Remaining hours |   } |   |   |  

Is there anything else that I can provide?

Thank's a lot!

kongo09 commented 8 months ago

I'll take a look once the AMF765 works properly

Uwe1971R commented 8 months ago

Great! Thank you!

BTW: The MAC-Address is 84:9D:C2:83:23:A8

kongo09 commented 8 months ago

The AMF765 is now almost working. As a first step, I've used the same settings, which obviously will ignore heating and gas sensor. If that works, I can take the next steps. Please check every setting, both from HA but also from the Philips app and see if HA follows the changes.

Biggest problem with AMF765 was speed setting. It might or might not work for you.

beta is: v0.17-amfcx-beta.17

Uwe1971R commented 8 months ago

Thank's a lot! That is amazing!

After restarting HA the integration was "hanging" at the initializing of my other purifier (AC3033) and I was not able to add the AMF870 manually. Then I started the Philips App and immediately the initializing of the AC3033 completed and I was able to add the AMF870.

image "Device Info" is fine.

image Switches "Auto Plus" and "Standby Sensors" work fine. Every change in HA is seen at the Purifier and the App and vice versa.

Fan On/Off also works fine. Only the speed setting is a bit strange. image The slider shows crazy values. When using the slider in HA, the Purifier and the App will "convert" them to fan-levels like shown in the table below. But changes from the App or the Purifer and the actual status will not be shown in HA.

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">

HA | Purifier -- | -- Slider % | Level 0 | off 9.09 | 1 18.18 | 2 27.27 | 3 36.36 | 4 45.45 | 5 54.55 | 6 63.64 | 7 72.73 | 8 81.82 | 9 90.91 | 10 100 | Turbo

So it is at least somehow possible to change the speed. If the speed of "0%" is chosen (HA), the fan is off. Choosing another % with the slider will not restart the fan. Pressing the On/Off buton (HA) will restart the fan. Setting the Preset Modes with HA is ok, but changing it with App/Device doesn't change anything in HA.

image Sensors are fine. As you mentioned above Gas and PM2.5 are missing.

image "Configuration" works fine. I made a mistake in my data overview about the oscialltion. The allowed values are 30-350 degrees. Any value from 1 to 30 will result in 30.

image Diagnostic also is fine.

That is already much more that I had hoped for!

kongo09 commented 8 months ago

Thanks. The pm2.5 sensor should be there. Can you confirm its data field?

The weird percentage steps for speed seem correct as there are 11 steps and 100 divided by 11 is 9.09. I could leave turbo out and only have that in presets?

The oscillation setting off fine this way by purpose, If I let the slider start at 30, you would lose the zero and it's not possible anymore to switch oscillation off.

Speed and preset control are still a mystery. I can need some help to understand this better.

Uwe1971R commented 8 months ago

image

The PM2.5 really is D03221. I opened a window (a real window to let air in) to get some higher/different values and App / D03221 both show the same fluctuating values (e.g. 6 in the screenshot). What is strange here is that the Allergens Sensor (before) is D03120 and the Gas Sensor (afer) is D03122. so logically the PM2.5 should/could have been expected to be D03121 and not D03221.

For the Fan speed slider it should make sense to remove the Turbo-setting (and keep it in the presets only) and if possible to change the shown slider values from 0 to 10 (or 1 to 10).

It would also be an option to remove the fan speed preset selector from the fan speed button setting and to add it in the "Cotrols" box as a drop-down menu similar to the Function drop down in the Configuration box. image

Uwe1971R commented 8 months ago

I modified this line in const.py and the PM2.5 sensor appeared: NEW2_PM25 = "D03221"

kongo09 commented 8 months ago

Ah, great, that was obviously a bug that also affected the AMF765.

kongo09 commented 8 months ago

please try v0.17-amfcx-beta.18

I fixed the pm2.5 sensor which should now show and also tried to fix preset and speed settings. Please let me know what happens

Uwe1971R commented 8 months ago

PM2.5 sensor works. The fan speed slider works fine and looks so much better. The preset selector also works fine. But Fan-speed slider and preset selector are one-way-settings. My choices will be received by the purifer&app, but chances made at the device or with the app will not be shown in HA. In addition to this the blue slider in HA always disappears immediatly after every selection and the light blue background is shown. So a manually chosen fan-speed (e.g. 40% or 4) is not indicated in HA (only at the device and in the app).

When playing around several times with these settings, the communication to the purifier hangs or stops until the purifier is restarted.

kongo09 commented 8 months ago

So is the one way effect the same as before the last beta?

kongo09 commented 8 months ago

So for the speed, I'm currently setting and reading D0310D and for the preset I'm setting and reading D0310C.

So you are saying, setting works for both, speed and preset. The device reacts when you use the controls in HA. But reading doesn't work and the controls go to some neutral state. Is that true for both, speed and preset? What happens in preset when you change it on the device?

Can you look at the two data fields again and read them both before and after a preset change or a speed change. Does any other data field change at the same time? It feels like we're missing something.

kongo09 commented 8 months ago

The MAC-Address is 84:9D:C2:83:23:A8

I've added this now to autodiscovery for the next beta. Let's see if that works. For many devices it seems to be a question of luck.

Uwe1971R commented 8 months ago

As first test I have only changed the Fan-speed with HA and read out the parameters several times. It looks like the fan-speed is written to D0310D and D0310C simultaneously. At least both cells show the values that I have chosen, but D0310C should not have changed at all when I just change the speed.

Uwe1971R commented 8 months ago

Second test was to change the preset and to read out the registers:

Sleep: D0310C: 17 D0310D: 1

Turbo D0310C: 18 D0310D: 18

Auto D0310C: 0 D0310D: 3

Exactly the same results came out when changing the preset with the App. So this should be ok.

Uwe1971R commented 8 months ago

I have deleted te AMF870 from HA and restarted HA. The AMF870 was detected. Adding took some time, so I opened the app and changed the fan-speed. Same second adding was ok. As written above, I sometimes have the feeling that communication between HA and the purifier hangs and is immediately fixed when I open the app or change a setting...

Anyway: Autodetection is fine.

Uwe1971R commented 8 months ago

Just noticed that the timer-setting of the integration doesn't show the 30 minutes. So if this setting is chosen by the app or the purifier it will not (can not) be shown in HA.

kongo09 commented 8 months ago

new beta: v0.17-amfcx-beta.19

Timer should hopefully be fixed and I've also added all the missing functions. Please check.

Speed and presets still don't work.

kongo09 commented 8 months ago

new beta: v0.17-amfcx-beta.20

I tried to implement your value combination from above for speed and presets. Let me know if this works.

Uwe1971R commented 8 months ago

image

The Gas sensor works well, but the unit shouldn't be shown as µm/m³. Philips only uses L1, L2, L3 or L4 with "L" meaning "Level" without using any units:

WhatsApp Bild 2024-01-22 um 12 53 38_8e6cd7c4

WhatsApp Bild 2024-01-22 um 12 52 38_a223ef5f

Uwe1971R commented 8 months ago

The heater also works fine!

The allowed range of values is 1 to 37. using the slider to choose "0" results in a setting of "1". Choosing abything above 37, results in 37.

Uwe1971R commented 8 months ago

For the "Prefered Index" two control fields are shown now ( D0312A & D0312B). (The top one misses the Gas setting.) If anyof both control fiels is used, the other field gets updated to the same value. I assume that this is done by the purifier.

In that case it should be sufficient to only have one control field, but to write the value to both cells and to just use e.g. D0312A ro read-out the value.

Uwe1971R commented 8 months ago

In the "Configuration" section there is on "greyed out" Function setting and one "greyed out" Timer setting (in addition to the normally working Function setting and Timer setting). image

Uwe1971R commented 8 months ago

The Presets work fine.

If I change a preset with the purifier app, then I do not see a change/updae in the HA integration. This is fine, right?

Uwe1971R commented 8 months ago

The setting (=sending the command to the purifier and acceptance by the purifier) of the fan speed also works fine.. It's only strange that the slider always jums back to 0 immediately after setting the speed.

I have compared the status data after speed changes I made with the purifier App and with the integration. In both cases the data absolutely looks identical. D0310C and D0310D both show the chosen speed value.

kongo09 commented 8 months ago

Philips only uses L1, L2, L3 or L4 with "L" meaning "Level" without using any units:

I removed the wrong units. Should I put an "L" instead as unit, or just show the plain number?

kongo09 commented 8 months ago

The allowed range of values is 1 to 37. using the slider to choose "0" results in a setting of "1". Choosing abything above 37, results in 37.

Not sure if I understand. The slider should only offer 1 to 37 as range. There shouldn't be a zero or anything above 37. Is this working?

kongo09 commented 8 months ago

two control fields are shown now

I've removed one and left the one with the gas setting. Please confirm that this works.

kongo09 commented 8 months ago

"greyed out" Function setting and one "greyed out" Timer setting

This might be a leftover. Please remove them in the interface of HA, they should not come back when you re-install or update the integration.

kongo09 commented 8 months ago

The Presets work fine

from what you write, they're still not fine. If you change them in the app, HA should reflect this.

kongo09 commented 8 months ago

slider always jums back to 0 immediately after setting the speed

This seems to be the same problem as the preset. We can set, but we cannot read, so the slider (and the preset) cannot follow.

Uwe1971R commented 8 months ago

Philips only uses L1, L2, L3 or L4 with "L" meaning "Level" without using any units:

I removed the wrong units. Should I put an "L" instead as unit, or just show the plain number?

Well, if the sensor is named "Gas Level" (and I guess it is) then a "pure" number from 1 to 4 without any "L" should be fine.

kongo09 commented 8 months ago

I had an idea about the presets and speed, please try: v0.17-amfcx-beta.21

Uwe1971R commented 8 months ago

The allowed range of values is 1 to 37. using the slider to choose "0" results in a setting of "1". Choosing abything above 37, results in 37.

Not sure if I understand. The slider should only offer 1 to 37 as range. There shouldn't be a zero or anything above 37. Is this working?

For me slider starts at 0 and ends at 100.

image

image

kongo09 commented 8 months ago

For me slider starts at 0 and ends at 100.

oh, super interesting. Maybe that's the case for other models as well but nobody ever complained... will take a look.

Uwe1971R commented 8 months ago

I had an idea about the presets and speed, please try: v0.17-amfcx-beta.21

When choosing any fan-speed or any preset, the purifier always switches to "Auto"-mode. So it's different, but unfortunately not really better.

Uwe1971R commented 8 months ago

two control fields are shown now

I've removed one and left the one with the gas setting. Please confirm that this works.

Works fine!

kongo09 commented 8 months ago

new beta for a fix of the temperature: v0.17-amfcx-beta.22

kongo09 commented 8 months ago

I had an idea about the presets and speed, please try: v0.17-amfcx-beta.21

When choosing any fan-speed or any preset, the purifier always switches to "Auto"-mode. So it's different, but unfortunately not really better.

Does it follow any change on the app, or does it stay on auto?

Uwe1971R commented 8 months ago

Sorry, no change with beta 22. Changes from the App will be followed by the purifier, but will not be shown in HA. Changes from HA (fan speed or preset) will just make the purifier to change to Auto (or Auto+). This will be visible in the App.

kongo09 commented 8 months ago

I've now introduce debugging around the presets in beta: v0.17-amfcx-beta.23

Please load the integration as usual, enable debugging in the interface, change the presets a few times, disable the debugging and share the log.

Uwe1971R commented 8 months ago

home-assistant_philips_airpurifier_coap_2024-01-22T20-16-55.747Z.log

Now it is possible again that commands from HA reach the Purifier. I chose the presets and fan speeds. HA Turbo is shown as "Turbo" in the App. HA Sleep is shown as "Manual" with Fan Speed 1 in the App HA Auto is shown as "Manual" with Fan Speed 3 in the App.

Uwe1971R commented 8 months ago

home-assistant_philips_airpurifier_coap_2024-01-22T20-26-46.585Z.log

Here I only changed presets and fan speed in the Philips App. No changes were shown in HA.

kongo09 commented 8 months ago

Very interesting, I'll analyse it

kongo09 commented 8 months ago

That was super helpful, I might have found something. Please try beta.23 and send new logs if it still doesn't work

Uwe1971R commented 8 months ago

home-assistant_philips_airpurifier_coap_2024-01-22T20-54-15.226Z.log

Hmmm. This time (beta 24, changing presets and fan speeds in HA) I even get error messages in HA and no impact to the purifer.

Uwe1971R commented 8 months ago

home-assistant_philips_airpurifier_coap_2024-01-22T20-57-36.958Z.log

BUT: Changing presets and fan speeds with the App have an impact in HA and are mostly shown correct.

Sleep and Turbo are shown correct. Auto+ is not shown in HA. Speeds change the slider and it remains at the correct position.

kongo09 commented 8 months ago

Auto+ is not shown in HA.

That should show up as a separate switch? Enabling it, makes the auto mode an auto+ mode. In theory. Do you see that switch?

kongo09 commented 8 months ago

Digging a bit through your data, I see the two speed registers sometimes with different values, e.g.

"D0310C":6
"D0310D":1

So testing against both in the code will not result in a match, so the slider or preset doesn't know where to go. In all logfiles, you have the Auto+ mode enabled, i.e. "D30180":1

Can you explain a bit more how Auto+ works? And what you see happening? In the registers?

I have the feeling that maybe D0310C is responsible for setting speed and preset, while D0310D might just report back what the current state is. And with Auto+, while you might have set speed to 6 (as above), the mode might have regulated it down to 1 (as above). Like an override. So only with Auto+ disabled the two register go in sync, otherwise they disconnect. Could that be?

kongo09 commented 8 months ago

please try v0.17-amfcx-beta.25

this will be my last one for today...