rgerganov / py-air-control

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

add SSDP autodiscovery for uPnP #25

Closed slodki closed 4 years ago

slodki commented 4 years ago

This makes ipaddr command line parameter optional - it will run SSDP autodiscovery (UPnP) if not set. Commands will be send to all detected devices. Old behavior is still available using ipaddr optional parameter.

usage: airctrl.py [-h] [--ipaddr IPADDR] [-d] [--om {1,2,3,s,t}] [--pwr {0,1}]
                  [--mode {P,A,S,M,B,N}] [--rhset {40,50,60,70}]
                  [--func {P,PH}] [--aqil {0,25,50,75,100}] [--uil {0,1}]
                  [--ddp {0,1}] [--dt {0,1,2,3,4,5}] [--cl {True,False}]
                  [--wifi] [--wifi-ssid WIFI_SSID] [--wifi-pwd WIFI_PWD]
                  [--firmware] [--filters]
$ ./pyairctrl/airctrl.py --firmware -d
[['192.168.102.69', 'AirPurifier', 'AC2729', 'dom']]
{'mandatory': False,
 'name': 'AC2729_10',
 'progress': 0,
 'state': 'idle',
 'statusmsg': '',
 'upgrade': '',
 'version': '8'}

Hint: SSDP uses 1900 UDP port and will not work if it's blocked.