work day updates

This commit is contained in:
Karl Hudgell 2019-07-16 09:51:11 +01:00
parent 57ff3dbf6a
commit 50ff77fba6
4 changed files with 548 additions and 551 deletions

1069
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -55,15 +55,16 @@ orvibo.on('plugDisconnectedWithError', ({uid, name }) => {
orvibo.startServer();
app.get('/', (req, res) => {
let sockets = orvibo.getConnectedSocket();
// let sockets = orvibo.getConnectedSocket();
let sockets = [{name: "Plug1", state: 1, uid: "222222"},{name: "Plug2", state: 0, uid: "111111"}]
sockets.forEach(socket => {
switch(socket.state) {
case 1:
socket.status = 'off'
socket.state = 'off'
break;
case 0:
socket.status = 'on'
socket.state = 'on'
break;
default:
}

View File

@ -36,7 +36,7 @@ body {
margin-bottom: 5px;
}
.button {
.button-off {
height: 50px;
line-height: 50px;
width: 100%;
@ -44,4 +44,16 @@ body {
text-align: center;
font-size: 20px;
box-shadow: 1px 1px black;
color: red
}
.button-on {
height: 50px;
line-height: 50px;
width: 100%;
text-decoration: none;
text-align: center;
font-size: 20px;
box-shadow: 1px 1px black;
color: green;
}

View File

@ -9,6 +9,9 @@ block content
h2.socket-name
| #{socket.uid}
h2.socket-name
| #{socket.status}
a.button(href=`/?uid=${socket.uid}`)
| Toggle
if socket.state === 1
a.button-on(href=`/?uid=${socket.uid}`)
| #{socket.state}
else
a.button-off(href=`/?uid=${socket.uid}`)
| #{socket.state}