diff --git a/powerplug.py b/powerplug.py index 36954ff..e2f98ac 100644 --- a/powerplug.py +++ b/powerplug.py @@ -1,6 +1,6 @@ import config import logging -import paho.mqtt.client as mqtt +import paho.mqtt.client as paho import report import socket import subprocess @@ -19,14 +19,7 @@ class sispmctl(object): def __init__(self, mqtt_client): logger.info("Starting sispmctl module...") self.__mqtt_client__ = mqtt_client - self.__state__ = [False, False, False, False] self.__state_requests__ = [{}, {}, {}, {}] - try: - out_txt = subprocess.check_output(["sudo", "sispmctl", "-f", "all"]).decode('UTF-8') - except subprocess.CalledProcessError as grepexc: - logger.error("sispm error code %d", grepexc.returncode) - else: - logger.info('sispmctl all channels switched off') self.publish_states() def __filter_output_parameter__(self, output): @@ -99,7 +92,7 @@ class mqtt_powerplug(object): ] def __init__(self): - self.__client__ = mqtt.Client("mqtt_powerplug") # create client object + self.__client__ = paho.Client(config.APP_NAME) # create client object self.__client__.on_message = self.__receive__ # attach function to callback self.__client__.username_pw_set(config.MQTT_USER, config.MQTT_PASS) # login with credentials try: