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

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