Skip to content

Commit

Permalink
validuntil should work now #151
Browse files Browse the repository at this point in the history
  • Loading branch information
omersiar committed Sep 3, 2018
1 parent 86a246e commit 26c4dde
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.8.1]
## [Unreleased 0.8.2]
#### Added
- [firmware] log for firmware update #152
- [webui] Expired access attempts logged as "Expired"

#### Fixed
- [firmware] validuntil is being ignored #151

## [0.8.1] 2018-09-01
#### Added
- [firmware] Global websocket message to inform ws clients to toggle relay (upcoming client version will use it)
- [webui] incremental id for event log
Expand Down
25 changes: 20 additions & 5 deletions src/rfid.esp
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,28 @@ void ICACHE_FLASH_ATTR rfidloop() {
Serial.print(username);
#endif
if (AccType == 1) {
activateRelay = true;
ws.textAll("{\"command\":\"giveAccess\"}");
unsigned long validL = json["validuntil"];
unsigned long nowL = now();

if (validL > nowL ) {
activateRelay = true;
ws.textAll("{\"command\":\"giveAccess\"}");
#ifdef DEBUG
Serial.println(" have access");
Serial.println(" have access");
#endif
if (mqttenabled == 1) {
mqtt_publish_access(now(), "true", "Always", username, uid);
if (mqttenabled == 1) {
mqtt_publish_access(now(), "true", "Always", username, uid);
}
}

else {
#ifdef DEBUG
Serial.println(" expired");
#endif
if (mqttenabled == 1) {
mqtt_publish_access(now(), "true", "Expired", username, uid);
}
AccType = 2;
}
} else if (AccType == 99) {
doEnableWifi = true;
Expand Down
Loading

0 comments on commit 26c4dde

Please sign in to comment.