rgerganov / py-air-control

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

Unrecognized argument "ipaddr" #37

Closed FredrikMeyer closed 4 years ago

FredrikMeyer commented 4 years ago

I'm trying to use the package, but it seems something is maybe wrong with the command line parsing.

(.venv)  ~/code/airctrltest  airctrl --ipaddr "10.0.1.10"
usage: airctrl [-h] [-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]
               ipaddr
airctrl: error: unrecognized arguments: --ipaddr
(.venv)  ✘  ~/code/airctrltest  airctrl
usage: airctrl [-h] [-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]
               ipaddr
airctrl: error: the following arguments are required: ipaddr

Perhaps I misunderstand something, but it seems to be that these two error messages contradict each other.

Am I doing something wrong? Thanks!

rgerganov commented 4 years ago

The IP address used to be a mandatory argument in older versions of the program. Now it is an optional argument that can be specified with --ipaddr. If you have installed py-air-control from PyPI then you should specify the IP as mandatory argument. If you use the latest code from Github then it is an option. Sorry for the confusion.

FredrikMeyer commented 4 years ago

Thanks for the answer!

I installed it this way instead: pip3 install git+https://github.com/rgerganov/py-air-control.git, and now I don't get the same error message.

However, I do get a connection refused when running airctrl --ipaddr "10.0.1.8", and if I don't provide the IP, it says that no purifier were found.

I can check the status of the purifier on the Air Matters app, which runs on the same network as my computer. So I'm not sure what to do next.

rgerganov commented 4 years ago

Check if port 80 is open on your device. If it is not, then you most probably have a device which is working over CoAP instead of HTTP. The CoAP protocol is still a work in progress, see issue #35 and issue #21. Contributions are welcome!

FredrikMeyer commented 4 years ago

I see! Thanks for the quick replies, I'll check into it when I have time.