Uploaded door sensor #15
Labels
No Label
art
big
blocked
bug
crash report
disputed
documentation
duplicate
feature request
good first issue
packaging
question
security
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Projects/nettsiden#15
Loading…
Reference in New Issue
No description provided.
Delete Branch "doorsensor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Good work, men oppdater gjerne
dist/sql_config_example.php
med ett eksempel bearer token.Why no cast to int and bool here?
@ -0,0 +54,4 @@
];
}
private function removeOld() {
nice, relational databases don't scale well with a lot of timeseries data
how often is it run?
@ -14,0 +15,4 @@
echo '{"status": "error", "message": "Invalid authentication key"}';
die();
}
} else {
i assume this will work in lighttpd
@ -14,0 +17,4 @@
}
} else {
echo '{"status": "error", "message": "Invalid authentication method"}';
die();
should include the space after "Bearer"
@ -14,1 +18,4 @@
} else {
echo '{"status": "error", "message": "Invalid authentication method"}';
die();
}
Where is
doorSensorSecret
set?This could be made to be only visible when more than x minutes old.
If within reason, show it only on mouseover on desktop.
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
What happens here if the table is empty?
@ -0,0 +54,4 @@
];
}
private function removeOld() {
The Raspberry Pi(Probaly ESP8266 later) posts the door state once every 15 minutes and immediately if the state changes.
4 times an hour * 24 * 7 = 672, so the database currently stores approximately 700 elements. Can be greatly reduced by only storing actual changes...
@ -14,1 +18,4 @@
} else {
echo '{"status": "error", "message": "Invalid authentication method"}';
die();
}
In sql_config.php, appended a dummy in sql_config_example.php
@ -0,0 +54,4 @@
];
}
private function removeOld() {
ah, it's called in createEvent
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
Tested and checked, door.php exhbits the preferred behaviour even with an empty table; getCurrent() returns time=0 and open=false, and getEntriesAfter returns entries=[].
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
So i assume $row is an empty map, and accessing it returns null, which gets cast into 0 and False?
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
Correct, I check all types coming in, and extensively cast everything to the correct type before JSON encoding. Only ints(here cast to 0) and bools(here cast to false) can be returned as far as I can see.