FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
valdottown

valdottown

door

Remix of stevekrouse/switchbot
Public
Like
door
Home
Code
6
README.md
H
main.tsx
scratch.tsx
styles.tsx
users.tsx
utils.tsx
Branches
2
Pull requests
1
Remixes
2
History
Environment variables
2
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/16/2025
Viewing readonly version of main branch: v62
View latest version
README.md

Val Town Ground Floor Door Opener

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

How It Works

  1. Authentication: The application uses Val Town's lastlogin system to authenticate users by their email address.
  2. Authorization: Only users with email addresses listed in the users.tsx file can open the door.
  3. Door Control: When an authorized user clicks the "Open Door" button, the application sends a command to the Switchbot device attached to the door.

How to Use

  1. Visit the Val's URL in your browser
  2. Log in with your email (must be an authorized email)
  3. Click the "Open Door" button to unlock the ground floor office door
  4. The door will be unlocked momentarily

Adding New Users

To add a new authorized user:

  1. Edit the users.tsx file
  2. Add the user's email address to the authorizedEmails array
  3. Save the changes

Example:

export const authorizedEmails = [ "existing@val.town", "new.user@val.town", // Add the new user's email here ];

Technical Details

Switchbot API Integration

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.

Project Structure

  • main.tsx: The main application file with Hono routes and UI components
  • users.tsx: Contains the list of authorized email addresses
  • utils.tsx: Utility functions for Switchbot API authentication and requests
  • styles.tsx: CSS styles for the web interface

Troubleshooting

If you encounter issues:

  1. Cannot log in: Make sure your email is in the authorizedEmails list
  2. Door doesn't open: Check the Val Town logs for error messages
  3. API errors: Verify that the Switchbot device is online and the API keys are valid

For persistent issues, contact the Val Town team for assistance.

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.