2022-12-19 10:35:20 +01:00
|
|
|
import config
|
|
|
|
import function
|
|
|
|
import logging
|
|
|
|
import mqtt
|
|
|
|
import report
|
|
|
|
import time
|
|
|
|
|
|
|
|
logger = logging.getLogger(config.APP_NAME)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if config.DEBUG:
|
2022-12-21 14:26:35 +01:00
|
|
|
report.appLoggingConfigure(None, None, ((config.APP_NAME, logging.DEBUG), ),
|
|
|
|
fmt=report.SHORT_FMT, host='localhost', port=19996)
|
2022-12-19 10:35:20 +01:00
|
|
|
else:
|
|
|
|
report.stdoutLoggingConfigure(((config.APP_NAME, logging.INFO),
|
|
|
|
(config.APP_NAME+'.devices', logging.WARNING)), report.SHORT_FMT)
|
|
|
|
#
|
|
|
|
mc = mqtt.mqtt_client(host=config.MQTT_SERVER, port=config.MQTT_PORT,
|
|
|
|
username=config.MQTT_USER, password=config.MQTT_PASSWORD, name=config.APP_NAME)
|
|
|
|
|
2022-12-19 16:11:35 +01:00
|
|
|
func = function.all_functions(mc)
|
2022-12-19 10:35:20 +01:00
|
|
|
|
2022-12-19 16:11:35 +01:00
|
|
|
# for device in func.devicelist():
|
|
|
|
# device.add_warning_callback(None)
|
2022-12-19 10:35:20 +01:00
|
|
|
|
|
|
|
while (True):
|
|
|
|
time.sleep(1)
|