created data folder to host website
This commit is contained in:
parent
051e246f0a
commit
47ffa00851
BIN
CrabbyHome-comp/CrabbyHome-conn/data/Icon2.ico
Normal file
BIN
CrabbyHome-comp/CrabbyHome-conn/data/Icon2.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
113
CrabbyHome-comp/CrabbyHome-conn/data/Styles.css
Normal file
113
CrabbyHome-comp/CrabbyHome-conn/data/Styles.css
Normal file
@ -0,0 +1,113 @@
|
||||
body {
|
||||
background-image: url("background.jpg");
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.logo-row, .name {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 190px;
|
||||
height: 190px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
margin-left: 2vw;
|
||||
margin-right: 2vw;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-auto-rows: 1fr 1fr;
|
||||
grid-gap: 2vw;
|
||||
}
|
||||
li {
|
||||
list-style-type: none;
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.box {
|
||||
background-color: rgba(177, 97, 39, 0.7);
|
||||
border-radius: 15px;
|
||||
float: left;
|
||||
|
||||
border: 5px solid rgb(119, 63, 22);
|
||||
padding: 10px;
|
||||
box-shadow: 5px 10px rgb(51, 27, 9, 0.8);
|
||||
|
||||
}
|
||||
|
||||
.button{
|
||||
width: 30%;
|
||||
margin: auto;
|
||||
padding: 15px 25px;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
/* box-shadow: 0 9px #999; */
|
||||
}
|
||||
|
||||
.small-button{
|
||||
background-color: red;
|
||||
width: 15%;
|
||||
/* margin: auto; */
|
||||
padding: 15px 25px;
|
||||
font-size: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 40px;
|
||||
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
right: 20px;
|
||||
/* box-shadow: 0 9px #999; */
|
||||
}
|
||||
|
||||
.light-button-on {
|
||||
background-color: #4caf4fce;
|
||||
}
|
||||
|
||||
.light-button-on:hover {
|
||||
background-color: #00a305ce;
|
||||
}
|
||||
|
||||
/* .button:hover {background-color: #941414}
|
||||
|
||||
.button:active {
|
||||
background-color: #3e8e41;
|
||||
box-shadow: 0 5px #666;
|
||||
transform: translateY(4px);
|
||||
} */
|
||||
|
||||
.light-button-off {
|
||||
background-color: #af4c4ccc;
|
||||
cursor: url("kksign.png"), pointer;
|
||||
}
|
||||
|
||||
.light-button-off:hover {
|
||||
background-color: #910101cc;
|
||||
cursor: url("kksign.png");
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #a9322c ;
|
||||
text-shadow: 2px 2px black;
|
||||
}
|
||||
|
||||
.text {
|
||||
color: black;
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.c {
|
||||
grid-column: 1 / 3;
|
||||
}
|
BIN
CrabbyHome-comp/CrabbyHome-conn/data/background.jpg
Normal file
BIN
CrabbyHome-comp/CrabbyHome-conn/data/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 80 KiB |
63
CrabbyHome-comp/CrabbyHome-conn/data/index.html
Normal file
63
CrabbyHome-comp/CrabbyHome-conn/data/index.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"></htmllang>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>KrabbyHome</title>
|
||||
<link rel="shortcut icon" href="Icon2.ico"/>
|
||||
<link rel="stylesheet" href="Styles.css"/>
|
||||
|
||||
<div class="logo-row">
|
||||
<img src="kksign.png" alt="logo" class="logo">
|
||||
</div>
|
||||
|
||||
</head>
|
||||
|
||||
<!--Hier kan je alles aan en uit zetten-->
|
||||
<body>
|
||||
<div class="grid-container">
|
||||
<div class="box a">
|
||||
<h1 class="name" >Karen</h1>
|
||||
|
||||
<div class="button" id="ambiance-light-btn">Ambient lights</div>
|
||||
<!-- <div class="small-button" id="all-on-light-btn">All lights</div>
|
||||
<div class="small-button" id="all-off-light-btn">All lights</div> -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!--Deze laat informatie zien als temperatuur enzo-->
|
||||
<div class="box b">
|
||||
<h1 class="name" >Secret formula</h1>
|
||||
|
||||
<ul class="text">
|
||||
<li class="digital-clock">Local time: .. AM</li>
|
||||
<li class="temp">Temperature: ..C</li>
|
||||
<li class="hum">Humidity: ..%</li>
|
||||
<!-- <li class="motion">No motion detected</li> -->
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<!--Taken voor je dag-->
|
||||
<div class="box c">
|
||||
<h1 class="name" >To-do list</h1>
|
||||
|
||||
<ul class="text">
|
||||
<li>Coffee</li>
|
||||
<li>Tea</li>
|
||||
<li>Milk</li>
|
||||
<li>Milk</li>
|
||||
<li>Milk</li>
|
||||
<li>Milk</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
</html>
|
88
CrabbyHome-comp/CrabbyHome-conn/data/index.js
Normal file
88
CrabbyHome-comp/CrabbyHome-conn/data/index.js
Normal file
@ -0,0 +1,88 @@
|
||||
const endpoint = "http://192.168.178.103";
|
||||
let datas = {};
|
||||
$(document).ready(function(){
|
||||
console.log("once");
|
||||
setInterval(() => {
|
||||
myTimer();
|
||||
getData();
|
||||
}, 1000);
|
||||
|
||||
|
||||
$("#ambiance-light-btn").click(function() {
|
||||
if (datas.state.ambiance_light == true) {
|
||||
$.get(`${endpoint}/api/device?id=ambiance_light&action=off&data=-`, (data) => {
|
||||
$("#ambiance-light-btn").addClass("light-button-off");
|
||||
$("#ambiance-light-btn").removeClass("light-button-on");
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (datas.state.ambiance_light == false) {
|
||||
$.get(`${endpoint}/api/device?id=ambiance_light&action=on&data=-`, (data) => {
|
||||
$("#ambiance-light-btn").addClass("light-button-on");
|
||||
$("#ambiance-light-btn").removeClass("light-button-off");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// $.get(`${endpoint}/api/device?id=ambiance_light&action=on&data=-`, (data) => {
|
||||
|
||||
// });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function myTimer() {
|
||||
var d = new Date();
|
||||
$('.digital-clock').text("Local Time: " + d.toLocaleTimeString());
|
||||
}
|
||||
|
||||
|
||||
function getData() {
|
||||
$.get(`${endpoint}/api/currentstate`, ( data ) => {
|
||||
// set all data from api
|
||||
if(data.state){
|
||||
// set climate info
|
||||
$('.temp').text("Temperature: " + data.state.main_temp + "C");
|
||||
$('.hum').text("Humidity: " + data.state.main_hum + "%");
|
||||
|
||||
// set text for motion
|
||||
if(data.state.motion){
|
||||
$('.motion').text("Motion detected!");
|
||||
}else if(!data.state.motion){
|
||||
$('.motion').text("No motion detected");
|
||||
}
|
||||
|
||||
// insert once
|
||||
if(jQuery.isEmptyObject(datas)){
|
||||
|
||||
// set lights state
|
||||
if(data.state.ambiance_light){
|
||||
$("#ambiance-light-btn").addClass("light-button-on");
|
||||
}else if(!data.state.ambiance_light){
|
||||
$("#ambiance-light-btn").addClass("light-button-off");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
datas = data;
|
||||
console.log(datas);
|
||||
console.log( "Load was performed." );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function turnLights(){
|
||||
if (currentState.main_light) {
|
||||
if (currentState.main_light == true) {
|
||||
$.get(`${endpoint}/api/device?id=ambiance_light&action=off&data=-`, (data) => {
|
||||
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$.get(`${endpoint}/api/device?id=ambiance_light&action=on&data=-`, (data) => {
|
||||
|
||||
});
|
||||
}
|
BIN
CrabbyHome-comp/CrabbyHome-conn/data/kksign.png
Normal file
BIN
CrabbyHome-comp/CrabbyHome-conn/data/kksign.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
Loading…
x
Reference in New Issue
Block a user