1
0
Fork 0
Browse Source

update URL used for RESTAPI calls.

I have given the 'mid-point' server a domain name to reduce the need to manually update the IP address if/when the
server needs to be restarted (for whatever reason). The changes here include the new URL.
pull/2/head
rtrp@factory1 3 years ago
parent
commit
39cf8bc302
  1. 3
      cli_meter.py
  2. 2
      light_meter.py
  3. 3
      shutdown.sh
  4. 3
      startup.sh

3
cli_meter.py

@ -37,7 +37,8 @@ a_pin = 18 # Charges the capacitor.
b_pin = 23 # Discharges the capacitor.
# Make sure this is valid.
api_url = "http://3.9.19.84/api/readings/add/1"
#api_url = "http://35.178.176.131/api/readings/add/1"
api_url = "http://ritherdon.abbether.net/api/readings/add/1"
def discharge():
GPIO.setup(a_pin, GPIO.IN)

2
light_meter.py

@ -86,7 +86,7 @@ def push_reading(lvalue):
# payload = { "active": act, "light-reading": int(lvalue), "timestamp": time }
payload = { "reading": int(lvalue), "time": time}
# res = requests.post("http://192.168.1.228:5000/api/readings/add/1", data=json.dumps(payload), headers=headers)
res = requests.post("http://35.176.14.135/api/readings/add/1", data=json.dumps(payload), headers=headers)
res = requests.post("http://ritherdon.abbether.net/api/readings/add/1", data=json.dumps(payload), headers=headers)
# print(int(lvalue))
# print(res.status_code)
print(payload)

3
shutdown.sh

@ -15,7 +15,8 @@
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://3.9.19.84/api/status/update" # Make sure this is valid.
mainURL="http://ritherdon.abbether.net/api/status/update"
getApiUrl () {
case $HOSTNAME in

3
startup.sh

@ -24,7 +24,8 @@ 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://3.9.19.84/api/status/update" # Make sure this is valid.
mainURL="http://ritherdon.abbether.net/api/status/update"
getApiUrl () {
case $HOSTNAME in