door
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v79View latest version
This Val provides a web interface that allows authorized Val Town employees to remotely open the ground floor office door using a Switchbot device.
The original version of this Val was created for a party: @stevekrouse/switchbot_party
- Authentication: The application uses Val Town's
lastlogin
system to authenticate users by their email address. - Door Control: When an authorized user clicks the "Open Door" button, the application sends a command to the Switchbot device attached to the door.
- Visit the Val's URL in your browser
- Log in with your email (must be an authorized email)
- Click the "Open Door" button to unlock the ground floor office door
- The door will be unlocked momentarily
This Val authenticates to the Switchbot API with SWITCHBOT_TOKEN
and SWITCHBOT_KEY
environment variables.
The application uses the Switchbot API to send a "press" command to the device with ID D2353438164D
(Val Town Ground Floor device).
Learn how to get your own Switchbot API keys here: Switchbot Docs.
main.tsx
: The main application file with Hono routes and UI componentsutils.tsx
: Utility functions for Switchbot API authentication and requestsstyles.tsx
: CSS styles for the web interface