This is intended to work with the Google Wifi applet on If This Then That (IFTTT) to log when specific devices connect and disconnect from the wifi network. It exposes two endpoints, both POSTs.
Note: We calculate connection/disconnection time server-side. This isn't the best way to do this, but this is for fun, after all.
This marks the start of a connection of a device with name deviceName
.
This marks the end of a connection for a device with name deviceName
.
To use this, create a webtask, add npm package mongodb
at version 2.2.33
, and paste in the contents of the JS file.
Set the Google Wifi channels to post to the respective endpoints for start and end.
You'll need to set the following secrets in your webtask editor:
mongo.uri
- A mongo connection string pointing to a database. (mLab is a great place to get a sandbox hosted db).mongo.collection
- The collection within the database to use.