Update carom client, format code and add hardware mapping from rev 1-4

This commit is contained in:
Robert Einsle 2019-03-05 13:34:39 +01:00
parent 15e93c127a
commit 5cb7de8c9b
4 changed files with 26 additions and 17 deletions

View File

@ -1,11 +1,10 @@
import logging
from signal import pause from signal import pause
import click import click
import click_log
import gpiozero import gpiozero
from click_didyoumean import DYMGroup from click_didyoumean import DYMGroup
import click_log
import logging
from gpiozero.pins.native import NativeFactory from gpiozero.pins.native import NativeFactory
from terminaltables import SingleTable from terminaltables import SingleTable
@ -17,6 +16,7 @@ click_log.basic_config(root_logger)
gpiozero.Device.pin_factory = NativeFactory() gpiozero.Device.pin_factory = NativeFactory()
@click.group(cls=DYMGroup) @click.group(cls=DYMGroup)
@click_log.simple_verbosity_option(root_logger) @click_log.simple_verbosity_option(root_logger)
def cli(): def cli():
@ -36,7 +36,6 @@ def get_gpio():
click.echo(st.table) click.echo(st.table)
@cli.command() @cli.command()
def get_uuid(): def get_uuid():
""" """
@ -55,6 +54,7 @@ def run():
table.connect() table.connect()
pause() pause()
@cli.command() @cli.command()
def check_config(): def check_config():
""" """

View File

@ -2,13 +2,23 @@
endpoint = https://carom-dev.einsle.de/{0} endpoint = https://carom-dev.einsle.de/{0}
token = 97a65be7c8f19fb9d3a1b4de2effea958e52ba7a token = 97a65be7c8f19fb9d3a1b4de2effea958e52ba7a
[mapping] [mapping]
1 = 4 ## hw rev 1 - 4
2 = 17 1 = 20
3 = 27 2 = 16
4 = 22 3 = 12
5 = 10 4 = 7
6 = 9 5 = 8
7 = 11 6 = 25
8 = 5 7 = 24
8 = 18
## hw rev 5
#1 = 4
#2 = 17
#3 = 27
#4 = 22
#5 = 10
#6 = 9
#7 = 11
#8 = 5
[logging] [logging]
file = /var/log/carom-client.log file = /var/log/carom-client.log

View File

@ -2,5 +2,5 @@ from pkg_resources import resource_string
DEFAULT_CONFIG = resource_string(__name__, 'client.ini').decode() DEFAULT_CONFIG = resource_string(__name__, 'client.ini').decode()
"""Default configfile, that is used as a Fallback if no other configuration exists.""" """Default configfile, that is used as a Fallback if no other configuration exists."""
CONFIG_FILES = ('/boot/carom-client.conf', ) CONFIG_FILES = ('/boot/carom-client.conf',)
"""Order of resolution of Config Files. Files are tried in order, first one found is used.""" """Order of resolution of Config Files. Files are tried in order, first one found is used."""

View File

@ -1,14 +1,12 @@
import json import json
from datetime import datetime
import logging import logging
import uuid import uuid
from datetime import datetime
import requests import requests
from carom.config import config from carom.config import config
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -45,4 +43,5 @@ def send_to_server(state, table):
url, url,
data=json.dumps(payload), data=json.dumps(payload),
headers=headers, headers=headers,
verify=False,
) )