Disabling TTN didn't work.

This commit is contained in:
jpmeijers 2017-11-12 21:29:05 +02:00
parent 7cca889cb4
commit 8437d03864

16
run.py
View File

@ -84,10 +84,10 @@ placement = ""
latitude = os.getenv('GW_REF_LATITUDE', 0) latitude = os.getenv('GW_REF_LATITUDE', 0)
longitude = os.getenv('GW_REF_LONGITUDE', 0) longitude = os.getenv('GW_REF_LONGITUDE', 0)
altitude = os.getenv('GW_REF_ALTITUDE', 0) altitude = os.getenv('GW_REF_ALTITUDE', 0)
frequency_plan_url = "https://account.thethingsnetwork.org/api/v2/frequency-plans/EU_863_870" frequency_plan_url = os.getenv('FREQ_PLAN_URL', "https://account.thethingsnetwork.org/api/v2/frequency-plans/EU_863_870")
# Fetch config from TTN if TTN is enabled # Fetch config from TTN if TTN is enabled
if(os.getenv('SERVER_TTN', True)): if(os.getenv('SERVER_TTN', "true")=="true"):
# Fetch the URL, if it fails try 30 seconds later again. # Fetch the URL, if it fails try 30 seconds later again.
config_response = "" config_response = ""
try: try:
@ -146,7 +146,8 @@ if(os.getenv('SERVER_TTN', True)):
for fb_router in fallback_routers: for fb_router in fallback_routers:
print ("\t"+fb_router) print ("\t"+fb_router)
# Done fetching config from TTN # Done fetching config from TTN
else:
print ("TTN gateway connector disabled. Not fetching config from account server.")
# Retrieve global_conf # Retrieve global_conf
sx1301_conf = {} sx1301_conf = {}
@ -169,17 +170,16 @@ gateway_conf['gateway_ID'] = my_eui
gateway_conf['contact_email'] = os.getenv('GW_CONTACT_EMAIL', "") gateway_conf['contact_email'] = os.getenv('GW_CONTACT_EMAIL', "")
gateway_conf['description'] = description gateway_conf['description'] = description
if(os.getenv('GW_FWD_CRC_ERR', False)=="true"): if(os.getenv('GW_FWD_CRC_ERR', "false")=="true"):
#default is False #default is False
gateway_conf['forward_crc_error'] = True gateway_conf['forward_crc_error'] = True
if(os.getenv('GW_FWD_CRC_VAL', True)=="false"): if(os.getenv('GW_FWD_CRC_VAL', "true")=="false"):
#default is True #default is True
gateway_conf['forward_crc_valid'] = False gateway_conf['forward_crc_valid'] = False
# Parse GW_GPS env var. It is a string, we need a boolean. # Parse GW_GPS env var. It is a string, we need a boolean.
gw_gps = os.getenv('GW_GPS', False) if(os.getenv('GW_GPS', "false")=="true"):
if(gw_gps=="true"):
gw_gps = True gw_gps = True
else: else:
gw_gps = False gw_gps = False
@ -209,7 +209,7 @@ else:
gateway_conf['servers'] = [] gateway_conf['servers'] = []
# Add TTN server # Add TTN server
if(os.getenv('SERVER_TTN', True)!="false"): if(os.getenv('SERVER_TTN', "true")=="true"):
server = {} server = {}
server['serv_type'] = "ttn" server['serv_type'] = "ttn"
server['server_address'] = router server['server_address'] = router