What is the best way to send downlink data?
To set the time on a node (without wifi) I have made a small Python script. It sends the date/time as a string, like '201712101458'. Is this the preferred way to send data, or is there a better way?
I have included some code below. I could not find a way to format the code in a codeblock. so sorry for the formatting.
Here is the simple Python script to send the data:
from datetime import datetime
nu = datetime.now()
datum = nu.strftime('%Y%m%d%H%M')
payload = datum.encode('base64')
r = requests.post("https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/f4ce46a550ec/12?key=ttn-account-v2.-<removed>",
"dev_id": "<removed>", # The device ID
"port": 1, # LoRaWAN FPort
"confirmed": False, # Whether the downlink should be confirmed by the device
"payload_raw": payload # Base64 encoded payload
On the node I set the time this way: