初始化提交
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="236.64082"
|
||||
height="86.640839"
|
||||
rx="15.946075"
|
||||
ry="15.666504"
|
||||
x="6.6795802"
|
||||
y="959.03809"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:0;stroke:#000000;stroke-width:13.35916042;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="236.64082"
|
||||
height="86.640839"
|
||||
rx="15.946075"
|
||||
ry="15.666504"
|
||||
x="6.6795802"
|
||||
y="959.03809"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:1;stroke:#000000;stroke-width:13.35916042;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="230.92926"
|
||||
height="180.92929"
|
||||
rx="22.392242"
|
||||
ry="22.274536"
|
||||
x="9.5353565"
|
||||
y="861.89758"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:0;stroke:#000000;stroke-width:19.07071304;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="230.92926"
|
||||
height="180.92929"
|
||||
rx="22.392242"
|
||||
ry="22.274536"
|
||||
x="9.5353565"
|
||||
y="861.89758"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:1;stroke:#000000;stroke-width:19.07071304;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="226.6387"
|
||||
height="276.63873"
|
||||
rx="36.69751"
|
||||
ry="40.173462"
|
||||
x="11.680637"
|
||||
y="764.04285"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:0;stroke:#000000;stroke-width:23.36127472;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="226.6387"
|
||||
height="276.63873"
|
||||
rx="36.69751"
|
||||
ry="40.173462"
|
||||
x="11.680637"
|
||||
y="764.04285"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:1;stroke:#000000;stroke-width:23.36127472;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="223.08398"
|
||||
height="373.08401"
|
||||
rx="40.059196"
|
||||
ry="46.087463"
|
||||
x="13.458"
|
||||
y="665.82019"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:0;stroke:#000000;stroke-width:26.91600037;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
version="1.1"
|
||||
width="250"
|
||||
height="500"
|
||||
id="svg2">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="linearGradient4457">
|
||||
<stop
|
||||
id="stop4459"
|
||||
style="stop-color:#0000ff;stop-opacity:1"
|
||||
offset="0" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(0,-552.36218)"
|
||||
id="layer1">
|
||||
<rect
|
||||
width="223.08398"
|
||||
height="373.08401"
|
||||
rx="40.059196"
|
||||
ry="46.087463"
|
||||
x="13.458"
|
||||
y="665.82019"
|
||||
id="rect2995"
|
||||
style="opacity:0.87999998;fill:#46b8da;fill-opacity:1;stroke:#000000;stroke-width:26.91600037;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:35.90000153;stroke-opacity:1;stroke-dasharray:none" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,109 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Home Temperature</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
|
||||
<style type="text/css">
|
||||
body { padding-top: 70px; }
|
||||
</style>
|
||||
|
||||
<!-- Font Awsome -->
|
||||
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<!--page content-->
|
||||
<body>
|
||||
<div class='container'>
|
||||
|
||||
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-brand">
|
||||
<p>AC Control</p>
|
||||
</div>
|
||||
<p class="navbar-text navbar-right sr-only" id="spinner"><i class="fa fa-circle-o-notch fa-spin fa-lg"></i></p>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="alert alert-danger sr-only" id="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<p></p>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<!-- ON/OFF -->
|
||||
<div class="col-sm-offset-10 col-sm-2 pull-right">
|
||||
<a id="power-btn" class="btn btn-default" onclick='power_onclick();'><i class="fa fa-power-off" style="font-size:1.6em;color:black;"></i><b style="font-size:1.5em;" id="power"> OFF</b></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6">
|
||||
|
||||
<!-- Mode -->
|
||||
<h4>Mode</h4>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default mode-btn" id="mode_cooling" onclick='mode_onclick(1);'><i class="fa fa-asterisk fa-2x"></i></a>
|
||||
<a class="btn btn-default mode-btn" id="mode_dehum" onclick='mode_onclick(2);'><i class="fa fa-tint fa-2x"></i></a>
|
||||
<a class="btn btn-default mode-btn" id="mode_heating" onclick='mode_onclick(3);'><i class="fa fa-sun-o fa-2x"></i></a>
|
||||
<a class="btn btn-default mode-btn" id="mode_fan" onclick='mode_onclick(4);'><i class="fa fa-retweet fa-2x"></i></a>
|
||||
<a class="btn btn-default mode-btn" id="mode_auto" onclick='mode_onclick(0);'><i class="fa fa-font fa-2x"></i></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-4 col-sm-6">
|
||||
|
||||
<!-- Fan -->
|
||||
<h4>Fan</h4>
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default fan-btn" id="fan_auto" onclick='fan_onclick("0");'><i class="fa fa-font fa-2x"></i></a>
|
||||
<a class="btn btn-default" onclick='fan_onclick(1);'><img src="level_1_off.svg" height="29px" id="fan_lvl_1"></a>
|
||||
<a class="btn btn-default" onclick='fan_onclick(2);'><img src="level_2_off.svg" height="29px" id="fan_lvl_2"></a>
|
||||
<a class="btn btn-default" onclick='fan_onclick(3);'><img src="level_3_off.svg" height="29px" id="fan_lvl_3"></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-6" id="target_temp_col">
|
||||
|
||||
<!--Target temperature-->
|
||||
<h4>Target temperature</h4>
|
||||
<div class="btn-group" >
|
||||
<a class="btn btn-default" style="font-size:2.2em;padding-top:12px;padding-bottom:12px;"><b id="target_temp"> ~ C</b></a>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-vertical">
|
||||
<a class="btn btn-default wing-btn" id="target_temp_up" onclick='temp_onclick(1);' style="font-size:1.7em;padding-top:0px;padding-bottom:0px;"><i class="fa fa-chevron-up"></i></a>
|
||||
<a class="btn btn-default wing-btn" id="target_temp_down" onclick='temp_onclick(-1);' style="font-size:1.7em;padding-top:0px;padding-bottom:0px;"><i class="fa fa-chevron-down"></i></a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="ui.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,132 @@
|
||||
var state = {}
|
||||
|
||||
function updateStatus() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: "state",
|
||||
dataType: "json",
|
||||
data: [{
|
||||
name: "light",
|
||||
value: "1"
|
||||
}, ],
|
||||
success: function(data) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
state = data;
|
||||
if (state["power"] === true) {
|
||||
$("#power").text(" ON");
|
||||
$("#power-btn").addClass("btn-info");
|
||||
$("#power-btn").removeClass("btn-default");
|
||||
} else {
|
||||
$("#power").text(" OFF");
|
||||
$("#power-btn").addClass("btn-default");
|
||||
$("#power-btn").removeClass("btn-info");
|
||||
}
|
||||
$("#target_temp").text(state["temp"] + " C");
|
||||
setModeColor(state["mode"]);
|
||||
setFanColor(state["fan"]);
|
||||
},
|
||||
error: function() {
|
||||
console.log('error getting state');
|
||||
},
|
||||
timeout: 1000
|
||||
});
|
||||
}
|
||||
|
||||
updateStatus();
|
||||
|
||||
|
||||
|
||||
|
||||
function postData(t) {
|
||||
var e = new XMLHttpRequest;
|
||||
e.timeout = 2000;
|
||||
e.open("PUT", "state", !0);
|
||||
e.setRequestHeader("Content-Type", "application/json");
|
||||
console.log(JSON.stringify(t)), e.send(JSON.stringify(t));
|
||||
}
|
||||
|
||||
function mode_onclick(mode) {
|
||||
state["mode"] = mode;
|
||||
setModeColor(mode);
|
||||
postData(state);
|
||||
}
|
||||
|
||||
|
||||
function setModeColor(mode) {
|
||||
$(".mode-btn").addClass("btn-default");
|
||||
$(".mode-btn").removeClass("btn-info");
|
||||
|
||||
if (mode === 0) {
|
||||
$("#mode_auto").removeClass("btn-default");
|
||||
$("#mode_auto").addClass("btn-info");
|
||||
setFanColor(0);
|
||||
state["fan"] = 0;
|
||||
} else if (mode === 1) {
|
||||
$("#mode_cooling").removeClass("btn-default");
|
||||
$("#mode_cooling").addClass("btn-info");
|
||||
} else if (mode === 2) {
|
||||
$("#mode_dehum").removeClass("btn-default");
|
||||
$("#mode_dehum").addClass("btn-info");
|
||||
} else if (mode === 3) {
|
||||
$("#mode_heating").removeClass("btn-default");
|
||||
$("#mode_heating").addClass("btn-info");
|
||||
} else if (mode === 4) {
|
||||
$("#mode_fan").removeClass("btn-default");
|
||||
$("#mode_fan").addClass("btn-info");
|
||||
}
|
||||
}
|
||||
|
||||
function setFanColor(fan) {
|
||||
if (fan == 0) {
|
||||
$("#fan_auto").removeClass("btn-default");
|
||||
$("#fan_auto").addClass("btn-info");
|
||||
} else {
|
||||
$("#fan_auto").removeClass("btn-info");
|
||||
$("#fan_auto").addClass("btn-default");
|
||||
}
|
||||
for (var i = 1; i <= 3; ++i) {
|
||||
if (i <= fan) {
|
||||
$("#fan_lvl_" + i).attr("src", "level_" + i + "_on.svg");
|
||||
} else {
|
||||
$("#fan_lvl_" + i).attr("src", "level_" + i + "_off.svg");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fan_onclick(fan) {
|
||||
if (state["mode"] !== 0) {
|
||||
state["fan"] = fan;
|
||||
setFanColor(fan);
|
||||
postData(state);
|
||||
}
|
||||
}
|
||||
|
||||
function power_onclick(power) {
|
||||
if (state["power"]) {
|
||||
state["power"] = false;
|
||||
$("#power").text(" OFF");
|
||||
$("#power-btn").removeClass("btn-info");
|
||||
$("#power-btn").addClass("btn-default");
|
||||
} else {
|
||||
state["power"] = true;
|
||||
$("#power").text(" ON");
|
||||
$("#power-btn").addClass("btn-info");
|
||||
$("#power-btn").removeClass("btn-default");
|
||||
}
|
||||
postData(state);
|
||||
}
|
||||
|
||||
|
||||
function temp_onclick(temp) {
|
||||
state["temp"] += temp;
|
||||
if (state["temp"] < 17) {
|
||||
state["temp"] = 17;
|
||||
}
|
||||
if (state["temp"] > 30) {
|
||||
state["temp"] = 30;
|
||||
}
|
||||
$("#target_temp").text(state["temp"] + " C");
|
||||
postData(state);
|
||||
}
|
||||