Uploaded door sensor #15

Merged
felixalbrigtsen merged 2 commits from doorsensor into master 2021-09-08 22:23:38 +02:00
felixalbrigtsen commented 2021-09-04 17:01:39 +02:00 (Migrated from github.com)
No description provided.
SondreElg (Migrated from github.com) reviewed 2021-09-04 17:01:39 +02:00
pbsds (Migrated from github.com) requested changes 2021-09-08 18:58:44 +02:00
pbsds (Migrated from github.com) left a comment

Good work, men oppdater gjerne dist/sql_config_example.php med ett eksempel bearer token.

Good work, men oppdater gjerne [`dist/sql_config_example.php`](https://github.com/Programvareverkstedet/nettsiden/blob/master/dist/sql_config_example.php) med ett eksempel bearer token.
pbsds (Migrated from github.com) commented 2021-09-08 18:36:53 +02:00

Why no cast to int and bool here?

Why no cast to int and bool here?
@ -0,0 +54,4 @@
];
}
private function removeOld() {
pbsds (Migrated from github.com) commented 2021-09-08 18:44:51 +02:00

nice, relational databases don't scale well with a lot of timeseries data

how often is it run?

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 {
pbsds (Migrated from github.com) commented 2021-09-08 18:46:05 +02:00

i assume this will work in lighttpd

i assume this will work in lighttpd
@ -14,0 +17,4 @@
}
} else {
echo '{"status": "error", "message": "Invalid authentication method"}';
die();
pbsds (Migrated from github.com) commented 2021-09-08 18:46:54 +02:00

should include the space after "Bearer"

should include the space after "Bearer"
@ -14,1 +18,4 @@
} else {
echo '{"status": "error", "message": "Invalid authentication method"}';
die();
}
pbsds (Migrated from github.com) commented 2021-09-08 18:51:07 +02:00

Where is doorSensorSecret set?

Where is `doorSensorSecret` set?
pbsds (Migrated from github.com) commented 2021-09-08 18:56:36 +02:00

This could be made to be only visible when more than x minutes old.
If within reason, show it only on mouseover on desktop.

This could be made to be only visible when more than x minutes old. If within reason, show it only on [mouseover](https://www.w3schools.com/tags/att_global_title.asp#:~:text=HTML%20title%20Attribute&text=The%20title%20attribute%20specifies%20extra,it%20is%20not%20necessarily%20useful) on desktop.
pbsds (Migrated from github.com) requested changes 2021-09-08 19:00:42 +02:00
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
pbsds (Migrated from github.com) commented 2021-09-08 19:00:19 +02:00

What happens here if the table is empty?

What happens here if the table is empty?
felixalbrigtsen (Migrated from github.com) reviewed 2021-09-08 19:19:50 +02:00
@ -0,0 +54,4 @@
];
}
private function removeOld() {
felixalbrigtsen (Migrated from github.com) commented 2021-09-08 19:19:50 +02:00

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...

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...
felixalbrigtsen (Migrated from github.com) reviewed 2021-09-08 19:27:08 +02:00
@ -14,1 +18,4 @@
} else {
echo '{"status": "error", "message": "Invalid authentication method"}';
die();
}
felixalbrigtsen (Migrated from github.com) commented 2021-09-08 19:27:08 +02:00

In sql_config.php, appended a dummy in sql_config_example.php

In sql_config.php, appended a dummy in sql_config_example.php
pbsds (Migrated from github.com) reviewed 2021-09-08 20:26:06 +02:00
@ -0,0 +54,4 @@
];
}
private function removeOld() {
pbsds (Migrated from github.com) commented 2021-09-08 20:26:06 +02:00

ah, it's called in createEvent

ah, it's called in createEvent
felixalbrigtsen (Migrated from github.com) reviewed 2021-09-08 20:26:53 +02:00
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
felixalbrigtsen (Migrated from github.com) commented 2021-09-08 20:26:53 +02:00

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=[].

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=[].
pbsds (Migrated from github.com) reviewed 2021-09-08 20:29:30 +02:00
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
pbsds (Migrated from github.com) commented 2021-09-08 20:29:30 +02:00

So i assume $row is an empty map, and accessing it returns null, which gets cast into 0 and False?

So i assume $row is an empty map, and accessing it returns null, which gets cast into 0 and False?
felixalbrigtsen (Migrated from github.com) reviewed 2021-09-08 21:27:11 +02:00
@ -0,0 +43,4 @@
return $doorEvents;
}
public function getCurrent() {
felixalbrigtsen (Migrated from github.com) commented 2021-09-08 21:27:11 +02:00

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.

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.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Projects/nettsiden#15
No description provided.