rgerganov / py-air-control

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

move ~/.pyairctrl #7

Closed markuslaube closed 5 years ago

markuslaube commented 5 years ago

Hello,

i´m not a software developer and i have a small wish:

Thanks Markus

rgerganov commented 5 years ago

Thanks for the bug report! I will keep a single file but store session keys along with the device IP, so we can support multiple devices.

markuslaube commented 5 years ago

cool! Thanks for you Support ;)

rgerganov commented 5 years ago

@markuslaube I have added support for multiple keys in the config file. Can you pull the latest code from github and verify? I will upload to PyPI a new version after that.

markuslaube commented 5 years ago

@rgerganov: works fine, after delete the old /$HOME/.pyairctrl

before delete old file: usr/local/bin/airctrl 172.16.2.124 Traceback (most recent call last): File "/usr/local/bin/airctrl", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/airctrl/airctrl.py", line 241, in main c.load_key() File "/usr/local/lib/python3.5/dist-packages/airctrl/airctrl.py", line 82, in load_key config.read(fpath) File "/usr/lib/python3.5/configparser.py", line 696, in read self._read(fp, filename) File "/usr/lib/python3.5/configparser.py", line 1077, in _read raise MissingSectionHeaderError(fpname, lineno, line) configparser.MissingSectionHeaderError: File contains no section headers. file: '/root/.pyairctrl', line: 1 'xxxxxxxxxxxxxxxx'

move File : # mv /root/.pyairctrl /root/.pyairctrl.sic after:

# /usr/local/bin/airctrl 172.16.2.120
Exchanging secret key with the device ...
Saving session_key xxxxxxxxxxxxxxxxx to /root/.pyairctrl
[pwr]   Power: ON
[pm25]  PM25: 13
[iaql]  Allergen index: 3
[mode]  Mode: manual
[om]    Fan speed: silent
[aqil]  Light brightness: 0
[cl]    Child lock: False
#
# /usr/local/bin/airctrl 172.16.2.124
Exchanging secret key with the device ...
Saving session_key xxxxxxxxxxxx to /root/.pyairctrl
[pwr]   Power: ON
[pm25]  PM25: 1
[iaql]  Allergen index: 4
[mode]  Mode: allergen
[om]    Fan speed: 2
[aqil]  Light brightness: 0
[cl]    Child lock: False
#

after initial connect:

root@berry:~# /usr/local/bin/airctrl 172.16.2.120
[pwr]   Power: ON
[pm25]  PM25: 13
[iaql]  Allergen index: 4
[mode]  Mode: manual
[om]    Fan speed: silent
[aqil]  Light brightness: 0
[cl]    Child lock: False
root@berry:~# /usr/local/bin/airctrl 172.16.2.124
[pwr]   Power: ON
[pm25]  PM25: 2
[iaql]  Allergen index: 1
[mode]  Mode: allergen
[om]    Fan speed: 1
[aqil]  Light brightness: 0
[cl]    Child lock: False
root@berry:~#