mirror of
https://github.com/nikdoof/aaisp2mqtt.git
synced 2025-12-13 17:52:17 +00:00
34 lines
654 B
Python
Executable File
34 lines
654 B
Python
Executable File
#!/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()
|