Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    What is the best way to send downlink data?

    Scheduled Pinned Locked Moved LoPy
    data lora
    1 Posts 1 Posters 789 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      rvandam
      last edited by rvandam

      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:

      import requests
      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>",
      json={
      "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
      })
      print(r.status_code, r.reason)

      On the node I set the time this way:

      rtc.init((int(rx[0:4]),int(rx[4:6]),int(rx[6:8]),int(rx[8:10]),int(rx[10:12])))

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom