Switch to relay_rpc hadling
This commit is contained in:
parent
64157b00e0
commit
ac1b251dcc
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__
|
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@ -4,6 +4,14 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Current File",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": true
|
||||
},
|
||||
{
|
||||
"name": "Python: Flask",
|
||||
"type": "python",
|
||||
|
100
home/app.py
100
home/app.py
@ -1,6 +1,7 @@
|
||||
"""Flask app"""
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import threading
|
||||
@ -15,6 +16,11 @@ from flask import jsonify
|
||||
|
||||
CONFIG_FILE = os.path.join(os.path.expanduser('~'), ".config/home/config.json")
|
||||
|
||||
LOG_LEVEL = logging.INFO
|
||||
LOG_FORMAT = "%(asctime)s %(levelname)s %(message)s"
|
||||
|
||||
logging.basicConfig(format=LOG_FORMAT, level=LOG_LEVEL)
|
||||
log = logging.getLogger()
|
||||
class Control(threading.Thread):
|
||||
"""Control"""
|
||||
def __init__(self, config_file_name: str):
|
||||
@ -22,7 +28,6 @@ class Control(threading.Thread):
|
||||
self.run_condition = True
|
||||
self.config = None
|
||||
self.config_file = config_file_name
|
||||
self.water_state = []
|
||||
|
||||
|
||||
def reload_config(self):
|
||||
@ -36,54 +41,57 @@ class Control(threading.Thread):
|
||||
shutil.copyfile("config.json", self.config_file)
|
||||
with open(self.config_file, "r", encoding="UTF-8") as handle:
|
||||
self.config = json.load(handle)
|
||||
for _ in range(len(self.config['configs'])):
|
||||
self.water_state.append(False)
|
||||
|
||||
|
||||
def run(self):
|
||||
while self.run_condition:
|
||||
configs = self.config['configs']
|
||||
water_index = 0
|
||||
for config in configs:
|
||||
water = config["water"]
|
||||
autostate = water["autostate"]
|
||||
if autostate:
|
||||
times = water["times"]
|
||||
idx = 0
|
||||
now = datetime.datetime.now()
|
||||
if int(now.hour) >= 12:
|
||||
idx = 1
|
||||
on_time_pattern = times[idx]['on_time']
|
||||
on_time_pattern = on_time_pattern.split(':')
|
||||
on_time = now.replace(hour=int(on_time_pattern[0]),
|
||||
minute=int(on_time_pattern[1]),
|
||||
second=0,
|
||||
microsecond=0)
|
||||
off_time_pattern = times[idx]['off_time']
|
||||
off_time_pattern = off_time_pattern.split(':')
|
||||
off_time = now.replace(hour=int(off_time_pattern[0]),
|
||||
minute=int(off_time_pattern[1]),
|
||||
second=0,
|
||||
microsecond=0)
|
||||
|
||||
|
||||
switch_on = False
|
||||
for entry in times:
|
||||
on_time_pattern = entry['on_time']
|
||||
on_time_pattern = on_time_pattern.split(':')
|
||||
on_time = now.replace(hour=int(on_time_pattern[0]),
|
||||
minute=int(on_time_pattern[1]),
|
||||
second=0,
|
||||
microsecond=0)
|
||||
off_time_pattern = entry['off_time']
|
||||
off_time_pattern = off_time_pattern.split(':')
|
||||
off_time = now.replace(hour=int(off_time_pattern[0]),
|
||||
minute=int(off_time_pattern[1]),
|
||||
second=0,
|
||||
microsecond=0)
|
||||
if now > on_time and now <= off_time:
|
||||
switch_on = True
|
||||
break
|
||||
url = "http://" + config["host"] + ":" + str(config["port"])
|
||||
if now > on_time and now <= off_time and not self.water_state[water_index]:
|
||||
water_state = True
|
||||
try:
|
||||
client = xmlrpc.client.ServerProxy(url)
|
||||
water_state = client.get_relay_state(water["relay"])
|
||||
except OSError as error:
|
||||
log.error(error)
|
||||
log.info(url)
|
||||
if switch_on and not water_state:
|
||||
try:
|
||||
client = xmlrpc.client.ServerProxy(url)
|
||||
client.switch_relay(water["relay"], True)
|
||||
self.water_state[water_index] = client.get_relay_state(water["relay"])
|
||||
water_state = client.switch_relay(water["relay"], True)
|
||||
except OSError as error:
|
||||
print(error)
|
||||
elif now > off_time and self.water_state[water_index]:
|
||||
log.error(error)
|
||||
log.info(url)
|
||||
elif not switch_on and water_state:
|
||||
try:
|
||||
client = xmlrpc.client.ServerProxy(url)
|
||||
client.switch_relay(water["relay"], False)
|
||||
self.water_state[water_index] = client.get_relay_state(water["relay"])
|
||||
except OSError as error:
|
||||
print(error)
|
||||
water_index += 1
|
||||
time.sleep(1)
|
||||
log.error(error)
|
||||
log.info(url)
|
||||
time.sleep(10)
|
||||
|
||||
|
||||
control = Control(CONFIG_FILE)
|
||||
@ -108,6 +116,36 @@ def tomatentuppen():
|
||||
return render_template('tomatentuppen.html')
|
||||
|
||||
|
||||
@app.route('/rasen_1', methods=['GET'])
|
||||
def rasen_1():
|
||||
"""Handle GET to rasen_1.html"""
|
||||
return render_template('rasen_1.html')
|
||||
|
||||
|
||||
@app.route('/rasen_2', methods=['GET'])
|
||||
def rasen_2():
|
||||
"""Handle GET to rasen_2.html"""
|
||||
return render_template('rasen_2.html')
|
||||
|
||||
|
||||
@app.route('/rasen_3', methods=['GET'])
|
||||
def rasen_3():
|
||||
"""Handle GET to rasen_3.html"""
|
||||
return render_template('rasen_3.html')
|
||||
|
||||
|
||||
@app.route('/gewaechshaus', methods=['GET'])
|
||||
def gewaechshaus():
|
||||
"""Handle GET to gewaechshaus.html"""
|
||||
return render_template('gewaechshaus.html')
|
||||
|
||||
|
||||
@app.route('/wasseranschluss', methods=['GET'])
|
||||
def wasseranschluss():
|
||||
"""Handle GET to wasseranschluss.html"""
|
||||
return render_template('wasseranschluss.html')
|
||||
|
||||
|
||||
@app.route('/sample/<idx>', methods=['GET'])
|
||||
def get_sample(idx='0'):
|
||||
"""Handle GET to /sample/<idx>"""
|
||||
@ -213,6 +251,6 @@ def start_control():
|
||||
control.start()
|
||||
|
||||
|
||||
if __name__ == 'app':
|
||||
if __name__ == "__main__":
|
||||
start_control()
|
||||
app.run(debug=True, host='0.0.0.0', port=8000)
|
||||
|
107
home/config.json
107
home/config.json
@ -1,6 +1,5 @@
|
||||
{
|
||||
"configs":
|
||||
[
|
||||
"configs": [
|
||||
{
|
||||
"id": "hochbeet",
|
||||
"host": "hochbeet",
|
||||
@ -8,16 +7,11 @@
|
||||
"water":
|
||||
{
|
||||
"relay": 2,
|
||||
"autostate": false,
|
||||
"times":
|
||||
[
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "7:00",
|
||||
"off_time": "7:20"
|
||||
},
|
||||
{
|
||||
"on_time": "19:00",
|
||||
"off_time": "19:20"
|
||||
"on_time": "8:00",
|
||||
"off_time": "8:10"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -29,16 +23,91 @@
|
||||
"water":
|
||||
{
|
||||
"relay": 3,
|
||||
"autostate": false,
|
||||
"times":
|
||||
[
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "8:00",
|
||||
"off_time": "9:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "rasen_1",
|
||||
"host": "garten",
|
||||
"port": 64001,
|
||||
"water":
|
||||
{
|
||||
"relay": 3,
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "6:00",
|
||||
"off_time": "6:30"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "wasseranschluss",
|
||||
"host": "garten",
|
||||
"port": 64001,
|
||||
"water":
|
||||
{
|
||||
"relay": 2,
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "6:30",
|
||||
"off_time": "7:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "gewaechshaus",
|
||||
"host": "garten",
|
||||
"port": 64001,
|
||||
"water":
|
||||
{
|
||||
"relay": 1,
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "8:00",
|
||||
"off_time": "8:10"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "rasen_2",
|
||||
"host": "wels",
|
||||
"port": 64001,
|
||||
"water":
|
||||
{
|
||||
"relay": 1,
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "7:30",
|
||||
"off_time": "8:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "rasen_3",
|
||||
"host": "wels",
|
||||
"port": 64001,
|
||||
"water":
|
||||
{
|
||||
"relay": 2,
|
||||
"autostate": true,
|
||||
"times": [
|
||||
{
|
||||
"on_time": "7:00",
|
||||
"off_time": "7:20"
|
||||
},
|
||||
{
|
||||
"on_time": "19:00",
|
||||
"off_time": "19:20"
|
||||
"off_time": "7:30"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
139
home/static/scripts/gewaechshaus.js
Normal file
139
home/static/scripts/gewaechshaus.js
Normal file
@ -0,0 +1,139 @@
|
||||
var on_switch_water = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("water_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "gewaechshaus",
|
||||
"waterstate": state
|
||||
}
|
||||
);
|
||||
patch_sample(json_str);
|
||||
}
|
||||
|
||||
var on_switch_auto_state = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("auto_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "gewaechshaus",
|
||||
"water":
|
||||
{
|
||||
"autostate": state
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on").value;
|
||||
var off_time_one = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "gewaechshaus",
|
||||
"water":
|
||||
{
|
||||
"times":
|
||||
[
|
||||
{
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var http_patch_config = new XMLHttpRequest();
|
||||
http_patch_config.onreadystatechange = function () {
|
||||
if (http_patch_config.readyState === 4) {
|
||||
var status = http_patch_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_patch_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
var patch_config = function(config) {
|
||||
http_patch_config.abort();
|
||||
http_patch_config.open("PATCH", "/config/gewaechshaus");
|
||||
http_patch_config.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
http_patch_config.send(config);
|
||||
}
|
||||
|
||||
var patch_http = new XMLHttpRequest();
|
||||
var patch_sample = function(sample) {
|
||||
patch_http.abort();
|
||||
patch_http.open("PATCH", "/sample/gewaechshaus");
|
||||
patch_http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
patch_http.send(sample);
|
||||
}
|
||||
|
||||
var parse_config = function (event) {
|
||||
var config = JSON.parse(event)
|
||||
var output = "einschalten"
|
||||
var visibility = 'hidden'
|
||||
if(config.water) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
var parse_sample = function (event) {
|
||||
var sample = JSON.parse(event)
|
||||
if(sample.water && sample.water.id == 'gewaechshaus') {
|
||||
var switch_caption = "einschalten";
|
||||
if(sample.water.state) {
|
||||
switch_caption = "ausschalten";
|
||||
}
|
||||
document.getElementById("water_switch").value = switch_caption;
|
||||
}
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === 4) {
|
||||
var status = http.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_sample(http.responseText);
|
||||
setTimeout(function () {
|
||||
http.open("GET", 'sample/gewaechshaus');
|
||||
http.send();
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http.open("GET", "sample/gewaechshaus");
|
||||
http.send();
|
||||
|
||||
var http_get_config = new XMLHttpRequest();
|
||||
http_get_config.onreadystatechange = function () {
|
||||
if (http_get_config.readyState === 4) {
|
||||
var status = http_get_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_get_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http_get_config.open("GET", "config/gewaechshaus");
|
||||
http_get_config.send();
|
@ -30,10 +30,8 @@ var on_switch_auto_state = function() {
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on_one").value;
|
||||
var off_time_one = document.getElementById("water_off_one").value;
|
||||
var on_time_two = document.getElementById("water_on_two").value;
|
||||
var off_time_two = document.getElementById("water_off_two").value;
|
||||
var on_time_one = document.getElementById("water_on").value;
|
||||
var off_time_one = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "hochbeet",
|
||||
@ -42,12 +40,8 @@ var on_change_config = function() {
|
||||
"times":
|
||||
[
|
||||
{
|
||||
"on_time": on_time_one,
|
||||
"off_time": off_time_one
|
||||
},
|
||||
{
|
||||
"on_time": on_time_two,
|
||||
"off_time": off_time_two
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,10 +85,8 @@ var parse_config = function (event) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on_one").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off_one").value = config.water.times[0].off_time;
|
||||
document.getElementById("water_on_two").value = config.water.times[1].on_time;
|
||||
document.getElementById("water_off_two").value = config.water.times[1].off_time;
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
|
139
home/static/scripts/rasen_1.js
Normal file
139
home/static/scripts/rasen_1.js
Normal file
@ -0,0 +1,139 @@
|
||||
var on_switch_water = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("water_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_1",
|
||||
"waterstate": state
|
||||
}
|
||||
);
|
||||
patch_sample(json_str);
|
||||
}
|
||||
|
||||
var on_switch_auto_state = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("auto_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_1",
|
||||
"water":
|
||||
{
|
||||
"autostate": state
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on").value;
|
||||
var off_time_one = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_1",
|
||||
"water":
|
||||
{
|
||||
"times":
|
||||
[
|
||||
{
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var http_patch_config = new XMLHttpRequest();
|
||||
http_patch_config.onreadystatechange = function () {
|
||||
if (http_patch_config.readyState === 4) {
|
||||
var status = http_patch_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_patch_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
var patch_config = function(config) {
|
||||
http_patch_config.abort();
|
||||
http_patch_config.open("PATCH", "/config/rasen_1");
|
||||
http_patch_config.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
http_patch_config.send(config);
|
||||
}
|
||||
|
||||
var patch_http = new XMLHttpRequest();
|
||||
var patch_sample = function(sample) {
|
||||
patch_http.abort();
|
||||
patch_http.open("PATCH", "/sample/rasen_1");
|
||||
patch_http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
patch_http.send(sample);
|
||||
}
|
||||
|
||||
var parse_config = function (event) {
|
||||
var config = JSON.parse(event)
|
||||
var output = "einschalten"
|
||||
var visibility = 'hidden'
|
||||
if(config.water) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
var parse_sample = function (event) {
|
||||
var sample = JSON.parse(event)
|
||||
if(sample.water && sample.water.id == 'rasen_1') {
|
||||
var switch_caption = "einschalten";
|
||||
if(sample.water.state) {
|
||||
switch_caption = "ausschalten";
|
||||
}
|
||||
document.getElementById("water_switch").value = switch_caption;
|
||||
}
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === 4) {
|
||||
var status = http.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_sample(http.responseText);
|
||||
setTimeout(function () {
|
||||
http.open("GET", 'sample/rasen_1');
|
||||
http.send();
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http.open("GET", "sample/rasen_1");
|
||||
http.send();
|
||||
|
||||
var http_get_config = new XMLHttpRequest();
|
||||
http_get_config.onreadystatechange = function () {
|
||||
if (http_get_config.readyState === 4) {
|
||||
var status = http_get_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_get_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http_get_config.open("GET", "config/rasen_1");
|
||||
http_get_config.send();
|
139
home/static/scripts/rasen_2.js
Normal file
139
home/static/scripts/rasen_2.js
Normal file
@ -0,0 +1,139 @@
|
||||
var on_switch_water = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("water_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_2",
|
||||
"waterstate": state
|
||||
}
|
||||
);
|
||||
patch_sample(json_str);
|
||||
}
|
||||
|
||||
var on_switch_auto_state = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("auto_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_2",
|
||||
"water":
|
||||
{
|
||||
"autostate": state
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on").value;
|
||||
var off_time_one = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_2",
|
||||
"water":
|
||||
{
|
||||
"times":
|
||||
[
|
||||
{
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var http_patch_config = new XMLHttpRequest();
|
||||
http_patch_config.onreadystatechange = function () {
|
||||
if (http_patch_config.readyState === 4) {
|
||||
var status = http_patch_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_patch_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
var patch_config = function(config) {
|
||||
http_patch_config.abort();
|
||||
http_patch_config.open("PATCH", "/config/rasen_2");
|
||||
http_patch_config.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
http_patch_config.send(config);
|
||||
}
|
||||
|
||||
var patch_http = new XMLHttpRequest();
|
||||
var patch_sample = function(sample) {
|
||||
patch_http.abort();
|
||||
patch_http.open("PATCH", "/sample/rasen_2");
|
||||
patch_http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
patch_http.send(sample);
|
||||
}
|
||||
|
||||
var parse_config = function (event) {
|
||||
var config = JSON.parse(event)
|
||||
var output = "einschalten"
|
||||
var visibility = 'hidden'
|
||||
if(config.water) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
var parse_sample = function (event) {
|
||||
var sample = JSON.parse(event)
|
||||
if(sample.water && sample.water.id == 'rasen_2') {
|
||||
var switch_caption = "einschalten";
|
||||
if(sample.water.state) {
|
||||
switch_caption = "ausschalten";
|
||||
}
|
||||
document.getElementById("water_switch").value = switch_caption;
|
||||
}
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === 4) {
|
||||
var status = http.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_sample(http.responseText);
|
||||
setTimeout(function () {
|
||||
http.open("GET", 'sample/rasen_2');
|
||||
http.send();
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http.open("GET", "sample/rasen_2");
|
||||
http.send();
|
||||
|
||||
var http_get_config = new XMLHttpRequest();
|
||||
http_get_config.onreadystatechange = function () {
|
||||
if (http_get_config.readyState === 4) {
|
||||
var status = http_get_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_get_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http_get_config.open("GET", "config/rasen_2");
|
||||
http_get_config.send();
|
139
home/static/scripts/rasen_3.js
Normal file
139
home/static/scripts/rasen_3.js
Normal file
@ -0,0 +1,139 @@
|
||||
var on_switch_water = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("water_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_3",
|
||||
"waterstate": state
|
||||
}
|
||||
);
|
||||
patch_sample(json_str);
|
||||
}
|
||||
|
||||
var on_switch_auto_state = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("auto_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_3",
|
||||
"water":
|
||||
{
|
||||
"autostate": state
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on").value;
|
||||
var off_time_one = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "rasen_3",
|
||||
"water":
|
||||
{
|
||||
"times":
|
||||
[
|
||||
{
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var http_patch_config = new XMLHttpRequest();
|
||||
http_patch_config.onreadystatechange = function () {
|
||||
if (http_patch_config.readyState === 4) {
|
||||
var status = http_patch_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_patch_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
var patch_config = function(config) {
|
||||
http_patch_config.abort();
|
||||
http_patch_config.open("PATCH", "/config/rasen_3");
|
||||
http_patch_config.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
http_patch_config.send(config);
|
||||
}
|
||||
|
||||
var patch_http = new XMLHttpRequest();
|
||||
var patch_sample = function(sample) {
|
||||
patch_http.abort();
|
||||
patch_http.open("PATCH", "/sample/rasen_3");
|
||||
patch_http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
patch_http.send(sample);
|
||||
}
|
||||
|
||||
var parse_config = function (event) {
|
||||
var config = JSON.parse(event)
|
||||
var output = "einschalten"
|
||||
var visibility = 'hidden'
|
||||
if(config.water) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
var parse_sample = function (event) {
|
||||
var sample = JSON.parse(event)
|
||||
if(sample.water && sample.water.id == 'rasen_3') {
|
||||
var switch_caption = "einschalten";
|
||||
if(sample.water.state) {
|
||||
switch_caption = "ausschalten";
|
||||
}
|
||||
document.getElementById("water_switch").value = switch_caption;
|
||||
}
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === 4) {
|
||||
var status = http.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_sample(http.responseText);
|
||||
setTimeout(function () {
|
||||
http.open("GET", 'sample/rasen_3');
|
||||
http.send();
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http.open("GET", "sample/rasen_3");
|
||||
http.send();
|
||||
|
||||
var http_get_config = new XMLHttpRequest();
|
||||
http_get_config.onreadystatechange = function () {
|
||||
if (http_get_config.readyState === 4) {
|
||||
var status = http_get_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_get_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http_get_config.open("GET", "config/rasen_3");
|
||||
http_get_config.send();
|
@ -30,24 +30,17 @@ var on_switch_auto_state = function() {
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on_one").value;
|
||||
var off_time_one = document.getElementById("water_off_one").value;
|
||||
var on_time_two = document.getElementById("water_on_two").value;
|
||||
var off_time_two = document.getElementById("water_off_two").value;
|
||||
var on_time = document.getElementById("water_on").value;
|
||||
var off_time = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "tomatentuppen",
|
||||
"water":
|
||||
{
|
||||
"times":
|
||||
[
|
||||
"times": [
|
||||
{
|
||||
"on_time": on_time_one,
|
||||
"off_time": off_time_one
|
||||
},
|
||||
{
|
||||
"on_time": on_time_two,
|
||||
"off_time": off_time_two
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -91,10 +84,8 @@ var parse_config = function (event) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on_one").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off_one").value = config.water.times[0].off_time;
|
||||
document.getElementById("water_on_two").value = config.water.times[1].on_time;
|
||||
document.getElementById("water_off_two").value = config.water.times[1].off_time;
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
|
139
home/static/scripts/wasseranschluss.js
Normal file
139
home/static/scripts/wasseranschluss.js
Normal file
@ -0,0 +1,139 @@
|
||||
var on_switch_water = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("water_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "wasseranschluss",
|
||||
"waterstate": state
|
||||
}
|
||||
);
|
||||
patch_sample(json_str);
|
||||
}
|
||||
|
||||
var on_switch_auto_state = function() {
|
||||
var state = true;
|
||||
if(document.getElementById("auto_switch").value == "ausschalten") {
|
||||
state = false;
|
||||
}
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "wasseranschluss",
|
||||
"water":
|
||||
{
|
||||
"autostate": state
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var on_change_config = function() {
|
||||
var on_time_one = document.getElementById("water_on").value;
|
||||
var off_time_one = document.getElementById("water_off").value;
|
||||
var json_str = JSON.stringify(
|
||||
{
|
||||
"id": "wasseranschluss",
|
||||
"water":
|
||||
{
|
||||
"times":
|
||||
[
|
||||
{
|
||||
"on_time": on_time,
|
||||
"off_time": off_time
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
);
|
||||
patch_config(json_str);
|
||||
}
|
||||
|
||||
var http_patch_config = new XMLHttpRequest();
|
||||
http_patch_config.onreadystatechange = function () {
|
||||
if (http_patch_config.readyState === 4) {
|
||||
var status = http_patch_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_patch_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
var patch_config = function(config) {
|
||||
http_patch_config.abort();
|
||||
http_patch_config.open("PATCH", "/config/wasseranschluss");
|
||||
http_patch_config.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
http_patch_config.send(config);
|
||||
}
|
||||
|
||||
var patch_http = new XMLHttpRequest();
|
||||
var patch_sample = function(sample) {
|
||||
patch_http.abort();
|
||||
patch_http.open("PATCH", "/sample/wasseranschluss");
|
||||
patch_http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||
patch_http.send(sample);
|
||||
}
|
||||
|
||||
var parse_config = function (event) {
|
||||
var config = JSON.parse(event)
|
||||
var output = "einschalten"
|
||||
var visibility = 'hidden'
|
||||
if(config.water) {
|
||||
if(config.water.autostate) {
|
||||
output = "ausschalten"
|
||||
visibility = "visible"
|
||||
document.getElementById("water_on").value = config.water.times[0].on_time;
|
||||
document.getElementById("water_off").value = config.water.times[0].off_time;
|
||||
}
|
||||
document.getElementById("auto_switch").value = output;
|
||||
document.getElementById("water_times").style.visibility = visibility
|
||||
}
|
||||
}
|
||||
|
||||
var parse_sample = function (event) {
|
||||
var sample = JSON.parse(event)
|
||||
if(sample.water && sample.water.id == 'wasseranschluss') {
|
||||
var switch_caption = "einschalten";
|
||||
if(sample.water.state) {
|
||||
switch_caption = "ausschalten";
|
||||
}
|
||||
document.getElementById("water_switch").value = switch_caption;
|
||||
}
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
http.onreadystatechange = function () {
|
||||
if (http.readyState === 4) {
|
||||
var status = http.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_sample(http.responseText);
|
||||
setTimeout(function () {
|
||||
http.open("GET", 'sample/wasseranschluss');
|
||||
http.send();
|
||||
}, 500);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http.open("GET", "sample/wasseranschluss");
|
||||
http.send();
|
||||
|
||||
var http_get_config = new XMLHttpRequest();
|
||||
http_get_config.onreadystatechange = function () {
|
||||
if (http_get_config.readyState === 4) {
|
||||
var status = http_get_config.status;
|
||||
if (status === 0 || (status >= 200 && status < 400)) {
|
||||
// The request has been completed successfully
|
||||
parse_config(http_get_config.responseText);
|
||||
}
|
||||
} else {
|
||||
// request error
|
||||
}
|
||||
}
|
||||
http_get_config.open("GET", "config/wasseranschluss");
|
||||
http_get_config.send();
|
61
home/templates/gewaechshaus.html
Normal file
61
home/templates/gewaechshaus.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Gewächshaus</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<script src="/static/scripts/gewaechshaus.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Gewächshaus</h1>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td class="left">Bewässerung</td>
|
||||
<td class="input">
|
||||
<input id="water_switch" type="submit" value="" onclick="on_switch_water()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left">Zeigesteuerte Bewässerung </td>
|
||||
<td class="input">
|
||||
<input id="auto_switch" type="submit" value="einschalten" onclick="on_switch_auto_state()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</html>
|
@ -26,38 +26,18 @@
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>Vormittag</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on_one" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off_one" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nachmittag</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on_two" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off_two" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -69,6 +49,11 @@
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
|
@ -17,6 +17,11 @@
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
|
61
home/templates/rasen_1.html
Normal file
61
home/templates/rasen_1.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rasen 1</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<script src="/static/scripts/rasen_1.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Rasen 1</h1>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td class="left">Bewässerung</td>
|
||||
<td class="input">
|
||||
<input id="water_switch" type="submit" value="" onclick="on_switch_water()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left">Zeigesteuerte Bewässerung </td>
|
||||
<td class="input">
|
||||
<input id="auto_switch" type="submit" value="einschalten" onclick="on_switch_auto_state()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</html>
|
61
home/templates/rasen_2.html
Normal file
61
home/templates/rasen_2.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rasen 2</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<script src="/static/scripts/rasen_2.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Rasen 2</h1>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td class="left">Bewässerung</td>
|
||||
<td class="input">
|
||||
<input id="water_switch" type="submit" value="" onclick="on_switch_water()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left">Zeigesteuerte Bewässerung </td>
|
||||
<td class="input">
|
||||
<input id="auto_switch" type="submit" value="einschalten" onclick="on_switch_auto_state()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</html>
|
61
home/templates/rasen_3.html
Normal file
61
home/templates/rasen_3.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Rasen 3</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<script src="/static/scripts/rasen_3.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Rasen 3</h1>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td class="left">Bewässerung</td>
|
||||
<td class="input">
|
||||
<input id="water_switch" type="submit" value="" onclick="on_switch_water()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left">Zeigesteuerte Bewässerung </td>
|
||||
<td class="input">
|
||||
<input id="auto_switch" type="submit" value="einschalten" onclick="on_switch_auto_state()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</html>
|
@ -26,38 +26,18 @@
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>Vormittag</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on_one" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off_one" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nachmittag</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on_two" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off_two" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -69,6 +49,11 @@
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
|
61
home/templates/wasseranschluss.html
Normal file
61
home/templates/wasseranschluss.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Wasseranschluss</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="/static/css/style.css" rel="stylesheet">
|
||||
<script src="/static/scripts/wasseranschluss.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Wasseranschluss</h1>
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td class="left">Bewässerung</td>
|
||||
<td class="input">
|
||||
<input id="water_switch" type="submit" value="" onclick="on_switch_water()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="left">Zeigesteuerte Bewässerung </td>
|
||||
<td class="input">
|
||||
<input id="auto_switch" type="submit" value="einschalten" onclick="on_switch_auto_state()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="water_times" style="visibility:hidden;">
|
||||
<table class="center">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>Einschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_on" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Ausschaltzeit</td>
|
||||
<td class="input">
|
||||
<input type="text" id="water_off" style="width: 70px;" onchange="on_change_config()"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<footer>
|
||||
<nav>
|
||||
<a href="/">Home</a> | 
|
||||
<a href="/rasen_1" class="center">Rasen 1</a> | 
|
||||
<a href="/rasen_2" class="center">Rasen 2</a> | 
|
||||
<a href="/rasen_3" class="center">Rasen 3</a> | 
|
||||
<a href="/gewaechshaus" class="center">Gewächshaus</a> | 
|
||||
<a href="/wasseranschluss" class="center">Wasseranschluss</a> | 
|
||||
<a href="/hochbeet" class="center">Hochbeet</a> | 
|
||||
<a href="/tomatentuppen" class="center">Tomatentuppen</a>
|
||||
</nav>
|
||||
</footer>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user