changes
This commit is contained in:
parent
e0d3488591
commit
d1a967d6cc
2 changed files with 36 additions and 3 deletions
|
|
@ -0,0 +1,26 @@
|
|||
from mqtt_client import MQTTClient
|
||||
from timer import Timer
|
||||
from timeit import default_timer as timer
|
||||
import yaml
|
||||
import os
|
||||
import json
|
||||
|
||||
class Service:
|
||||
def __init__(self):
|
||||
try:
|
||||
with open("config.yaml","r") as config:
|
||||
config = yaml.safe_load(config)
|
||||
except Exception as e:
|
||||
with open("rename_to_config.yaml","r") as config:
|
||||
config = yaml.safe_load(config)
|
||||
|
||||
if 'MQTT_HOST' in os.environ:
|
||||
self.mqtt = MQTTClient(os.environ['MQTT_USER'],
|
||||
os.environ['MQTT_PASSWORD'],
|
||||
os.environ['MQTT_HOST'],
|
||||
int(os.environ['MQTT_PORT']))
|
||||
else:
|
||||
self.mqtt = MQTTClient(config["mqtt"]["username"],
|
||||
config["mqtt"]["password"],
|
||||
config["mqtt"]["host"],
|
||||
config["mqtt"]["port"])
|
||||
|
|
@ -2,13 +2,20 @@
|
|||
#include "simple-ddc.h"
|
||||
|
||||
static PyObject* switch_to_input(PyObject* self, PyObject* args) {
|
||||
uint8_t display, input;
|
||||
if (!PyArg_ParseTuple(args, "ii", &display, &input))
|
||||
uint8_t* display = malloc(sizeof(uint8_t));
|
||||
uint8_t* input = malloc(sizeof(uint8_t));;
|
||||
//if (!PyArg_ParseTuple(args, "ii", &display, &input))
|
||||
// return NULL;
|
||||
if (!PyArg_ParseTuple(args, "ii", display, input))
|
||||
return NULL;
|
||||
|
||||
DDCA_Display_Handle* handle = open_first_display_by_dlist();
|
||||
switch_input(handle,input);
|
||||
switch_input(handle,*input);
|
||||
ddca_close_display(handle);
|
||||
|
||||
free(display);
|
||||
free(input);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue