final for Robin
This commit is contained in:
parent
e138ec8c2e
commit
9e06bd387a
|
|
@ -51,7 +51,8 @@ class HttpRequest:
|
||||||
# Encode the values in the dictionary
|
# Encode the values in the dictionary
|
||||||
encoded_content = {}
|
encoded_content = {}
|
||||||
for key, value in parsed_content.items():
|
for key, value in parsed_content.items():
|
||||||
encoded_value = re.sub(r'%([0-9A-Fa-f]{2})', lambda m: chr(int(m.group(1), 16)), value)
|
encoded_value = re.sub(r'\%([0-9A-Fa-f]{2})', lambda m: chr(int(m.group(1), 16)), value)
|
||||||
|
print("encoding ...", key, value, encoded_value)
|
||||||
encoded_content[key] = encoded_value
|
encoded_content[key] = encoded_value
|
||||||
|
|
||||||
return encoded_content
|
return encoded_content
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
dev_api_url = 'api.growsystem.muellerdev.kozow.com'
|
||||||
api_url = 'api.growsystem.muellerdev.kozow.com'
|
api_url = 'api.growsystem.muellerdev.kozow.com'
|
||||||
read_secs = 1 * 60
|
read_secs = 15 * 60
|
||||||
token = "lIEOISAH4DUfNvNP"
|
token = "dummy"
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
{"sensors": [{"pin_int": 15, "type": "dht22"}, {"pin_int": 26, "type": "moisture"}], "device_id": 10, "name": "Proto Robin", "token": "lIEOISAH4DUfNvNP", "user_id": 1}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
config = {"ssid": "Oppa-95.lan", "user_id": "1", "password": "95%04-MM", "pin": "9941"}
|
|
||||||
|
|
@ -35,7 +35,7 @@ class GrowSystem:
|
||||||
print("Start reading sensors ...")
|
print("Start reading sensors ...")
|
||||||
|
|
||||||
read_secs = self.device_info.app_config().read_secs
|
read_secs = self.device_info.app_config().read_secs
|
||||||
|
print("Reading and sending every " + str(read_secs) + " seconds")
|
||||||
while True:
|
while True:
|
||||||
# Reset data
|
# Reset data
|
||||||
self.most_recent_values = []
|
self.most_recent_values = []
|
||||||
|
|
@ -59,7 +59,6 @@ class GrowSystem:
|
||||||
print("Device Config:", device_config['data'], device_config['data']['token'])
|
print("Device Config:", device_config['data'], device_config['data']['token'])
|
||||||
th.write_token(device_config['data']['token'])
|
th.write_token(device_config['data']['token'])
|
||||||
self.write_device_infos(device_config['data'])
|
self.write_device_infos(device_config['data'])
|
||||||
machine.reset()
|
|
||||||
|
|
||||||
def update_device_info(self):
|
def update_device_info(self):
|
||||||
print("Start Device Info Update!")
|
print("Start Device Info Update!")
|
||||||
|
|
@ -88,8 +87,6 @@ class GrowSystem:
|
||||||
f.write(ujson.dumps(device_configs))
|
f.write(ujson.dumps(device_configs))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _initialize_sensors(self):
|
def _initialize_sensors(self):
|
||||||
# Init sensors
|
# Init sensors
|
||||||
sensors = self.device_info.config()['sensors']
|
sensors = self.device_info.config()['sensors']
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,6 @@ select {{
|
||||||
body = f"""
|
body = f"""
|
||||||
<div>Unknown page</div>
|
<div>Unknown page</div>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
html_arr = [header, body, footer]
|
html_arr = [header, body, footer]
|
||||||
html = html.join(html_arr)
|
html = html.join(html_arr)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue