TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Check DuckDNS connection status/update

    Scheduled Pinned Locked Moved Raspberry Pi
    homegeniealexagoogle assistanraspberry pi
    1 Posts 1 Posters 2.2k Views
    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.
    • tuicemenT Offline
      tuicemen
      last edited by tuicemen

      I created a bash script for my off grid HomeGenie Server similar to this which displays the Status and current IP in a widget.
      It is on a DSL line so the IP does change from time to time. The url calls are posted on the DuckDNS.org site.
      I converted it to a python3 Ducks.py script for TRIGGERcmd.
      you'll need a free DuckDNS account and create a domain and get a token for that domain name
      the script looks like this:

      #Libraries
      
      import requests
      import os
      url = "https://www.duckdns.org/update?domains=YOURDOMAIN&token=YOURTOKEN"
      result = requests.get(url)
      if result.text == "OK":
       os.system ('~/.TRIGGERcmdData/sendresult.sh ' + result.text)
      else:
       os.system ('~/.TRIGGERcmdData/sendresult.sh ' + 'Broken')
      # Print to commandline
      print (result.text)
      

      replace "YOURDOMAIN" with the one you created and replace "YOURTOKEN" with what DuckDNS asigns you.

      I added this line to my commands.json text

      {"trigger":"Duck D N S","command":"python3 /home/pi/scripts/Ducks.py","ground":"background","voice":"Duck D N S","voiceReply":"The Duck D N S conection is {{result}}","allowParams": "false"}
      
      1 Reply Last reply Reply Quote 1

      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
      • First post
        Last post