ddxtanx / GoveeAPI

A python/gatttool API to control Govee lights.
110 stars 17 forks source link

the following arguments are required: mode #7

Closed JAbelP closed 1 year ago

JAbelP commented 2 years ago

I tried running the tool.py (python tool.py) and I got the error mentioned in the title python Documents/HomeWebsite2/backend/backendserver/GooveeApi/tool.py usage: tool.py [-h] [--device DEVICE] [--brightness BRIGHTNESS] [--color COLOR COLOR COLOR] [--period PERIOD] mode I tried the other arguments, but none of these argument help me set up the program, what should I be using to set it all up?

JAbelP commented 2 years ago

I finally found the address using a sniffer on android, but even with the address

python tool.py --color 0 225 0 usage: tool.py [-h] [--device DEVICE] [--brightness BRIGHTNESS] [--color COLOR COLOR COLOR] [--period PERIOD] mode tool.py: error: the following arguments are required: mode

JAbelP commented 2 years ago

I also made this file to try it out more in depth import GoveeController

GoveeController.change_color((0,255,0), 'A4:C1:38:EE:6B:7C')

Traceback (most recent call last): File "/home/pi/Documents/HomeWebsite2/backend/backendserver/GooveeApi/GoveeController.py", line 33, in write_data gatt.expect("Connection successful", timeout=5) File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/spawnbase.py", line 343, in expect return self.expect_list(compiled_pattern_list, File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/spawnbase.py", line 372, in expect_list return exp.expect_loop(timeout) File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/expect.py", line 181, in expect_loop return self.timeout(e) File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/expect.py", line 144, in timeout raise exc pexpect.exceptions.TIMEOUT: Timeout exceeded. <pexpect.pty_spawn.spawn object at 0x766e8d48> command: /usr/bin/gatttool args: ['/usr/bin/gatttool', '-I'] buffer (last 100 chars): b' \x1b[0mconnect to A4:C1:38:EE:6B:7C: Too many levels of symbolic links (40)\r\n[A4:C1:38:EE:6B:7C][LE]> ' before (last 100 chars): b' \x1b[0mconnect to A4:C1:38:EE:6B:7C: Too many levels of symbolic links (40)\r\n[A4:C1:38:EE:6B:7C][LE]> ' after: <class 'pexpect.exceptions.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: False pid: 5156 child_fd: 5 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile(b'Connection successful')

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/pi/Documents/HomeWebsite2/backend/backendserver/GooveeApi/GoveeController.py", line 33, in write_data gatt.expect("Connection successful", timeout=5) File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/spawnbase.py", line 343, in expect return self.expect_list(compiled_pattern_list, File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/spawnbase.py", line 372, in expect_list return exp.expect_loop(timeout) File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/expect.py", line 181, in expect_loop return self.timeout(e) File "/home/pi/Documents/HomeWebsite2/backend/env/lib/python3.9/site-packages/pexpect/expect.py", line 144, in timeout raise exc pexpect.exceptions.TIMEOUT: Timeout exceeded. <pexpect.pty_spawn.spawn object at 0x7673bd48> command: /usr/bin/gatttool args: ['/usr/bin/gatttool', '-I'] buffer (last 100 chars): b' \x1b[0mconnect to A4:C1:38:EE:6B:7C: Too many levels of symbolic links (40)\r\n[A4:C1:38:EE:6B:7C][LE]> ' before (last 100 chars): b' \x1b[0mconnect to A4:C1:38:EE:6B:7C: Too many levels of symbolic links (40)\r\n[A4:C1:38:EE:6B:7C][LE]> ' after: <class 'pexpect.exceptions.TIMEOUT'> match: None match_index: None exitstatus: None flag_eof: False pid: 5258 child_fd: 5 closed: False timeout: 30 delimiter: <class 'pexpect.exceptions.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 searcher: searcher_re: 0: re.compile(b'Connection successful')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/Documents/HomeWebsite2/backend/backendserver/GooveeApi/trial.py", line 3, in GoveeController.change_color((0,255,0), 'A4:C1:38:EE:6B:7C') File "/home/pi/Documents/HomeWebsite2/backend/backendserver/GooveeApi/GoveeController.py", line 49, in change_color write_data(hexstr, addr) File "/home/pi/Documents/HomeWebsite2/backend/backendserver/GooveeApi/GoveeController.py", line 35, in write_data dev = addr_dev_dict[addr] KeyError: 'A4:C1:38:EE:6B:7C'

FuryFiber commented 2 years ago

im not 100% on this because i haven't managed to get it working myself either but:

instead of set you can also use the other options in tool.py: "set", "strobe", "wakeup" the last 2 options do require other arguments which you can find in tool.py

again, this is me just guessing since i haven't managed to get this to work either also, idk if your still trying to make this work since its been over a month but if you are: respect for the dedication

ddxtanx commented 1 year ago

From what I can see in the errors, @FuryFiber is correct; you need to have the right data set in the addr_dev_dict, as well as to specify the mode with which you want to interact with your devices (the specification of set, strobe, or wakeup).