From f95ac677d65d833e8b4073aa6e639efa12dfeacd Mon Sep 17 00:00:00 2001 From: "rtrp@gallery1" Date: Fri, 27 Nov 2020 18:29:54 +0000 Subject: [PATCH] update URL for RestAPI calls. The API calls now go to rither.abbether.net instead of the designated IP address assigned the server (AWS). This change makes it easier to access the RestAPI (see midpoint repo.) server. The URL will remain constant and if the server needs to be powered-down/restarted for anything, the new IP address Amazon (web services) assigns to it will no longer matter. And, the code used to make the RestAPI call will no longer need changing manually. --- relay.py | 4 ++-- shutdown.sh | 2 +- startup.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/relay.py b/relay.py index b703ac6..42af4b2 100644 --- a/relay.py +++ b/relay.py @@ -14,13 +14,13 @@ def main(): try: while True: # Make sure the U.R.L. is valid. - r = requests.get('http://3.9.19.84/api/readings/latest/1') + r = requests.get('http://ritherdon.abbether.net/api/readings/latest/1') # print(r.status_code) # For testing. data = r.json() # print(data) # For testing. the_reading = data.get("reading") # print(the_reading) # For testing. - if the_reading > 30: + if the_reading > 33: # Print for testing. # print(f"[INFO] Light is on -- {the_reading}.") GPIO.output(relay_pin, GPIO.HIGH) diff --git a/shutdown.sh b/shutdown.sh index aa5b6d4..7ffd1cb 100755 --- a/shutdown.sh +++ b/shutdown.sh @@ -13,7 +13,7 @@ logDate=$(date '+%Y-%m-%dT%TZ') logFile="/home/rtrp/logs/shutdown-logs.txt" -mainURL="http://3.9.19.84/api/status/update" # Make sure this is valid. +mainURL="http://ritherdon.abbether.net/api/status/update" # Make sure this is valid. getApiUrl () { case $HOSTNAME in diff --git a/startup.sh b/startup.sh index 7f80394..e53751d 100755 --- a/startup.sh +++ b/startup.sh @@ -23,7 +23,7 @@ sleep 60 logDate=$(date '+%Y-%m-%dT%TZ') logFile="/home/rtrp/logs/startup-logs.txt" -mainURL="http://3.9.19.84/api/status/update" # Make sure this is valid. +mainURL="http://ritherdon.abbether.net/api/status/update" # Make sure this is valid. getApiUrl () { case $HOSTNAME in