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

    Check DuckDNS connection status/update

    Raspberry Pi
    homegenie alexa google assistan raspberry pi
    1
    1
    1.3k
    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
      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
      • First post
        Last post