Commit Graph

50 Commits

Author SHA1 Message Date
George Hotelling fe506b0830
Moving zoho auth into main file 2023-03-04 17:19:31 -05:00
George Hotelling c7f3d39a27 Remove requirements.txt 2023-02-11 08:52:17 -08:00
George Hotelling f8dc115192 More unit tests 2023-02-11 08:51:09 -08:00
George Hotelling e280496acb More unit tests 2023-02-08 12:21:32 -08:00
George Hotelling 817a96bd97 Unit testing 2023-02-06 17:29:53 -08:00
George Hotelling 6ed0f49cce Use Zoho for auth 2023-02-04 16:29:33 -05:00
Anna Schumaker bc6740ca63 Post to slack when somebody enters the space
But only the first time they enter that day.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2020-08-30 16:31:09 -04:00
Anna Schumaker 7296900ddf Updates for key validation:
- Check the start and stop bytes of the RFID message in addition to the
  expected length to prevent crashes.
- There is no need to re-lock the door if it was never unlocked.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2017-06-19 16:32:53 -04:00
Anna Schumaker 71db8b6220 Change the default server
The server is implementation-specific, so it doesn't make sense to point
this to the workantile openings service by default.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2017-06-19 16:16:53 -04:00
Anna Schumaker 4145e5dd6a Add missing "self" argument to Serial.reset_input_buffer()
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2017-06-19 15:59:39 -04:00
Anna Schumaker 5b6897ba28 Only enable the yellow LED when making a network request
This is what the yellow LED was always intended to be, and I think
making this change helps simplify the code.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2017-06-19 15:57:12 -04:00
Anna Schumaker ff381ba87c pySerial no longer has a flushInput() function
It is now called reset_input_buffer()

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-20 13:10:10 -05:00
Anna Schumaker 645a89bb09 Rename ping_keys() -> flush_keys()
This better matches how it's used.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-20 12:03:04 -05:00
Anna Schumaker ee1b76d043 Clean up reading keys
I can easily cut out a function call to verify / validate keys.  I also
added in a check for if the key is alphanumeric, to cut down on
exceptions caused by garbage data.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-20 11:59:21 -05:00
Anna Schumaker a95db28f5c Clean up forming the server request
We're getting a "bad request" error, but it's not clear how that request
is bad.  Let's add this message to the log, and also clean up the code
to generate the request.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-19 13:32:23 -05:00
Anna Schumaker 27d8399529 Clean up output
We're printing "No tag read" many, many, MANY times each second to the
log.  Let's cut back a bit to make debugging easier.

We should also print when we're clearing the cache in case we need to
find that in the logs later.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-19 13:31:38 -05:00
Anna Schumaker b9eadf9112 Don't flood the server with key pings
Rather than processing the entire list at once, handle each key one at a
time to give priority to incoming scans.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-13 14:19:27 -05:00
Anna Schumaker f1c2bca901 Periodically clear the key cache
Clear the cache on the first scan of each month.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-12 10:58:16 -05:00
Anna Schumaker 618c2f2931 Cache scanned keys
Right now we cache keys until the server tells us that the key is
invalid.  This might be a problem, because a newly invalid key will
be allowed entry the first time it is scanned.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-12 10:23:53 -05:00
Anna Schumaker 238da432fb Simulator can recycle keys
Rather than always generating a new key, let's sometimes recycle a key
value to test caching.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2016-01-12 09:54:47 -05:00
Workantile 787d9b4a7b Make sure door is locked right after creating lock_door()
Just to keep things together.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-23 20:49:18 +00:00
Workantile f4a9ce72cf Update pin numbers
Somewhere along the line the red and green LEDs got swapped.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-23 20:48:35 +00:00
Anna Schumaker 48904c47fa Remove simulator/doors.py
This was a symlink used during development of the simulator, and is no
longer necessary.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 11:15:30 -04:00
Anna Schumaker 3879e5e814 simulator: Add an RFID reader exception
So we can test what happens if the Serial library has an error.  I also
make exceptions less likely to happen.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:53:05 -04:00
Anna Schumaker 673a6bd9c6 Cleanups
- Move blink_leds() to be next to other LED handling code
- read_rfid() should handle exceptions
- Rename main() -> loop()

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:45:43 -04:00
Anna Schumaker 40ee611f33 Use GPIO.HIGH and GPIO.LOW for ON and OFF
It's even more obvious than 1 and 0!

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:32:21 -04:00
Anna Schumaker dc4e67d51b Rename close_door() to lock_door()
This is a better name for what the function actually does.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:20:30 -04:00
Anna Schumaker c70d81fdad Rename open_door() to unlock_door()
This is a better name for what the function actually does.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:20:30 -04:00
Anna Schumaker 3ef9283d6f simulator: Add a function for reloading the simulator
This lets me update the doors.py file without needing to exit the Python
interpreter.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-23 10:20:10 -04:00
Anna Schumaker ff4bd7fcbd doors: Blink LEDs when exceptions are thrown
This gives visual feedback that something has gone horribly, horribly
wrong.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-22 21:11:56 -04:00
Anna Schumaker c877f6db00 Simulator should occasionally throw errors
This lets me test LED blinking code.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-22 21:10:37 -04:00
Anna Schumaker da3278d198 Create a simulator.sh script
Running this script will start python, load the simulator module, and
then drop to a command line.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-22 20:53:16 -04:00
Anna Schumaker 8faf31c86f Create a door controller simulator
The simulator fakes up some libraries so that the main door controller
script can be tested without needing a Raspberry Pi.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-22 20:47:11 -04:00
Anna Schumaker 668260c7b2 Move main loop into a new function
This lets the simulator drop to the command line rather than looping.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-22 20:45:15 -04:00
Workantile d20813b4ff Add ON and OFF "macros"
lowVoltage and highVoltage don't really tell us if the LEDs are on or
off.  Let's make this easier to understand.
2015-04-22 21:17:03 +00:00
Workantile cc87c28909 Add a yellow LED
This LED is enabled during the time that we are sending network
requests.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-22 21:09:04 +00:00
Workantile 8c43e027f1 Comment out default controller
Also mention what default values are for some options.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-22 21:08:56 +00:00
Workantile 67f54aa720 Makefile fixes
The install command makes files executable by default, but we only want
doorsd to be executable.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-09 20:01:27 +00:00
Workantile 20dfd5d2bc Rename doorrc -> doorsrc
The added 's' matches the daemon name.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-09 20:01:24 +00:00
Workantile ed1ddbcf0e Add a systemd service file
This lets us start the doorsd daemon automatically on startup.  We also
configure it to restart if the daemon is ever killed.

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-09 19:39:14 +00:00
Workantile b587efd49f Add a Makefile
make install:   Install files
make uninstall: Uninstall files

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-09 19:34:11 +00:00
Workantile 771c7517a9 Make doors.py executable
Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-09 19:32:42 +00:00
Workantile 5feac037c5 Changing to 'sidedoor' 2015-04-09 13:33:27 +00:00
Anna Schumaker f86911a4d2 Use "with" statement for opening the URL
This helps catch errors that may happen without making the door script
blow up.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-07 14:45:40 -04:00
Anna Schumaker 4b8b596ae3 Move RFID comment block
Put it with the RFID loop, to make it obvious where RFID stuff happens.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-07 14:45:39 -04:00
Anna Schumaker 4b3d5282ae Move RFID_SERIAL.flushinput()
I think this makes more sense in the RFID reading loop

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-07 14:45:39 -04:00
Anna Schumaker 27fdb0fd9c Create a doorrc file
This file contains configuration data for the door controllers that way
the script doesn't need to be changed on every new device.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-07 14:45:38 -04:00
Anna Schumaker c318e74ea0 Pass key from RFID reader to verify_key()
This is better than everybody getting in by using my key :)

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-07 14:06:28 -04:00
Anna Schumaker 54ed9e258e Move RFID setup to new section
Let's not mix this with GPIO stuff.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
2015-04-07 14:04:20 -04:00
Workantile d3c799914a Initial commit: Added what we have so far
We have a script that (kinda) works!

Signed-off-by: Workantile <maintainers@workantile.com>
2015-04-07 17:51:10 +00:00