parent
b61f5a4789
commit
e65ec37962
1 changed files with 11 additions and 10 deletions
|
@ -14,14 +14,13 @@ Data will be published to the following topic names:
|
||||||
Where *id_value* is the *id* value from the dish status information.
|
Where *id_value* is the *id* value from the dish status information.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
import math
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ssl
|
import ssl
|
||||||
|
@ -35,6 +34,7 @@ import dish_common
|
||||||
|
|
||||||
HOST_DEFAULT = "localhost"
|
HOST_DEFAULT = "localhost"
|
||||||
|
|
||||||
|
|
||||||
class Terminated(Exception):
|
class Terminated(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -96,12 +96,13 @@ def parse_args():
|
||||||
val = os.environ.get(var)
|
val = os.environ.get(var)
|
||||||
if val:
|
if val:
|
||||||
if var == "MQTT_SSL":
|
if var == "MQTT_SSL":
|
||||||
if val == "insecure":
|
if ssl_ok and val != "false":
|
||||||
env_defaults[opt] = False
|
if val == "insecure":
|
||||||
elif val == "secure":
|
env_defaults[opt] = {"cert_reqs": ssl.CERT_NONE}
|
||||||
env_defaults[opt] = True
|
elif val == "secure":
|
||||||
else:
|
env_defaults[opt] = {}
|
||||||
env_defaults["ssl_ca_cert"] = val
|
else:
|
||||||
|
env_defaults[opt] = {"ca_certs": val}
|
||||||
else:
|
else:
|
||||||
env_defaults[opt] = val
|
env_defaults[opt] = val
|
||||||
parser.set_defaults(**env_defaults)
|
parser.set_defaults(**env_defaults)
|
||||||
|
@ -140,7 +141,6 @@ def loop_body(opts, gstate):
|
||||||
if not ((type(val) == float) and math.isnan(val)):
|
if not ((type(val) == float) and math.isnan(val)):
|
||||||
data["dish_{0}".format(category)].update({key: val})
|
data["dish_{0}".format(category)].update({key: val})
|
||||||
|
|
||||||
|
|
||||||
def cb_add_sequence(key, val, category, _):
|
def cb_add_sequence(key, val, category, _):
|
||||||
if not "dish_{0}".format(category) in data:
|
if not "dish_{0}".format(category) in data:
|
||||||
data["dish_{0}".format(category)] = {}
|
data["dish_{0}".format(category)] = {}
|
||||||
|
@ -148,6 +148,7 @@ def loop_body(opts, gstate):
|
||||||
data["dish_{0}".format(category)].update({key: list(val)})
|
data["dish_{0}".format(category)].update({key: list(val)})
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
def cb_add_item(key, val, category):
|
def cb_add_item(key, val, category):
|
||||||
msgs.append(("starlink/dish_{0}/{1}/{2}".format(category, gstate.dish_id,
|
msgs.append(("starlink/dish_{0}/{1}/{2}".format(category, gstate.dish_id,
|
||||||
key), val, 0, False))
|
key), val, 0, False))
|
||||||
|
|
Loading…
Reference in a new issue