Check DuckDNS connection status/update
-
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"}