-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsender.py
33 lines (25 loc) · 850 Bytes
/
sender.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import greengrasssdk
import logging
import greengrasssdk
import platform
from threading import Timer
client = greengrasssdk.client('iot-data')
my_platform = platform.platform()
OUTPUT_TOPIC = 'test/topic_results'
def greengrass_hello_world_run():
if not my_platform:
client.publish(
topic=OUTPUT_TOPIC,
payload='Hello world! Sent from Greengrass Core.')
else:
client.publish(
topic=OUTPUT_TOPIC,
payload='Hello world! Sent from '
'Greengrass Core running on platform: {}'
.format(my_platform))
# Asynchronously schedule this function to be run again in 5 seconds
Timer(5, greengrass_hello_world_run).start()
# Start executing the function above
greengrass_hello_world_run()
def function_handler(event, context):
return