mirror of
https://github.com/nikdoof/aaisp2mqtt.git
synced 2025-12-14 10:12:21 +00:00
example topics and start of the script
This commit is contained in:
33
aaisp-to-mqtt.py
Executable file
33
aaisp-to-mqtt.py
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import json
|
||||
import urllib
|
||||
import configparser
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
VERSION = 0.1
|
||||
|
||||
def main():
|
||||
logging.basicConfig(level=logging.INFO, format='%(levelname)8s [%(asctime)s] %(message)s')
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
LOG.fatal("Config file not supplied")
|
||||
|
||||
cfgfile = sys.argv[1]
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(cfgfile)
|
||||
|
||||
for section in ["aaisp", "mqtt"]:
|
||||
if section not in config.sections():
|
||||
LOG.fatal("%s section not found in config file %s", section, cfgfile)
|
||||
|
||||
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user