rgerganov / py-air-control

Command line app for controlling Philips air purifiers
MIT License
260 stars 52 forks source link

--filters issue when using with AC2889 #2

Closed rmoriz closed 5 years ago

rmoriz commented 5 years ago

Thanks for this great tool and reversing the proprietary crap :-)

I've just started using it with the AC2889/10. The filters flag causing an error:

airctrl/airctrl.py $IP -d --filters 

# filters content is:
# {'fltt1': 'A3', 'fltt2': 'C7', 'fltsts0': 360, 'fltsts1': 4800, 'fltsts2': 2400}

# causing:

Pre-filter and Wick: clean in 0 hours
Traceback (most recent call last):
  File "airctrl/airctrl.py", line 267, in <module>
    main()
  File "airctrl/airctrl.py", line 239, in main
    c.get_filters()
  File "airctrl/airctrl.py", line 203, in get_filters
    print('Wick filter: replace in {} hours'.format(filters['wicksts']))
KeyError: 'wicksts'

A3 is the "NanoProtect Filter Series 3" FY2422 (HEPA) , C7 means "NanoProtect Filter AC" FY2420 (activated carbon). The time of "fltsts0" is probably referencing to the user cleanable "prefilter" of the AC2889 which has no humidifier function (so no "wicksts").

rgerganov commented 5 years ago

Thanks a lot for the bug report! I have added a check for the existence of 'wicksts' when dumping the filter status. Please let me know if it works, so I can release a new version on PyPI.

rmoriz commented 5 years ago

Works 👍

Thanks!

(btw: Did you try to get to the SoC physically?)


➜  py-air-control git:(master) python3 airctrl/airctrl.py 10.0.2.58
[pwr]   Power: ON
[pm25]  PM25: 7
[iaql]  Allergen index: 2
[mode]  Mode: auto
[om]    Fan speed: silent
[aqil]  Light brightness: 0
[cl]    Child lock: False

➜  py-air-control git:(master) python3 airctrl/airctrl.py 10.0.2.58 --firmware
{'mandatory': False,
 'name': 'AC2889_10',
 'progress': 0,
 'state': 'idle',
 'statusmsg': '',
 'upgrade': '',
 'version': '14'}

➜  py-air-control git:(master) python3 airctrl/airctrl.py 10.0.2.58 --filters
Pre-filter and Wick: clean in 323 hours
Active carbon filter: replace in 2363 hours
HEPA filter: replace in 4763 hours
rgerganov commented 5 years ago

(btw: Did you try to get to the SoC physically?)

No but I'd love to hear your motivation for this :)

rmoriz commented 5 years ago

I'm not an expert on this matter but most "smart" devices are based on ARM-based chips running linux (or Espressif's ESP SoCs running RTOS). With the ARM based systems usually it's quite simple to find a TTL-UART on the board and usually you get a root shell or at least access to U-Boot (the bootloader).

For example: WiFi IP Webcam, hunderts of different variants available, this one was top 3 on German Amazon

(German blog post at https://blog.rolandmoriz.de/2019/03/03/hikam-s5-populaere-aeltere-china-webcam/ )

Or android running TV boxes from china: https://imgur.com/a/vuRzXrP

Some people at https://www.armbian.com/ also build distros (based on Debian or Ubuntu) so one can use those TV boxes just like "regular hardware" guaranteed free of non-free/open source code.

The Philips ACs seem quite simple (maybe just some digital GPIO?) it may be possible to create a 100% open source firmware or at least find some binaries to binwalk. That said, given they are expensive I wouldn't risk to destroy a "productive" unit. I'll keep my eyes open on eBay for broken/cheap used devices…

rgerganov commented 5 years ago

The Philips ACs seem quite simple (maybe just some digital GPIO?) it may be possible to create a 100% open source firmware or at least find some binaries to binwalk. That said, given they are expensive I wouldn't risk to destroy a "productive" unit. I'll keep my eyes open on eBay for broken/cheap used devices…

This is great idea! I am pretty sure the firmware can be updated and we can exploit this functionality to replace it with open-source firmware and remove the phone-home crap. I will open a new issue to track this.