Philips Air Purifier

My experience with the py-air-control and the Philips Air Purifier/Humidifier what I have and the coap protocol, that the device wasn’t really designed for this kind of communication and for continuous polling.
I have seen that the device is not returning any reply, or stuck and not doing anything anymore when interogated by py-air-control. And unfortunately, there isn’t any option to define push type updates to a user defined server.

Maybe try to reduce the poll rate to something like 30 sec or 60 sec, or even longer, like 180, 300 sec.

Hi,

That is interesting, i’ve used your (partial) method and my “config” now says that:

Invalid config for [fan.philips-airpurifier]: [protocol] is an invalid option for [fan.philips-airpurifier]. Check: fan.philips-airpurifier->protocol. (See ?, line ?).

But when im trying to check it from
airctr --ipaddr xxx.xxx.xxx.xxx --protocol coap

Im gettig full list of working comunicaton with my device (yey!) and i can control this with command line (by rgerganov/py-air-control script)

So, any idea how to fix this “[protocol] is an invalid” situation?

— edit —
I got rid of all previous versions, deleted old folders, uninstalled modules in HACS, reset the whole virtual machine, reinstalled a new CoAP @shexbeer module from scratch, it went smoothly this time.

— edit —
but no luck at all, or i’m missing something, using @shexbeer method my AC3829/50 is not getting any info from it to HA, fan.philips_airpurifier state now is unknown (using coap protocol -3)

I’m not having any luck with my " Philips AC3033/30 Expert Series 3000i Connected Air Purifier" either, using Raspberry Pi 4. Also tried it in a virtual machine instance. Don’t know how to proceed in investigations anymore. Tried mainly the @shexbeer 's version but also couple others. I’ve also done the pip3 install -U git+https://github.com/Tanganelli/CoAPthon3@89d5173 command in terminal.

The airctrl works in another Raspberry Pi 4 (no Home Assistant in it), albeit as mentioned here, the connection is not reliable. If you spam a command it will sometimes give the “No payload” answer. Here is my example reply:

pi@rasbpianserver:~ $ airctrl --ipaddr 192.168.1.118 --protocol coap
[name]                        Name: Hallway
[type]                        Type: AC3033
[modelid]                     ModelId: AC3033/30
[swversion]                   Version: Ms3105
[language]                    language: EN
[DeviceVersion]               DeviceVersion: 0.0.0
[om]                          Fan speed: 1
[pwr]                         Power: ON
[cl]                          Child lock: False
[aqil]                        Light brightness: 100
[uil]                         Buttons light: ON
[uaset]                       uaset: P
[mode]                        Mode: AG
[pm25]                        PM25: 24
[iaql]                        Allergen index: 5
[aqit]                        Air quality notification threshold: 4
[tvoc]                        Total volatile organic compounds: 1
[ddp]                         Used index: PM2.5
[rddp]                        rddp: 1
[fltt1]                       HEPA filter type: NanoProtect Filter Series 3 (FY2422)
[fltt2]                       Active carbon filter type: none
[fltsts0]                     Pre-filter and Wick: clean in 278 hours
[fltsts1]                     HEPA filter: replace in 4464 hours
[fltsts2]                     Active carbon filter: replace in 65535 hours
[filna]                       filna: 0
[filid]                       filid: 0
[ota]                         Over the air updates: no
[Runtime]                     Runtime: 7.86 hours
[WifiVersion]                 WifiVersion: [email protected]
[ProductId]                   ProductId: xxx
[DeviceId]                    DeviceId: xxx
[StatusType]                  StatusType: localcontrol
[ConnectType]                 ConnectType: Localcontrol

(^ However, the speed commands don’t really seem to work with that , or I’m trying to misuse them.)

Any ideas? Many people seem to be having problems with these 2020+ year models.

This is what comes to core log in Home assistant:

2020-11-02 23:58:37,254 - Thread-3   - coapthon.client.coap - DEBUG - receive_datagram - From ('192.168.1.118', 5683), To None, CON-6013, CONTENT-None, [Observe: 758, Content-Type: 50, Max-Age: 60, ] A786B53356E5E92ED7A0...1140 bytes
2020-11-02 23:58:37,254 - Thread-3   - coapthon.layers.messagelayer - DEBUG - receive_response - From ('192.168.1.118', 5683), To None, CON-6013, CONTENT-None, [Observe: 758, Content-Type: 50, Max-Age: 60, ] A786B53356E5E92ED7A0...1140 bytes
2020-11-02 23:58:37,255 - Thread-3   - coapthon.layers.messagelayer - DEBUG - send_empty - From None, To None, ACK-None, EMPTY-None, [] No payload
2020-11-02 23:58:37,255 - Thread-3   - coapthon.client.coap - DEBUG - send_datagram - From None, To ('192.168.1.118', 5683), ACK-6013, EMPTY-None, [] No payload
2020-11-02 23:58:37,255 - Thread-3   - coapthon.layers.messagelayer - DEBUG - send_empty - From None, To None, ACK-None, EMPTY-None, [] No payload
2020-11-02 23:58:37,255 - Thread-3   - coapthon.client.coap - DEBUG - send_datagram - From None, To ('192.168.1.118', 5683), ACK-6013, EMPTY-None, [] No payload

and here same as others before:
Entity:

fan.philips_airpurifier

State:

unavailable

And my diagnostics info:

App:
Name: Clean Home+
App Version: 2.1.1
Mobile Platform: Android 10 (29)  OnePlus GM1920
Location: xxx
Time Zone: Europe/Lisbon
Backend: Production-ROW
ID = ahc:id=xxx
U = null
Region: PT

Appliance:
Appliance Name: Hallway
ID: xxx
Paired: true
Firmware Version: [email protected]
Device Version: Ms3105
Model: AC3033 - AC3033/30
Local Connected: true .
Remote Connected: true .
Status: Localcontrol .

Do you know how to reduce the poll rate?

Unfortunately, I don’t know how you can reduce it for a custom component.

This topic gives some ideas, but it seems the custom component’s code has to handle it to be able to call from the configuration.

II managed it by adding scan_interval: 300 to the fan configuration in the yaml file. But all what I now get are just fewer warning messages in the new poll period :smiley:

2020-11-03 08:26:16 WARNING (SyncWorker_26-Retry-47934) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47934, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 08:31:37 WARNING (SyncWorker_47-Retry-47936) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47936, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 08:36:37 WARNING (SyncWorker_10-Retry-47938) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47938, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 08:41:35 WARNING (SyncWorker_34-Retry-47940) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47940, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 08:46:35 WARNING (SyncWorker_5-Retry-47942) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47942, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 08:51:21 WARNING (SyncWorker_24-Retry-47944) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47944, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 08:56:38 WARNING (SyncWorker_12-Retry-47946) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47946, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 09:01:25 WARNING (SyncWorker_1-Retry-47948) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47948, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 09:06:39 WARNING (SyncWorker_9-Retry-47950) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47950, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload
2020-11-03 09:11:26 WARNING (SyncWorker_40-Retry-47952) [coapthon.client.coap] Give up on message From None, To ('192.168.1.26', 5683), CON-47952, GET-None, [Uri-Path: sys, Uri-Path: dev, Uri-Path: status, Observe: 0, ] No payload

Try airctrl manually. Does the Air Purifier reports anything back? It might be just a side effect of a set of poll requests at once, and one just doesn’t get something.

If it is not updating or you cannot get any reply manually, then just unplug the Air Purifier for a few minutes and plug it back. That might solve your problem.

With airctrl manually I can send this command as often as I want without any errors, it always reports all sensors back correctly:

bash-5.0# airctrl --ipaddr 192.168.1.26 --protocol coap                                                                                         
[name]                        Name: Luftreiniger Wohnzimmer                                                                                     
[type]                        Type: AC2729                                                                                                      
[modelid]                     ModelId: AC2729/10                                                                                                
[swversion]                   Version: 0.2.1
[om]                          Fan speed: silent                                                                                                 
[pwr]                         Power: ON                                                                                                         
[cl]                          Child lock: False                                                                                                 
[aqil]                        Light brightness: 30                                                                                              
[uil]                         Buttons light: ON                                                                                                 
[mode]                        Mode: auto                                                                                                        
[func]                        Function: Purification & Humidification                                                                           
[rhset]                       Target humidity: 50                                                                                               
[rh]                          Humidity: 57                                                                                                      
[temp]                        Temperature: 22                                                                                                   
[pm25]                        PM25: 11                                                                                                          
[iaql]                        Allergen index: 3                                                                                                 
[aqit]                        Air quality notification threshold: 7                                                                             
[ddp]                         Used index: IAI                                                                                                   
[rddp]                        rddp: 0                                                                                                           
[wl]                          Water level: 100                                                                                                  
[fltt1]                       HEPA filter type: NanoProtect Filter Series 3 (FY2422)                                                            
[fltt2]                       Active carbon filter type: NanoProtect Filter AC (FY2420)                                                         
[fltsts0]                     Pre-filter and Wick: clean in 314 hours                                                                           
[fltsts1]                     HEPA filter: replace in 4754 hours                                                                                
[fltsts2]                     Active carbon filter: replace in 4754 hours                                                                       
[wicksts]                     Wick filter: replace in 4754 hours                                                                                
[range]                       range: MicroMario                                                                                                 
[Runtime]                     Runtime: 22.16 hours                                                                                              
[WifiVersion]                 WifiVersion: [email protected]                                                                                 
[ProductId]                   ProductId: 85bc26fae63611e8a1e3061302926720                                                                       
[DeviceId]                    DeviceId: 12f027641c5011eba44ebe148dc7e387                                                                        
[StatusType]                  StatusType: localcontrol                                                                                          
[ConnectType]                 ConnectType: Localcontrol                                                                                         
bash-5.0#  

That is really odd. Actually there is an open issue just like yours.

hm I dont think this is related, because when using airctrl I dont get any errors at all. It just works, even if I fire the command each second.

Are you doing it from the same device (HA)?

The issue is the empty packets are not handled in the CoAPthon3, which throws those errors.

Try to have on the log file, what the airctrl generates. It should be saved somewhere, I have no idea where. Or set it in the logging.conf file of the CoAPthon3 to see what exactly happening.

yes I am doing right from the console in the docker container.

I have switched now to command_line switches which just works:

- platform: command_line
  switches:
    luftreiniger:
      command_on: "airctrl --ipaddr 192.168.1.26 --protocol coap --pwr 1"
      command_off: "airctrl --ipaddr 192.168.1.26 --protocol coap --pwr 0"
      command_state: "airctrl --ipaddr 192.168.1.26 --protocol coap | grep Power | sed 's/^.*: //'"
      value_template: '{{ value == "ON" }}'
      friendly_name: Luftreiniger

too bad that the custom component does not work and that the further development stocks. hopefully this changes in near future :wink:

1 Like

That is genious :slight_smile:
How do you “engage” those commnads, using “button” or service?

I am using this switch in automations for turning it automatically on in the morning and off in the night.

Maybe it was not trivial just for me but a kind of good to know for those who has similar issue:

  • if you are running HA in a docker
  • using @shexbeer source
  • and have a device that can only work with ‘protocol 3’ aka the encrypted CoaP version
  • consider to update coapthon3 version to a modified one as a post step inside the container, or a build a new image, or…
pip3 install -U git+https://github.com/Tanganelli/CoAPthon3@89d5173

With that step everything showed up perfectly like a charm :slight_smile:

Ref: https://github.com/rgerganov/py-air-control

I tried it several times, but I got this error:

pi@HomeAssistant:~ $ pip3 install -U git+https://github.com/Tanganelli/CoAPthon3@89d5173
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting git+https://github.com/Tanganelli/CoAPthon3@89d5173
  Cloning https://github.com/Tanganelli/CoAPthon3 (to revision 89d5173) to /tmp/pip-req-build-yye592x4
  Did not find branch or tag '89d5173', assuming revision or ref.
Building wheels for collected packages: CoAPthon3
  Running setup.py bdist_wheel for CoAPthon3 ... error
  Complete output from command /home/pi/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-yye592x4/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-id71w6_w --python-tag cp37:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for CoAPthon3
  Running setup.py clean for CoAPthon3
Failed to build CoAPthon3
Installing collected packages: CoAPthon3
  Found existing installation: CoAPthon3 1.0.1
    Uninstalling CoAPthon3-1.0.1:
      Successfully uninstalled CoAPthon3-1.0.1
  Running setup.py install for CoAPthon3 ... done
Successfully installed CoAPthon3-1.0.1

Hello,
probably you need the python3-wheel package on your server:
python3-wheel: /usr/lib/python3/dist-packages/wheel/bdist_wheel.py

btw. for me the component doesn’t work correctly, idk why. If I load the component even the logging stops. I use other custom component which are working perfectly but if I copy this one to the custom_component directory and restart homeassistant the logging stops and everything else -but the airpurifier- works perfectly.

Thank you. I already have it. Maybe the version incorrect?

Add into /config/ui-lovelace.yaml

- title: Airpurifier Philips AC2729
icon: mdi:airpurifier
cards:
    - type: entities
    entities:          
        - entity: switch.airpurifier
        name: On/Off Airpurifier Philips AC2729

And same for sensors:

sensor:
  - platform: command_line
    name: air_airpurifier_humidity
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [rh] | sed 's/^.*: //'"
    unit_of_measurement: "%"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_temperature
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [temp] | sed 's/^.*: //'"
    unit_of_measurement: "°C"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_pm25
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [pm25] | sed 's/^.*: //'"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_allergen_index
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [iaql] | sed 's/^.*: //'"
    unit_of_measurement: "AQI"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15
  - platform: command_line
    name: air_airpurifier_water_level
    command: "airctrl --ipaddr 192.168.0.4 --protocol coap | grep [wl] | sed 's/^.*: //'"
    value_template: '{{ value }}'
    scan_interval: 60
    command_timeout: 15