示例#1
0
 def runConfig(conf: Config.BasicConfig, logger: logging.Logger):
     c = Config.PluginConfig(conf, PluginLoader.getConfigKey())
     c["dev"] = ConsoleInputTools.get_input("Serial Device Pfad: ",
                                            require_val=True,
                                            std_val="/dev/ttyACM0")
     c["tp"] = [[0, 0], [50, 30], [60, 50], [75, 75], [80, 100]]
     c["provider"] = "rpiCPUtemp"
示例#2
0
 def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
              logger: logging.Logger, device_id: str):
     self._config = conf.PluginConfig(opts, "ShellSwitch")
     self.__client = client
     self.__logger = logger.getChild("ShellSwitch")
     self._registered_callback_topics = []
     self._name_topic_map = {}
     self._state_name_map = {}
示例#3
0
 def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
              logger: logging.Logger, device_id: str):
     self._config = conf.PluginConfig(opts, PluginLoader.getConfigKey())
     self.__client = client
     self.__logger = logger.getChild(PluginLoader.getConfigKey())
     self._prev_deg = True
     self.__lastTemp = 0.0
     self.__ava_topic = device_id
     self._callables = []
     self.device = None
示例#4
0
 def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
              logger: logging.Logger, device_id: str):
     self._config = conf.PluginConfig(opts, "rpiCPUtemp")
     self.__client = client
     self.__logger = logger.getChild("PiCpuTemp")
     self._prev_deg = 0
     if self._config.get("diff", None) is None:
         self._config["diff"] = 1.5
     self._callables = []
     self._open_file()
示例#5
0
 def __init__(self, logger: logging.Logger, config: tc.BasicConfig):
     self.logger = logger.getChild("PluginManager")
     self.config = config
     self._client = None
     self._client_name = None
     self._wasConnected = False
     self.shed_thread = None
     self._discovery_topics = self.config.getIndependendFile(
         "discovery_topics", no_watchdog=True, do_load=True)[0]
     self.discovery_topics = tc.PluginConfig(self._discovery_topics,
                                             "Registry")
示例#6
0
 def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
              logger: logging.Logger, device_id: str):
     self._config = conf.PluginConfig(config=opts, plugin_name="soundmeter")
     self.__client = client
     self.__logger = logger.getChild("SoundMeter")
     self.__ava_topic = device_id
     self._topic = None
     self._wasTriggered = False
     self._lastRMS = -1000
     self._thread = None
     self._match_filter = self._config.get("filter/needs_positive_matches",
                                           0)
     self._neg_match_filter = self._config.get(
         "filter/needs_negativ_matches", 0)
     self._timeout_shed = None
示例#7
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
                 logger: logging.Logger, device_id: str):
        self._subdevice_ready = False
        self._config = conf.PluginConfig(opts, CONST.CONFIG_NAME)
        self.__client = client
        self.__logger = logger.getChild(CONST.CONFIG_NAME)
        self._prev_deg = None
        self.__lastTemp = 0.0
        self.__ava_topic = device_id
        self._veDevice = None

        self.__logger.debug("Erstelle verbindung...")
        self._veDirCon = Connection(self._config, self.__logger)
        self._veDirCon._device_ready_call = lambda: self._device_ready()
        self._veDirCon.start()
示例#8
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig, logger: logging.Logger, device_id: str):
        self._client = client
        self._logger = logger.getChild("BH1750")
        self._devID = device_id
        
        self._job_inst = []

        if opts.get("BHL1750", None) is not None:
            opts["BH1750"] = opts["BHL1750"]
            del opts["BHL1750"]

        self._conf = conf.PluginConfig(opts, "BH1750")

        try:
            self._bus = smbus.SMBus(self._conf["bus"])
        except:
            self._logger.exception("SMBus wurde nicht gefunden")
            self.__broken = True
示例#9
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
                 logger: logging.Logger, device_id: str):
        self._config = conf.PluginConfig(opts, PluginLoader.getConfigKey())
        self.__client = client
        self.__logger = logger.getChild(PluginLoader.getConfigKey())
        self._prev_deg = True
        self.__lastTemp = 0.0
        self.__ava_topic = device_id
        self._callables = []
        self.device = None
        self._running_sensor = None

        if self._config.get("enabled/systray", True):
            self._systray = win32Systray(self._config, self.__logger)
        if self._config.get("enabled/powerevents", True):
            self._pwr_ev = WindowEventProcessor(self._config, self.__logger)
        if self._config.get("enabled/wmi_pnp", True):
            self._wmi_devices = WMI_PnP(self._config, self.__logger)
示例#10
0
    def __init__(self, client: mclient.Client, opts: conf.PluginConfig,
                 logger: logging.Logger, device_id: str):
        self._config = opts
        self.__client = client
        self.__logger = logger.getChild("kaifa")
        self._devices = []

        meters: list = self._config.get("meters", default=[])
        self.__logger.debug(f"Beginne mit verarbeiten von Meters: {meters = }")

        for dev in range(len(meters)):
            meter_key = f"meters/{dev}"
            self.__logger.debug(
                f"Baue Reader({self._config = }, {meter_key = }, {self.__logger = })"
            )
            self._devices.append(
                Reader(subConfig=conf.PluginConfig(self._config, meter_key),
                       logger=self.__logger.getChild(str(dev))))
        self.__logger.debug("Alle SmartMeter erstellt!")
示例#11
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig,
                 logger: logging.Logger, device_id: str):
        self._bus = None
        self._proxy = None
        self._login1 = None
        self._logger = logger
        self._mainloop = None
        self.thread_gml = GlibThread.getThread()

        self.sleeping = False
        self.shutdown = False

        self.inhibit_lock = -1
        self._switches: dict[str, Switch] = {}
        self.sessions = {}
        self._config = conf.PluginConfig(opts, "logind")

        self._poff_notiy = None
        self._sleep_notiy = None
        self._nsess_notiy = None
        self._rsess_notiy = None
        self._idle_monitor = None
示例#12
0
 def __init__(self, client: mclient.Client, opts: Config.BasicConfig,
              logger: logging.Logger, device_id: str):
     self.__client = client
     self.__logger = logger.getChild("SerialFan")
     self._config = Config.PluginConfig(opts, "SerialFan")
     self._registered_callback_topics = []
     self._pm = None
     self.temperature = 0
     self._serial = serial.Serial(port=self._config["dev"],
                                  dsrdtr=True,
                                  rtscts=True)
     self._serial_thr = None
     self._shutdown = False
     self._rpm = 0
     self._pct = 0
     self._err = None
     self._last_rpm = 0
     self._last_pct = 0
     self._last_err = "BOOTED"
     self._speed_topics = None
     self._rpm_topics = None
     self._err_topics = None
示例#13
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig, logger: logging.Logger, device_id: str):
        from gpiozero.pins.native import NativeFactory
        from gpiozero import Device
        Device.pin_factory = NativeFactory()

        self._config = conf.PluginConfig(opts, PluginLoader.getConfigKey())
        self.__client = client
        self.__logger = logger.getChild("Fingerprint")
        self._finger = PyFingerprint(
            self._config["serial"],
            57600,
            0xFFFFFFFF,
            self._config.get("password", 0x00000000)
            )
        
        if not self._finger.verifyPassword():
            self.err_str = "PASSWD"
        
        if self._config.get("WAKEUP", 0) is not 0:
            self.wakupPin = Pin.Pin(pin=self._config.get("WAKEUP", 0), direction=Pin.PinDirection.IN_PULL_LOW)
            self.wakupPin.set_detect(self.wakeup, Pin.PinEventEdge.BOTH)
        else:
            self.wakeup(None, threadsleep=False)
示例#14
0
 def __init__(self, conff: conf.BasicConfig):
     self.c = conf.PluginConfig(conff, PluginLoader.getConfigKey())
示例#15
0
 def __init__(self, c: conf.BasicConfig):
     self.c = conf.PluginConfig(c, CONFIG_NAME)
示例#16
0
 def __init__(self, conf: conf.BasicConfig):
     self.c = conf.PluginConfig(conf, "BH1750")
     self.c["device"] = False
     self.c["device_alt"] = False
     self.c["bus"] = -1
示例#17
0
 def __init__(self, con: conf.BasicConfig):
     self.__ids = []
     self.c = conf.PluginConfig(config=con, plugin_name="soundmeter")
示例#18
0
 def __init__(self, opts: conf.BasicConfig):
     self.c = conf.PluginConfig(opts, "ShellSwitch")
     self.c.get("entrys", {})