isVHSopen is getting an upgrade!

Soon, isvhsopen.com will not only tell you when it’s open, it will also tell you when it’s closing!

A while back, @bruce (and probably others) was working on a replacement to the isVHSopen lightswitch called SpaceTime. The project includes a custom AVR board, two large 7-segment LED clock displays, a Raspberry Pi for network connectivity, and a laser cut box to house it all. The AVR code is functional and running on the board, and the Pi is the last major piece of work remaining. @bruce has done some significant work here, and I’m excited to help with the last bit to get this working and up in the space!

I’ve been writing a python script which speaks to the SpaceTime board over serial, periodically checks and synchronizes its clock, and updates the VHS API website whenever someone opens or closes the space. It’s nearing completion, and soon I’ll be testing and debugging it and will put the code up on GitHub within the week.

I currently have no intention to modify the SpaceTime code, because it is working, and I have no immediate interest in configuring the build and upload environment for the AVR. There are some minor issues (mostly usability) I’ve kept track of in case we do ever need to update it, and I can post those later or something.

Regarding the actual isvhsopen.com website, it is currently displaying the /data/door/fullpage, and I’m wondering if anyone has access to change that. Of course, I could just write to the ‘door’ datapoint something like “open until 18:30”, but I think it’s better to continue using ‘door’ as-is, and have a new variable for the closing time (perhaps ‘open_until’ or ‘isvhsopen_until’).

Questions in short-form:

  1. Continue using ‘door’ for ‘open’/‘closed’ and add one datapoint for closing time, or put it all into ‘door’?
  2. Naming of datapoint? ‘open_until’, ‘isvhsopen_until’, ‘door_closing’, etc.
  3. Should closing time be in format “HH:MM:SS” (this is easiest) or something else?
  4. Update isvhsopen.com with new, custom html page?
  5. How to do #4?
  6. Should the RPi have a static IP?
  7. On bootup, RPi can update API datapoint ‘isvhsopen_ip’ or ‘spacetime_ip’ with its local IP address.
  8. What about SSH username/password? Should this just be written somewhere on the box?
  9. @lukec can datapoints on the VHS API be deleted, or should I just make sure to use the right one first?
  10. Any other questions/concerns/suggestions?

This can all, of course, be changed once it’s up, but perhaps some of you will have useful feedback!

6 Likes

… You musty be new here…

Joking aside, this has been in the works for a LONG time, glad to hear it is coming to fruition! Congrats to all involved.

All into door is easier, for now.

Just use ‘door’, for now.

I would suggest braille, but I fear repercussions… So, yeah, due to rendering, H:MM:SS will probably be best.

If life was only so easy. Although we could potentially have Node running in front of the API, but we’ll need to figure that out.

Erm, you can update from Python?

Yes, preferably, but we’ll also need to tackle the VHS network side for this.

Not needed with a static IP, although you could combine it with the info below.

That’s the usual way to do it, and with the code on GitHub. Let me know if you need access?

Is the cake a lie?

Thank you for doing this though!!

Sorry, I got numbers mixed up! Should have been “How to do #4?” which refers to “4. Update isvhsopen.com with new, custom html page?”

I just thought I’d see how it looks if we put something like “open until 18:30” on the page and it turns out it doesn’t look good. See here for yourself (until someone updates that variable). Screenshot from my end:

So we will most likely have to update www.isvhsopen.com because /fullpage doesn’t do well at displaying longer messages. I see that the API is also taking out whitespace and colons, so I’ll have to look into that.

Thanks for your suggestions!

You’d need to update the partly API service in order to get the new template IIRC.

Also, I’m working on a new API service.

I am not sure, you would need to read the code.

Okay, well I haven’t seen anything in the code that allows for deletion using the http GET api, so the answer’s probably no, without reaching into the backend.

Checked the code, and it turns out it’s doing a very aggressive sanitization. Both the dataname and the value are limited to letters, numbers, and the characters _/-

my $sanitize_rx = qr/[^A-Za-z0-9_\-]/;
$dataname =~ s/$sanitize_rx//g;
$value    =~ s/$sanitize_rx//g;

Should we change this? If we change it on GitHub, how difficult will it be to update the server with the new code?

@TyIsI, want to provide any info on your new API service?

It’ll be similar, but with a different backend (Node)

Maybe I missed it, or it’s in another thread, but how do people set the closing time?

It’s not up yet; we’re still using the basic lightswitch. I’ll probably bring it down to the space tomorrow. It’s a box with a keypad and a clock display for the current and closing times, so it’ll be pretty straightforward once you see it.

Yes I will, I’ll be at VHS later tonight so maybe we can do it then. Will that allow me to post it as a VHS project instead of a personal project? I’m also wondering if this should be included as part of Bruce’s SpaceTime GitHub project, or if it should be a different one.

Also, a couple API requests I have for your new are:

  • Allow for more characters, at least for stored values. But of course, preventing XSS is paramount.
  • Provide an “Update if changed” command, the difference being that it will not update the Timestamp if the value doesn’t change, whereas a straight “Update” command will update the Timestamp every time the call is made.

The box is up and in the space, just above the Frankenstein-style “knife switch,” powered on and usable! The only catch right now is that we still need to update the page displayed at isvhsopen.com. So for now, feel free to play with it, but continue to use the lightswitch to control isvhsopen. Right now, SpaceTime is configured to update variables key and test1 online; door is what is used for isvhsopen.

As for the new web UI, here are two possible options:

I prefer the latter (13:45), but let me know which you like, or if you have any other ideas.

If we wanted to keep it all within the Dancer codebase, we could add a template similar to data-full.tt, and then add a new query type to the VHSAPI.pm. Of course it’s all pretty simple, so there are many ways it could be accomplished.

5 Likes

So I don’t know what the best way is to go about updating the isvhsopen.com website, but this is a way and I think it’ll be just fine. I’ve made updates to the VHS API codebase and submitted a Pull Request for others to look over.

The changes are quite simple, and should be straightforward for any enterprising individual with proper access rights (@TyIsI) to push onto the http://api.vanhack.ca server. The biggest change involves adding a new template so that isvhsopen.com will look like the second screenshot in the post above.

Less important, but perhaps more interesting, I’ve also submitted a Pull Request for the SpaceTime Python code.

3 Likes

Bumping this thread.

Seems like we are close to getting the “Open Until” bit working. Is there something I can do? @TyIsI

Mark

I think the next thing to do is to get the new VHS API deployed to the Talk server. Once that’s done, we’ll have to update the DNS entries for isvhsopen.com and then test that it all works.

1 Like

Sorry guys, I’m ridiculously behind on stuff.

No worries, personal things are always first priority. Do we know if there is anyone else who has access to do it?

As someone that is hanging off the isvhsopen page lately, occasionally refreshing it to ensure I have current data… (but recognizing that it could be set to refresh itself, or maybe already does, not sure)…

It would be cool if it played a sound on any desktop that had it open as the space switched from closed to open, or vice versa… that way I could have the page open in another tab and it would play a little bugel noise of something that represented when the hackspace was opened up.

Obviously, applying for keyholder status, which I should do anyways, would solve this for me… but I just think it would be a cool feature for those that don’t have the ability to get in there whenever they want (which is what I’m suffering through currently).

Here’s an awesome suggestion for the noise… :wink:EFX EXT Civil War Bugle 16 B | Soundsnap

Obviously not hugely important, and I don’t have the requisite skills to make it happen, but just a suggestion that I think would make the page more awesome.

1 Like

You should check out this awesome project!