- Newest
- Most votes
- Most comments
I don't think we have an existing way to expose this information. One alternative this would be the lambda checks network connectivity regularly instead of through Greengrass Core. Have you considered that?
Thanks @aws-hui, I ended up implementing the following (calling the GPIO connector) - which checks DNS and the connection to the ATS endpoint. A message pattern (or local file state) would be nice in future releases - If you could put in a feature request that would be great!
This can give the following light outputs:
OFF - When the connector terminates, say during a deploy or if GGCore is not running
ON - When the socket is successfully established and checked every 30s
Blinking - When a socket connection cannot be established to the ATS endpoiint
run_indicator_update = True
iot_connected = False
def is_connected():
# Crude but will do for now
try:
host = socket.gethostbyname("greengrass-ats.iot.eu-west-1.amazonaws.com")
s = socket.create_connection((host, 8443), 1)
return True
except:
pass
return False
def worker_iot_checker():
global iot_connected
while run_indicator_update:
iot_connected = is_connected()
sleep(30)
def worker_iot():
led_full_on = False
while run_indicator_update:
if not iot_connected:
led_full_on = False
indicator_on(iot_gpio)
sleep(0.5)
indicator_off(iot_gpio)
if iot_connected and not led_full_on:
led_full_on = True
indicator_on(iot_gpio)
sleep(0.5)
t2 = threading.Thread(target=worker_iot_checker)
t2.start()
t3 = threading.Thread(target=worker_iot)
t3.start()
Edited by: martysweet on Jan 19, 2019 10:02 AM
Relevant content
- Accepted Answerasked 2 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 7 months ago