Philips Air Purifier

Awesome! I’ll try it out when i get back home. And if that’s working, all the other commands should be a matter of copy-paste, right?

And also I test it with HomeKit and it works awesome!

2 Likes

Just checked and with your updates i now get the correct state back, i can turn it on and off, and i can change speeds. All work perfectly on my ac3829

Fyi, on my purifier humidifier combi, there is a sensor for water tank level in percents, but it’s either 100% or 0%, so in the frontend you’re better off defining it as “tank empty” with values 100=no and 0=yes

First thanks for creating this! but (i’m sure its me) I can’t seem to get it to work. I have a AC1214 which is connected to the network. But i followed the supplied steps and nothing in HA happens. I don’t see the addon show up anywhere.
What I did was: download the custom component “Philips AirPurifier” and copy the files to HASSIO\config\custom_components. Then restart HA and nothing happens, where do I add the config info? IP etc.
Thanks for any help.

Check the readme on mrvizzy’s github. There’s info on what to add in your config yaml. And that’s of course where you define the ip.

Thanks for pointing that out! I’m new to HA and its non native modules. So I could not figure out where to add the usage info:
fan:
platform: philips_airpurifier
host: Enter_unit_IP

But it’s that simple… just add it to the main configuration yaml file… :slight_smile:

Hey

I followed the instructions and the fan appeares in Hassio.
Put directly on restart of Hassio I hear a sound from the Philips 3259/10. The sound continues to play every 30 seconds, like “ding, ding, ding”.
I dont get any errors i Hassio except the varning about custom integration. What is making the sound?

My Philips 3259 dont have temperature, humidity, water or wick-filter and I also see “function: null” that I apparently dont have.

Another problem: I set the light to OFF/Zero in the mobileapp, Hassio dont register the change until the “30-seconds sound” and Im getting Zero in state light_brightness but Hassio turns the light back on and after another “30-seconds sound” it changes the state back to 100.

I think something is not working with Philips 3259. What to do?

If I remove the code for the fan, Philips 3259 stop acting strange.

Same issue and I also have the 3259, the “beeps” normally occur when the philips app sends a status change. Could it be the app and the home assistant plugin conflict with each other?

I downloaded Wireshark and added Philips as a filter.
Alot of whois as expected
When I change the setting on the app - Wireshark No. 28549-28551 and under Info: 8080 --> 8080 Len=326

“Something” seems to send settings every 30seconds. No. 2993-2996 and under Info: 8080 --> 8080 Len=387 and alot of others in 30seconds gap.

Do someone want to have a look at the saved wireshark-file?
I dont have the knowledge to analyze it.

Can send it or upload somewhere.

Made an issue on this:
https://github.com/xMrVizzy/Philips-AirPurifier/issues/1

Would it be possible to activate the child lock via HASS??

I really don’t know why is broken for you. I will try to change some code but don’t know if it fix your issues

Must be something model specific, mine is working fine (AC3829).
If you’re gonna spend a bit of time on updates, please also add commands to do stuff like:

  • switch mode between purify or purify+humidify
  • set display brightness
  • set target humidity

Just the last bits and pieces so we can really delete the ait matters app completely and control it fully over HA.
Thanks again for your efforts!

Still the same problem… what to do? ----- SOLVED by latest update!

New problem:

This is my testingground for PhilipsAirpurifier - configuration

  - id: 11
    title: Testingground
    #background: center / cover no-repeat url("/local/lovelace/background-15.gif") fixed
    cards:
      - id: 950562a8568415231452144510c71945db  # Automatically created id
        type: vertical-stack
        cards:
          - type: custom:card-modder
            card:
              type: picture-elements
              image: /local/lovelace/philips.png
              elements:
                - icon: 'mdi:fan'
                  style:
                    '--iron-icon-height': 45px
                    '--iron-icon-width': 45px
                    color: dodgerblue
                    left: 10%
                    top: 7%
                    opacity: 0.7
                  tap_action: none
                  type: icon
                - entity: sensor.purifier_speed
                  style:
                    border-color: 'rgb(34, 154, 210)'
                    color: 'rgb(255, 255, 255)'
                    font-family: Trebuchet MS
                    font-size: 90%
                    font-weight: bold
                    opacity: 1
                    pointer-events: none
                    left: 6%
                    text-shadow: 1px 1px black
                    top: 7%
                    transform: 'translate(0%,-50%)'
                  type: state-label
                - icon: 'mdi:bug'
                  style:
                    '--iron-icon-height': 45px
                    '--iron-icon-width': 45px
                    color: dodgerblue
                    left: 10%
                    top: 50%
                  tap_action: none
                  type: icon
                - attribute: allergen_index
                  color_stops: null
                  entity: fan.philips_ac3829
                  fill: 'rgba(0,0,0,0.3)'
                  font_style:
                    color: white
                  gradient: true
                  max: 10
                  min: 0
                  show_card: null
                  stroke_width: 10
                  style:
                    height: 60px
                    left: 10%
                    top: 50%
                    width: 60px
                  type: 'custom:circle-sensor-card'
                - entity: sensor.purifier_brightness
                  prefix: 'Brightness: '
                  style:
                    border-color: 'rgb(34, 154, 210)'
                    border-right-style: solid
                    color: 'rgb(255, 255, 255)'
                    font-family: Trebuchet MS
                    font-size: 90%
                    font-weight: bold
                    opacity: 0.8
                    pointer-events: none
                    right: 1%
                    text-shadow: 1px 1px black
                    top: 95%
                    transform: 'translate(0%,-50%)'
                  type: state-label
                - entity: sensor.purifier_air_quality
                  style:
                    border-color: 'rgb(34, 154, 210)'
                    color: 'rgb(255, 255, 255)'
                    font-family: Trebuchet MS
                    font-size: 90%
                    font-weight: bold
                    left: 46.5%
                    opacity: 1
                    pointer-events: none
                    text-shadow: 1px 1px black
                    top: 17%
                    transform: 'translate(0%,-50%)'
                  type: state-label
                - entity: sensor.purifier_pre_filter
                  prefix: 'Pre-filter: '
                  style:
                    border-color: 'rgb(34, 154, 210)'
                    border-left-style: solid
                    color: 'rgb(255, 255, 255)'
                    font-family: Trebuchet MS
                    font-size: 90%
                    font-weight: bold
                    left: 1%
                    opacity: 0.8
                    pointer-events: none
                    text-shadow: 1px 1px black
                    top: 80%
                    transform: 'translate(0%,-50%)'
                  type: state-label
                - entity: sensor.purifier_carbon_filter
                  prefix: 'Carbon filter: '
                  style:
                    border-color: 'rgb(34, 154, 210)'
                    border-left-style: solid
                    color: 'rgb(255, 255, 255)'
                    font-family: Trebuchet MS
                    font-size: 90%
                    font-weight: bold
                    left: 1%
                    opacity: 0.8
                    pointer-events: none
                    text-shadow: 1px 1px black
                    top: 90%
                    transform: 'translate(0%,-50%)'
                  type: state-label
                - entity: sensor.purifier_hepa_filter
                  prefix: 'HEPA filter: '
                  style:
                    border-color: 'rgb(34, 154, 210)'
                    border-left-style: solid
                    color: 'rgb(255, 255, 255)'
                    font-family: Trebuchet MS
                    font-size: 90%
                    font-weight: bold
                    left: 1%
                    opacity: 0.8
                    pointer-events: none
                    text-shadow: 1px 1px black
                    top: 95%
                    transform: 'translate(0%,-50%)'
                  type: state-label

I can see the picture-element for a second then it dissapears!??? Never encountered this before.

The picture that flashes by is this:

After 1 second I dont see it anymore. Why?

Whats wrong with my code?

I’ve attempted to load the Philips AirPurifier custom component version 0.3.5 via the community on my hassbian venv install, edited configuration.xml

fan:
  platform: philips_airpurifier
  host: 192.168.0.18

it results in the following error:

ERROR (MainThread) [homeassistant.config] Platform error: fan
Traceback (most recent call last):
  File "/srv/ha/lib/python3.7/site-packages/homeassistant/config.py", line 778, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/srv/ha/lib/python3.7/site-packages/homeassistant/loader.py", line 232, in get_platform
    f"{self.pkg_path}.{platform_name}"
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/ha/.homeassistant/custom_components/philips_airpurifier/fan.py", line 1, in <module>
    from Crypto.Cipher import AES
ModuleNotFoundError: No module named 'Crypto'

Should there be something in the manifest requirements or dependencies?

1 Like

I have a problem:

Fri Dec 06 2019 21:48:35 GMT+0100

Error while setting up platform philips_airpurifier
Traceback (most recent call last):
File “/usr/local/lib/python3.7/urllib/request.py”, line 1317, in do_open
encode_chunked=req.has_header(‘Transfer-encoding’))
File “/usr/local/lib/python3.7/http/client.py”, line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/usr/local/lib/python3.7/http/client.py”, line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/usr/local/lib/python3.7/http/client.py”, line 1239, 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 727, 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 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File “/usr/local/lib/python3.7/urllib/request.py”, line 1319, 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 1317, in do_open
encode_chunked=req.has_header(‘Transfer-encoding’))
File “/usr/local/lib/python3.7/http/client.py”, line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/usr/local/lib/python3.7/http/client.py”, line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/usr/local/lib/python3.7/http/client.py”, line 1239, 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 727, 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 150, 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 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File “/usr/local/lib/python3.7/urllib/request.py”, line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 111] Connection refused>

hi Alex, I had the same problem initially, there is one requirement as written in manifest.json:

"requirements": ["pycrypto"]

The problem is solved by installing pycrypto, in my case (manual install) I had to switch to the home assistant user.

sudo -u homeassistant -H -s
cd /srv/homeassistant
python3 -m venv .
source bin/activate

source: https://www.home-assistant.io/docs/installation/raspberry-pi/

than the solution is to install using pip:

pip install pycrypto

That’s it!

Right now I’m trying to find out how to get two Philips air purifiers configured, so far only one is picked up.