Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Aircon to run as standalone server in Debian 10 or Ubuntu 20.x #91

Closed
5bngr opened this issue Apr 12, 2021 · 3 comments
Closed

Comments

@5bngr
Copy link

5bngr commented Apr 12, 2021

Any ideas? Detail below.
System

  • Virtual VM running in Synology
  • 4.19.0-16-amd64 AEH-W4A1 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux
  • Python version 3.7.9

Issue #1 - Discovery doesn't work.

  • Command:
    python -m aircon discovery fglair-us user pass

  • Logs:
    discovery.py:43] Failed to login to Hisense server:
    Status 401: 'Unauthorized'

For testing purposes, I've installed Aircon in windows, copied & pasted the above and the command works. I got 6 config files corresponding to the number of units I have.

Issue #2
As per above, I got around the discovery issue in my debian/ubuntu install, and copied the config files over. But when I try to running the server, it craps out.

  • Command:
    python -m aircon run --port 8888 --config office.json --mqtt_host 158.134.2.56 --mqtt_port 1884 --mqtt_user user:pass --mqtt_client_id mini-split --mqtt_topic fujitsu

  • Logs:
    Apr 12 17:10:17 debian-dev-vm-1 python[27650]: E0412 17:10:17.430 notifier.py:117] [KeepAlive] Sending local_reg failed: 403 (repeats many times)
    Apr 12 17:10:19 debian-dev-vm-1 python[27650]: E0412 17:10:19.291 base_events.py:1619] unhandled exception during asyncio.run() shutdown
    task: <Task finished coro=<Notifier.start() done, defined at /home/devops/projects/fujitsu-mini-split/AirCon-master/aircon/notifier.py:78> exception=RuntimeError('Lock is not acquired.')>
    Traceback (most recent call last):
    File "/home/devops/environments/python/Python-3.7.9/Lib/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
    File "/home/devops/environments/python/Python-3.7.9/Lib/asyncio/base_events.py", line 574, in run_until_complete
    self.run_forever()
    File "/home/devops/environments/python/Python-3.7.9/Lib/asyncio/base_events.py", line 541, in run_forever
    self._run_once()
    File "/home/devops/environments/python/Python-3.7.9/Lib/asyncio/base_events.py", line 1750, in _run_once
    event_list = self._selector.select(timeout)
    File "/home/devops/environments/python/Python-3.7.9/Lib/selectors.py", line 468, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
    KeyboardInterrupt

                                             During handling of the above exception, another exception occurred:
    
                                             Traceback (most recent call last):
                                               File "/home/devops/projects/fujitsu-mini-split/AirCon-master/aircon/__main__.py", line 253, in run
                                                 query_status_worker(devices), notifier.start(session))
                                               File "/home/devops/projects/fujitsu-mini-split/AirCon-master/aircon/notifier.py", line 92, in start
                                                 await asyncio.sleep(self._TIME_TO_HANDLE_REQUESTS)
                                               File "/home/devops/environments/python/Python-3.7.9/Lib/asyncio/locks.py", line 98, in __aexit__
                                                 self.release()
                                               File "/home/devops/environments/python/Python-3.7.9/Lib/asyncio/locks.py", line 218, in release
                                                 raise RuntimeError('Lock is not acquired.')
                                             RuntimeError: Lock is not acquired.
    
@5bngr
Copy link
Author

5bngr commented Apr 15, 2021

After digging around a bit, I was able to make some progress.

  • Discovery now works. The issue was bizarre. my password contains a $0 in it. Looks like that was making the script interpret that part of the password string as something other than a literal string. I this is \S0 and it fixed it. Discovery now works. crazy.

  • The server still doesn't run but I now see where is failing. See tcpdump below. getting a forbidden 403 in response to the post command from the aircon server. Any ideas?

FUJITSU WiFi Adapter:
"model": "AP-WB1E"
"sw_version": "bc 2.6.9

APP LOGS
notifier.py:112] [KeepAlive] Sending POST http://158.134.10.155/local_reg.json {"local_reg": {"ip": "158.134.2.67", "notify": 1, "port": 8080, "uri": "/local_lan"}}
Apr 15 01:36:12 debian9-dev-vm-1 python[29445]: D0415 01:36:12.516 universaldetector.py:234] no data received!
Apr 15 01:36:12 debian9-dev-vm-1 python[29445]: D0415 01:36:12.517 universaldetector.py:271] no probers hit minimum threshold
Apr 15 01:36:12 debian9-dev-vm-1 python[29445]: E0415 01:36:12.519 notifier.py:117] [KeepAlive] Sending local_reg failed: 403,

TCPDUMP LOGS
tcpdump: listening on ens3, link-type EN10MB (Ethernet), capture size 262144 bytes
01:31:54.143062 IP (tos 0x0, ttl 64, id 58071, offset 0, flags [DF], proto TCP (6), length 60)
debian9-dev-vm-1.xxxx.crib.52330 > 158.134.10.155.http: Flags [S], cksum 0x4a19 (incorrect -> 0xca56), seq 4161884782, win 29200, options [mss 1460,sackOK,TS val 1288800 ecr 0,nop,wscale 7], length 0
01:31:54.146471 IP (tos 0x0, ttl 253, id 65129, offset 0, flags [none], proto TCP (6), length 44)
158.134.10.155.http > debian9-dev-vm-1.xxxx.crib.52330: Flags [S.], cksum 0xc6b4 (correct), seq 99244421, ack 4161884783, win 4608, options [mss 1152], length 0
01:31:54.146498 IP (tos 0x0, ttl 64, id 58072, offset 0, flags [DF], proto TCP (6), length 40)
debian9-dev-vm-1.xxxx.crib.52330 > 158.134.10.155.http: Flags [.], cksum 0x4a05 (incorrect -> 0x7d2d), seq 1, ack 1, win 29200, length 0
01:31:54.147314 IP (tos 0x0, ttl 64, id 58073, offset 0, flags [DF], proto TCP (6), length 258)
debian9-dev-vm-1.jxxxx.crib.52330 > 158.134.10.155.http: Flags [P.], cksum 0x4adf (incorrect -> 0xe953), seq 1:219, ack 1, win 29200, length 218: HTTP, length: 218
POST /local_reg.json HTTP/1.1
Host: 158.134.10.155
Accept: application/json
Connection: keep-alive
Content-Type: application/json
Accept-Encoding: gzip
User-Agent: Python/3.7 aiohttp/3.7.4
Content-Length: 85

01:31:54.147510 IP (tos 0x0, ttl 64, id 58074, offset 0, flags [DF], proto TCP (6), length 125)
debian9-dev-vm-1.xxxx.crib.52330 > 158.134.10.155.http: Flags [P.], cksum 0x4a5a (incorrect -> 0x4441), seq 219:304, ack 1, win 29200, length 85: HTTP
01:31:54.156518 IP (tos 0x0, ttl 253, id 65130, offset 0, flags [none], proto TCP (6), length 66)
158.134.10.155.http > debian9-dev-vm-1.xxxx.crib.52330: Flags [P.], cksum 0xbca4 (correct), seq 1:27, ack 304, win 4305, length 26: HTTP, length: 26
HTTP/1.1 403 Forbidden

@5bngr 5bngr closed this as completed Apr 16, 2021
@5bngr
Copy link
Author

5bngr commented Apr 16, 2021

Code now runs but with errors. re-opening as a different issue.

@deiger
Copy link
Owner

deiger commented Apr 16, 2021

Glad you managed to resolve this. The issue is with bash (or zsh) resolving arguments. Single quotes should prevent that:

$ echo $0
-bash
$ echo '$0'
$0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants