RPI 4-Channel Relay Controller - Keyestudio
Control your Keyestudio KS0212 4-channel relay shield directly from your Orbit OS device. This app exposes a clean web interface, a full Modbus TCP server, and native MQTT support with Home Assistant auto-discovery — making it ready for professional automation setups out of the box.
Features
- Web UI to toggle each of the 4 relay channels individually, with real-time state updates
- Modbus TCP server with configurable port (default 5020) supporting FC01, FC03, FC05, FC06, and FC0F function codes
- MQTT support with Home Assistant auto-discovery — channels appear automatically as switch entities grouped under a single KS0212 device
- Standard ON / OFF payloads, retained state, and LWT availability for reliable HA integration
- Configurable MQTT broker, credentials, topic prefix, and device ID
Modbus TCP (Coil Mapping)
Coil Channel
0 Channel 1
1 Channel 2
2 Channel 3
3 Channel 4
MQTT Topics
Topic Direction
relay4/<device>/N/set HA → Device
relay4/<device>/N/state Device → HA
relay4/<device>/availability LWT
Requirements
- Raspberry Pi 3, 4, or 5
- Keyestudio RPI 4channel-Relay Shield (SKU: KS0212)
GitHub: https://github.com/OrbitOS-org/app-rpi-4ch-relay-keyestudio