Spacestate Switch
Jump to navigation
Jump to search
| Spacestate Switch | |
|---|---|
Old mechanical switch (top, not currently in use) and Spacestate button (bottom) | |
| Type | Core Hackerspace Infrastructure |
| Maintainers | Rennsies |
| Runs on | ESP32 |
| Source | SpaceStateSwitch (private) |
The Spacestate Switch is responsible for managing the opening and closing of the space. It does this by:
- Telling the Spacestate (service) to change the state
- This indicate to the world as well as the website & hackerspace map what the current state is
- Tells Home Assistant to change the state of the devices in the space
- This is things like: lights, switches, screens, art, etc.
- Most importantly: it sets the appropriate colour on the traffic light
Detailed function
When the button is pressed the ESP32 does two things:
- Makes an API call to Spacestate (service) and sets the state
- Sends a message to the MQTT broker to set a Home Assistant device to 'open' or 'closed'
Some Home Assistant automations are triggered by changes to the 'SpaceState' device such as the opening and closing of the space (turning the lights on etc)
Things like the Hackerspace Map poll the Spacestate (service) for updates.
Known problems (20-10-2026):
- Spacestate does not correctly switch since PHP crisis
- Caused by 2 issues:
- Spacestate service (old PHP version) went down during the PHP crisis as to not be vulnerable
- New service came up, but on a different server with a different certificate. Switch had a hardcoded TLS root certificate to the old service
- Caused by 2 issues:
- Lights do not switch when button is last pressed more than 15min ago. It works after 10min. So the actual treshold is between 15 and 10 minutes.
- Caused by MQTT retention & expiration settings, switch sent MQTT message without 'retain = true' and an expiration of 900s (15m)
- This caused the HA device to swap from it's state to 'unavailable'
- All automations relied on a state change between 'open' and 'closed', 'unavailable' didn't trigger either
Hardware
- ESP32 (Esp-WROOM-32) connected to switch on box
Old mechanical switch (not in use currently)
Hackerspace map - Hackerspace map PCB (esp32)
- RPi running Home Assistant

Home assistant
Magic search words:
integrations
automations
Scripts
Resources
esp32 script: [ask Sir 16-bit]
Home assistant link: [ask Sir 16-Bit]
https://spacestate.pixelbar.nl/
https://github.com/revspace/decennium-kicad
