Execute a command on receiving a mqtt message
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.

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3. import os
  4. import report
  5. __BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
  6. MQTT_USER = "user"
  7. MQTT_PASS = "pass"
  8. MQTT_SERVER = "host"
  9. ENABLED_TOPIC = 'topic'
  10. EXEC_LIST = {
  11. 'topic_1': {
  12. 'key': 'key', # Give a key or None to compare plain DATA
  13. 'data': 'data', # Give data to compare or None if no comparison is needed
  14. 'command': 'echo 123'
  15. },
  16. 'topic_2': {
  17. 'key': None, # Give a key or None to compare plain DATA
  18. 'data': 'data', # Give data to compare or None if no comparison is needed
  19. 'command': 'echo 321'
  20. }
  21. }
  22. #
  23. # Logging
  24. #
  25. APP_NAME = "exec_command"
  26. LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
  27. LOGLVL = 'DEBUG'
  28. LOGHOST = 'cutelog'
  29. LOGPORT = 19996
  30. formatter = report.SHORT_FMT