Skip to content

Commit

Permalink
Get rid of numpy
Browse files Browse the repository at this point in the history
Add timestamps to logging
  • Loading branch information
Nama committed Apr 7, 2021
1 parent f5de41a commit 5f825ab
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ArtemisRemoteControl.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ a = Analysis(['run.py'],
pathex=['C:\\Users\\Yama\\Documents\\Python\\ArtemisRemoteControl'],
binaries=[],
datas=[],
hiddenimports=['numpy', 'artemisremotecontrol', 'artemisremotecontrol.config'],
hiddenimports=['artemisremotecontrol', 'artemisremotecontrol.config'],
hookspath=[],
runtime_hooks=[],
excludes=[],
Expand Down
2 changes: 1 addition & 1 deletion artemisremotecontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from os import environ
from json import loads, dumps

logging.basicConfig(filename='error.log', level=logging.WARNING)
logging.basicConfig(filename='error.log', format='%(asctime)s %(levelname)s:%(message)s', level=logging.WARNING)


def _getapiurl(ep):
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
requests>=2.25.1
simple-plugin-loader>=1.6
numpy>=1.20.2
5 changes: 2 additions & 3 deletions scripts/tasmota.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
from json import loads
from time import sleep
from numpy import interp
from threading import Thread
from requests import get
from requests.exceptions import ConnectionError
Expand Down Expand Up @@ -38,8 +37,8 @@ def loop():
text = loads(response.content.decode('utf-8'))
logging.debug(text)
if isinstance(uri['value'], list):
percent = interp(int(text[uri['key']]), uri['value'], [0, 100])
logging.debug(percent)
percent = (int(text[uri['key']]) - uri['value'][0])/((uri['value'][1] - uri['value'][0])/100)
logging.debug(f'Percent: {percent}')
if len(uri['leds']) == 1:
decimal = 255 / 100 * percent # 255 is FF in hex
alpha = f'#{hex(decimal)}'
Expand Down

0 comments on commit 5f825ab

Please sign in to comment.