Skip to content

Commit

Permalink
Merge branch 'release/0.6.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
simonreeves committed May 10, 2023
2 parents 0b7b3ad + 92e8fc0 commit 737e241
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions an_farmview/client/envmonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import requests
import pprint

from an_farmview.config import settings

import an_farmview.snmp

def post():
url = f'{os.getenv("AN_FARMVIEW_API_URL")}/envmonitor'
url = f'{settings.an_farmview_api_url}/envmonitor'

data = {
"temperature01": an_farmview.snmp.get_temperature_rear(),
Expand All @@ -16,7 +18,7 @@ def post():
pprint.pprint(r.json())

def get():
url_get = f'{os.getenv("AN_FARMVIEW_API_URL")}/envmonitors'
url_get = f'{settings.an_farmview_api_url}/envmonitors'
getr = requests.get(url_get)
pprint.pprint(getr.json())

Expand Down
6 changes: 4 additions & 2 deletions an_farmview/client/ubl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import requests
import pprint

from an_farmview.config import settings

import an_farmview.ubl

def post():
url = f'{os.getenv("AN_FARMVIEW_API_URL")}/api/setubl'
url = f'{settings.an_farmview_api_url}/api/setubl'

data = an_farmview.ubl.get_ubl_data()
print(f'{__name__} - data to post: {data}')
Expand All @@ -14,7 +16,7 @@ def post():
pprint.pprint(r.json())

def get():
url_get = f'{os.getenv("AN_FARMVIEW_API_URL")}/api/getubl'
url_get = f'{settings.an_farmview_api_url}/api/getubl'
getr = requests.get(url_get)
pprint.pprint(getr.json())

Expand Down
3 changes: 2 additions & 1 deletion an_farmview/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class Settings(BaseSettings):
fno_password: str
snmp_community: str = ''
snmp_ip: str = ''

an_farmview_api_url: str = 'empty'

class Config:
env_file = ".env"

Expand Down
5 changes: 4 additions & 1 deletion env_template.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
SNMP_COMMUNITY=
SNMP_IP=
SNMP_IP=
FNO_SERVER=
FNO_PASSWORD=
AN_FARMVIEW_API_URL=

0 comments on commit 737e241

Please sign in to comment.