Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e2e5878630 |
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
VERSION=3.1.0
|
||||
VERSION=3.2.0
|
||||
dpkg-deb --root-owner-group -b debian "foodoord_${VERSION}_all.deb"
|
||||
|
2
debian/DEBIAN/control
vendored
2
debian/DEBIAN/control
vendored
@ -1,5 +1,5 @@
|
||||
Package: foodoord
|
||||
Version: 3.0.4
|
||||
Version: 3.2.0
|
||||
Maintainer: Bandie <bandie@chaospott.de>
|
||||
Architecture: all
|
||||
Description: Control the doors of the club, ja!
|
||||
|
5
debian/etc/foodoord.conf_example
vendored
5
debian/etc/foodoord.conf_example
vendored
@ -2,3 +2,8 @@
|
||||
status_url =
|
||||
key =
|
||||
secret =
|
||||
|
||||
[doorstatusv2]
|
||||
status_url =
|
||||
key =
|
||||
secret =
|
||||
|
37
debian/usr/sbin/foodoord_oben
vendored
37
debian/usr/sbin/foodoord_oben
vendored
@ -10,6 +10,7 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
from configparser import ConfigParser
|
||||
from dataclasses import dataclass
|
||||
|
||||
import pifacedigitalio
|
||||
|
||||
@ -32,18 +33,46 @@ ORANGE = 3
|
||||
parser = ConfigParser()
|
||||
parser.read('/etc/foodoord.conf')
|
||||
|
||||
DOORAPI = parser.get('doorstatus', 'status_url')
|
||||
CONSUMERKEY = parser.get('doorstatus', 'key')
|
||||
CONSUMERSECRET = parser.get('doorstatus', 'secret')
|
||||
|
||||
@dataclass
|
||||
class API:
|
||||
api_url: str
|
||||
consumer_key: str
|
||||
consumer_secret: str
|
||||
|
||||
|
||||
APIv1 = API(
|
||||
parser.get('doorstatus', 'status_url'),
|
||||
parser.get('doorstatus', 'key'),
|
||||
parser.get('doorstatus', 'secret'),
|
||||
)
|
||||
APIv2 = API(
|
||||
parser.get('doorstatusv2', 'status_url'),
|
||||
parser.get('doorstatusv2', 'key'),
|
||||
parser.get('doorstatusv2', 'secret'),
|
||||
)
|
||||
|
||||
|
||||
def update_api(locked):
|
||||
try:
|
||||
# API v1
|
||||
subprocess.check_call([
|
||||
"/usr/bin/curl", "-XPOST",
|
||||
"--header", "Content-Type: application/json",
|
||||
"--data",
|
||||
json.dumps({"consumer_key": CONSUMERKEY, "consumer_secret": CONSUMERSECRET, "aerie": locked})
|
||||
json.dumps({"consumer_key": APIv1.consumer_key, "consumer_secret": APIv1.consumer_secret, "aerie": locked}),
|
||||
APIv1.api_url
|
||||
])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
# API v2
|
||||
subprocess.check_call([
|
||||
"/usr/bin/curl", "-XPOST",
|
||||
"--header", "Content-Type: application/json",
|
||||
"--data",
|
||||
json.dumps({"consumer_key": APIv2.consumer_key, "consumer_secret": APIv2.consumer_secret, "aerie": locked}),
|
||||
APIv2.api_url
|
||||
])
|
||||
except:
|
||||
pass
|
||||
|
38
debian/usr/sbin/foodoord_unten
vendored
38
debian/usr/sbin/foodoord_unten
vendored
@ -8,6 +8,7 @@ import stat
|
||||
import subprocess
|
||||
import time
|
||||
from configparser import ConfigParser
|
||||
from dataclasses import dataclass
|
||||
|
||||
import RPi.GPIO as gpio
|
||||
|
||||
@ -31,9 +32,24 @@ ORANGE = 3
|
||||
parser = ConfigParser()
|
||||
parser.read('/etc/foodoord.conf')
|
||||
|
||||
DOORAPI = parser.get('doorstatus', 'status_url')
|
||||
CONSUMERKEY = parser.get('doorstatus', 'key')
|
||||
CONSUMERSECRET = parser.get('doorstatus', 'secret')
|
||||
|
||||
@dataclass
|
||||
class API:
|
||||
api_url: str
|
||||
consumer_key: str
|
||||
consumer_secret: str
|
||||
|
||||
|
||||
APIv1 = API(
|
||||
parser.get('doorstatus', 'status_url'),
|
||||
parser.get('doorstatus', 'key'),
|
||||
parser.get('doorstatus', 'secret'),
|
||||
)
|
||||
APIv2 = API(
|
||||
parser.get('doorstatusv2', 'status_url'),
|
||||
parser.get('doorstatusv2', 'key'),
|
||||
parser.get('doorstatusv2', 'secret'),
|
||||
)
|
||||
|
||||
|
||||
def write_state(state):
|
||||
@ -46,12 +62,24 @@ def write_state(state):
|
||||
|
||||
def update_api(locked):
|
||||
try:
|
||||
# API v1
|
||||
subprocess.check_call([
|
||||
"/usr/bin/curl", "-XPOST",
|
||||
"--header", "Content-Type: application/json",
|
||||
"--data",
|
||||
json.dumps({"consumer_key": CONSUMERKEY, "consumer_secret": CONSUMERSECRET, "cellar": locked}),
|
||||
DOORAPI
|
||||
json.dumps({"consumer_key": APIv1.consumer_key, "consumer_secret": APIv1.consumer_secret, "cellar": locked}),
|
||||
APIv1.api_url
|
||||
])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
# API v2
|
||||
subprocess.check_call([
|
||||
"/usr/bin/curl", "-XPOST",
|
||||
"--header", "Content-Type: application/json",
|
||||
"--data",
|
||||
json.dumps({"consumer_key": APIv2.consumer_key, "consumer_secret": APIv2.consumer_secret, "cellar": locked}),
|
||||
APIv2.api_url
|
||||
])
|
||||
except:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user