-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible issue with time profiles #5
Comments
Thank you for the detailed bug report - makes things so much easier! It looks like it's probably a bug in the simulator
It's using the system time and not the simulated controller time. Nice catch! |
Hi, I've pushed a (provisional) fix to the master branch - it seems to work ok with your configuration and scripts (they were very helpful, thanks):
I still need to wrap my head around some edge cases (e.g. what happens at day boundaries, etc) but hopefully you should be able to continue testing for the interim. Well, at least if you're not working around midnight anyway! You'll need to grab the latest and greatest from the repo and build it but that's pretty straightforward - let me know if you run into anything. |
The fix is partially working on my end - it appears that the local time zone setting may still be affecting things. I could not get the fix working until I either set my local timezone to UTC, or put the 16:XX timestamps forward by 4 hours (I'm in EDT, which is UTC-4). Without doing that, EDIT: Just remembered the timezone setting in the config file. Changing that appears to have no effect. |
Time zones are the bane of my existence! However, reworking the time profile stuff to consistently reference everything to UTC seems to have it sorted:
Let me know if it works for you.. The timezone setting in the config file is only for the client side (CLI in this case) - the simulator doesn't use it so it makes sense that changing it had no effect. |
Well, this is fun. The previous failure ( EDIT: spinning up a VM to test as well, in case it's just my system being stupid. |
a.k.a. as time zone whack-a-mole! I have a sneaking suspicion it might be something to do with day boundaries (EDT10pm is around UTC 02h00) but if it is that, it's really not clear why (and the also the github workflow should fail but doesn't). I'm afraid I'm going to have to ask you run with a debugging build - I've added a whole bunch of debugging output to the checkTimeProfile routine, so if you could grab the latest from the master branch and run with that it should print out a whole slew of information. Maybe there's a clue in there somewhere.. Also:
|
Was just typing an edit to the above when you posted! I was wondering about the new One note: the above test script has one minor issue - the second The VM still has the issue, even after correcting the script typo. Debug output is as follows: With UTC set:
With EDT set:
Manually setting the time to my local time (11PM on the 15th), as though it was UTC, does not appear to be interesting.
All tests appear to pass (EDIT: on the VM and on my main machine):
|
Oooooooooooooooooh .. duh!!! Ok, I'm fairly sure I know what is wrong now - I'll fix it sometime tomorrow when my brain is not mush if that's ok? And thanks for all the testing. Really helped!! |
No worries (I know the feeling), no problem, and thank you! EDIT: that was not quite the right positioning. Brain = mush. -_- |
…t when calculating the weekday (cf. #5)
Hi, I've pushed a fix to github - looks ok when I run your script on a VPS:
but that was just a very quick test. I'll run a more extended test if you give it the ok.. |
It looks like that may have done it! Both the test script and our tool testing are now working! Thank you so much! |
Oh great! Thanks for letting me know! I still need to clean up the tests and do an extended run before I can put this to bed, but (hopefully) that shouldn't affect you in any way. Good luck with your project - sounds like fun :-). |
Closing this as fixed - feel free to reopen it if necessary :-) |
Hello! I'm not sure if this is an issue with
uhppote-simulator
, or if I'm doing something wrong - any guidance you can provide would be greatly appreciated.Background
I'm working on a Python tool (using the
uhppote-dll
Python bindings) to allow my local makerspace's membership tooling to automatically sync door access to our Uhppote access control boards. I'm in the process of finishing the tool, and am working to expand testing. However, I appear to either be misunderstanding how time profiles work, or have disocvered a bug withuhppote-simulator
, which I am using for initial testing in lieu of physical hardware.Scenario
As part of testing, I stand up a simulator instance and expose a quick method to perform simulated card swipes. I then take the system through the process of syncing several test users/cards, and verifying that they have access only at the appropriate times. Between each test, I use the
set-time
function to change the simulator's time, then check to see if access is allowed or denied, based on the card's configured access.Issue
Time profiles do not appear to be working correctly. When setting access to 1 (24/7) for a door, the card(s) work correctly. When setting to a defined time profile, access is variably granted/denied both outside and within the defined ranges of the profile. I've tried converting some/all times to UTC, which does not seem to help.
At time of last testing (9AM Eastern on October 14), test 1 for card 2 succeeds (access is denied prior to the time profile range), but test 2 fails (access is denied during the time profile range). Earlier, both test 1 and test 2 failed (i.e access granted before profile range, and denied during). My current best guess is that the simulator may not be respecting the time set by
set-time
when calculating time profile accesses. As a quick test, I changed the ranges below to encompass my current time, and the profile suddenly worked.Issue encountered on Linux x86_64 (PopOS/Ubuntu 22.04 LTS).
Steps to Reproduce
I whipped up the following scripts to quickly reproduce the issue, using
uhppote-simulator
anduhppote-cli
. This is essentially part of my Python tool testing, rewritten for Bash/uhppote-cli
.First, create
test-cli.conf
with the following contents:Next, create
test-cli.sh
with the following contents.Next, create
run-sim.sh
with the following contents. This assumes thatuhppote-simulator
is available in the same directory. The fix in this file is related to another bug - I'll file a separate issue on that.Finally, run
run-sim.sh
andtest-cli.sh
in seperate terminal windows. Be sure to runrun-sim.sh
first, and leave it running until done withtest-cli.sh
(CTRL+C to exit when done with it)!Sample output:
Again, not sure if this is an issue with the simulator, or if I'm missing something with the time profiles. I have a physical board and am planning to test with that as well, but I am currently waiting on some parts to get it hooked up.
Thank you in advance for your assistance!
The text was updated successfully, but these errors were encountered: