Smarthome Functionen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smart_brain.py 807B

123456789101112131415161718192021222324252627
  1. import config
  2. import function
  3. import logging
  4. import mqtt
  5. import report
  6. import time
  7. logger = logging.getLogger(config.APP_NAME)
  8. if __name__ == "__main__":
  9. if config.DEBUG:
  10. report.stdoutLoggingConfigure(([config.APP_NAME, logging.DEBUG], ), report.LONG_FMT)
  11. else:
  12. report.stdoutLoggingConfigure(((config.APP_NAME, logging.INFO),
  13. (config.APP_NAME+'.devices', logging.WARNING)), report.SHORT_FMT)
  14. #
  15. mc = mqtt.mqtt_client(host=config.MQTT_SERVER, port=config.MQTT_PORT,
  16. username=config.MQTT_USER, password=config.MQTT_PASSWORD, name=config.APP_NAME)
  17. func = function.all_functions(mc)
  18. # for device in func.devicelist():
  19. # device.add_warning_callback(None)
  20. while (True):
  21. time.sleep(1)