Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
828 stars 67 forks source link

logger.setLevel wrong argument type #172

Closed scmanjarrez closed 2 years ago

scmanjarrez commented 3 years ago

What is the purpose of your issue?

Guideline for bug reports

How to get your version:

amazon-dash --version
python --version
pip --version
easy_install --version

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

I tried to run the amazon-dash command, but didn't complete. The problem is in the cli function. Checking the loglevel variable, the data type is str, but it should be int.

[DEBUG] function cli: loglevel type:  <class 'str'>  | logging.INFO type:  <class 'int'>

What I Did

> amazon-dash hack-device
Welcome to Amazon-dash v1.4.0 using Python 3.7.3
December 31 is the last day to block requests from your Amazon-dash buttons to Amazon servers. In 2020 your buttons can be bricked in an update from Amazon servers.
Traceback (most recent call last):
  File "/usr/local/bin/amazon-dash", line 6, in <module>
    catch(cli)()
  File "/usr/local/lib/python3.7/dist-packages/amazon_dash/exceptions.py", line 103, in wrap
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1134, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1059, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1662, in invoke
    super().invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1401, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 767, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/amazon_dash/management.py", line 110, in cli
    create_logger('amazon-dash', loglevel)
  File "/usr/local/lib/python3.7/dist-packages/amazon_dash/management.py", line 35, in create_logger
    logger.setLevel(level)
  File "/usr/lib/python3.7/logging/__init__.py", line 1358, in setLevel
    self.level = _checkLevel(level)
  File "/usr/lib/python3.7/logging/__init__.py", line 192, in _checkLevel
    raise ValueError("Unknown level: %r" % level)
ValueError: Unknown level: '20'
Nekmo commented 2 years ago

I will check the bug. Thanks!

Nekmo commented 2 years ago

I have tried to reproduce the error without success:

pi@hassbian:~ $ ./tmp_env/bin/amazon-dash hack-device
Welcome to Amazon-dash v1.4.0 using Python 3.7.3
December 31 is the last day to block requests from your Amazon-dash buttons to Amazon servers. In 2020 your buttons can be bricked in an update from Amazon servers.
This command allows you to hack a Amazon-dash device built on May 2016 and earlier. Even if your device was purchased later, it is likely that it has an older firmware installed. 
You only need to use this command if you have never connected your device to Amazon servers in the past.
Sound is used to hack the device (Amazon Dash buttons include a microphone). It is recommended to use earbuds near the button. Remember to turn up the volume on your computer.
To start the hack, place the earbuds and hold the button on your Amazon dash device for 5 seconds until the light blinks blue. Observe the led during the hack.
Is the blue light flashing? [y/N]: 
scmanjarrez commented 2 years ago

Sorry for the delay, I've tested again with a fresh install and doesn't happen... we can close the issue. Also, I've tried reading the doc, but seems like the SSL certificate was revoked.