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 886B

12345678910111213141516171819202122232425262728
  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.appLoggingConfigure(None, None, ((config.APP_NAME, logging.DEBUG), ),
  11. fmt=report.SHORT_FMT, host='localhost', port=19996)
  12. else:
  13. report.stdoutLoggingConfigure(((config.APP_NAME, logging.INFO),
  14. (config.APP_NAME+'.devices', logging.WARNING)), report.SHORT_FMT)
  15. #
  16. mc = mqtt.mqtt_client(host=config.MQTT_SERVER, port=config.MQTT_PORT,
  17. username=config.MQTT_USER, password=config.MQTT_PASSWORD, name=config.APP_NAME)
  18. func = function.all_functions(mc)
  19. # for device in func.devicelist():
  20. # device.add_warning_callback(None)
  21. while (True):
  22. time.sleep(1)