Philips Air Purifier

I’ve tried to debug the application -only with tcpdump yet-, it seems it communicates with the purifier only over UDP (coap) and mostly with amazonaws over TCP. The coap communication seems to be not encrypted and it seems it asks the device to send the /sys/dev/status and sometimes does something with /sys/dev/sync (I don’t know the protocol very well yet).The TCP is https so I’m afraid I can’t do much more analyzing without reverse engineering the application which for I don’t have proper tools. It seems I can’t use the device when I have no internet. Next I’ll try to catch the communication of the purifier too but I don’t have too much hope and thinking on sending back the purifier.

Any progress? When I add
fan:
platform: philips-airpurifier
host: 192.168.x.x
To my config.yaml I get:
Platform error fan.philips-airpurifier - Integration ‘philips-airpurifier’ not found.

Hi!
Is there anyway to control the attribute light_brightness through automation? I have the 3259/10.
The idea is to turn off the “led-ring” light during the night and turn it back on in the morning, we have our airpurifier in the bedroom. I’ve made an input_select to trigger from lovelace card, and an automation to set the attribute to the device, but I can’t get the device to change brightness via Hass.
I know that the “service: fan.turn_on” in the automation is incorrect - was trying out different things!

    name: 0 till 100 kvarter
    options:
      - 0
      - 25
      - 50
      - 75
      - 100
    initial: 100
- id: 'philips_3259_lamp_ljusstyrka'
  alias: ÄndraLjusStyrkaPhilipsAirPurifier
  initial_state: 'on'
  trigger:
  - platform: state
    entity_id: input_select.kvarter
  action:
  - entity_id: fan.philips_airpurifier
    service: fan.turn_on
    data_template:
      light_brightness: "{{states.input_select.kvarter.state | int}}"

I also get this notification:

Platform error fan.philips_airpurifier - Integration ‘philips_airpurifier’ not found.

Where could be the problem?

What model airpurifier do you have and did you install the fan.philips_airpurifier integration through github or HACS ? Installed correctly?

config (dir)
| custom_components
| | philips-airpurifier
| | | __pycache__
| | | __init__
| | | fan
| | | manifest
1 Like

I noticed that there are 2 folders in my my custom components. philips-airpurifier and philips_airpurifier (hyphen vs.underscore). That was causing issues for me, maybe you have a similar issue.

Hello, thanx for quick response…

Yes all files are here, i don’t know what was the problem, i had to make full reset of my SD.
Now i did philips-airpurifier install via HACS. And now it has no “platrorm error”. but…
I’m getting this type of errors now: (i’m using home assistant -hassio- installed on Raspbian via Docker)

Error while setting up philips-airpurifier platform for fan
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/urllib/request.py", line 1319, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/http/client.py", line 938, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.7/socket.py", line 728, in create_connection
    raise err
  File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/philips-airpurifier/fan.py", line 259, in _get
    return self._get_once(url)
  File "/config/custom_components/philips-airpurifier/fan.py", line 252, in _get_once
    with urllib.request.urlopen(url) as response:
  File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1347, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1321, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/urllib/request.py", line 1319, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/http/client.py", line 938, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.7/socket.py", line 728, in create_connection
    raise err
  File "/usr/local/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 159, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/philips-airpurifier/fan.py", line 56, in setup_platform
    add_devices([PhilipsAirPurifierFan(hass, config)])
  File "/config/custom_components/philips-airpurifier/fan.py", line 84, in __init__
    self.update()
  File "/config/custom_components/philips-airpurifier/fan.py", line 90, in update
    filters = self._get(url)
  File "/config/custom_components/philips-airpurifier/fan.py", line 261, in _get
    self._get_key()
  File "/config/custom_components/philips-airpurifier/fan.py", line 241, in _get_key
    with urllib.request.urlopen(req) as response:
  File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1347, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1321, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

just in case - check a bit earlier in this conversation about checking the device type - there seems to be more than one. Has it ever worked in Home assistant? If not the connection refused may indicate it’s the different device type that the integration doesn’t currently support.

My model is PHILIPS AC3829/10 (WIFI)
And it’s first time i’m trying to connect it to HA.

does the MICO hostname show up in your DHCP? If it does that’s one that doesn’t work with the current implementation

1 Like

Yes, MiCO :frowning:

well according to https://github.com/xMrVizzy/philips-airpurifier/issues/6 the writer seems to indicate they’ll update it to work with COAP (which I believe is the one your air purifier uses)… That was 8 days ago, so here’s hoping for you :slight_smile:

IFAIK the COAP version is allready available. Check this:

Tried this already, with no success.
But maby in short future it will work. :slight_smile:

Hi There,
I have Home Assisntant installed on Synology via Docker. I have managed to install HACS and via this I manage to install Philips AirPurifier (with CoAP) ( Authors: shexbeer)
I have read that some component needs to be installed also: Replace pycrypto with pycryptodome.
Can somebody help me how to do it on Synology with HA in docker?
Current situation is that module for AirPurifier is installed but I do not see anything in Home Assisntant (I have updated also configuration.yaml with:
fan:
platform: philips-airpurifier
host: 192.168.100.36
protocol: 2

Good find! I thought the requirements file manifest.json specified what components should be installed (which includes coapthon3 and pycryptodome). Is there anything in the logs about it loading the component?

Thanks, the logs are empty. I have there only warning that component is from HACS. Nothing really interesting.

so you got something specifying that you are using the air-purifier in particular (mine is showing this on the original component, and i’m on the hass core) e.g.

WARNING (MainThread) [homeassistant.loader] You are using a custom integration for philips-airpurifier which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

Yeah this is that message what I see there also. But that is it. I do not see air purifier in home assistant at all.

hmmm, well when I had a problem previously with pycrypto it did show an error in the logs, which makes me think it has loaded it, have you checked in developer tools -> states, and use the search for “fan”?