ratgdo32 disco — Garage Door Controller
Control a ratgdo32 disco (HomeKit firmware) garage door opener via its local REST API.
Security Model
The ratgdo32 disco uses a local network trust model. The device's web API is only accessible from your LAN — it does not expose any ports to the internet and has no cloud dependency.
Your responsibilities:
- - Keep the device on a trusted, password-protected network (WPA2/WPA3)
- Do not port-forward the device's HTTP port to the internet
- Use your router's client isolation or VLAN features if you want extra segmentation
- The agent should always confirm door state before acting (built into the helper script)
This is the same trust model used by most local smart home devices (Hue bridges, Shelly relays, ESPHome, etc.).
Setup
Set the RATGDO_HOST environment variable to your device's IP or mDNS hostname:
CODEBLOCK0
If unset, the helper script defaults to 192.168.1.XXX — you must update it.
Find your device IP via your router's DHCP table, or use mDNS:
CODEBLOCK1
Device Info
Configure these for your setup:
| Field | How to Find |
|---|
| IP | Router DHCP table or mDNS browse |
| mDNS |
Usually
Garage-Door-XXXXXX.local (based on MAC) |
|
MAC | Printed on the ratgdo32 board or in your router's client list |
|
Protocol | Check your garage opener's learn button color (yellow = Security+ 2.0, purple = Security+ 1.0) |
|
Web UI |
http://<your-ip>/ |
Quick Reference
| Action | Command |
|---|
| Get full status | INLINECODE4 |
| Open door |
curl -s -X POST -F "garageDoorState=1" http://$RATGDO_HOST/setgdo |
| Close door |
curl -s -X POST -F "garageDoorState=0" http://$RATGDO_HOST/setgdo |
| Light on |
curl -s -X POST -F "garageLightOn=1" http://$RATGDO_HOST/setgdo |
| Light off |
curl -s -X POST -F "garageLightOn=0" http://$RATGDO_HOST/setgdo |
| Disable remotes |
curl -s -X POST -F "garageLockState=1" http://$RATGDO_HOST/setgdo |
| Enable remotes |
curl -s -X POST -F "garageLockState=0" http://$RATGDO_HOST/setgdo |
Status API
INLINECODE11 returns JSON:
CODEBLOCK2
Key fields
- - garageDoorState — current door position
- garageLightOn — ceiling light status
- garageObstructed — safety sensor triggered (do NOT close if true)
- garageLockState — "locked" means physical remotes are disabled
- vehicleState — laser sensor detects parked car
- vehicleDistance — distance to vehicle in cm (laser)
- motionDetected — PIR motion sensor
Control API
INLINECODE12 with form data:
| Field | Values | Effect |
|---|
| INLINECODE13 | INLINECODE14 = open, 0 = close | Opens or closes the door |
| INLINECODE16 |
1 = on,
0 = off | Toggles ceiling light |
|
garageLockState |
1 = lock,
0 = unlock | Disables/enables physical remotes |
Safety Rules
- 1. Never close the door if
garageObstructed is true. Report the obstruction and stop. - Always check status before opening/closing to confirm current state and avoid unnecessary operations.
- Confirm with the user before disabling remotes — this temporarily locks out all physical remotes (wall button, car remotes). Re-enable with
garageLockState=0.
Helper Script
Use scripts/garage.sh for common operations:
CODEBLOCK3
The helper script includes safety checks: it verifies obstruction status before closing and confirms current state before toggling.
Compatibility
- - Firmware: HomeKit firmware v3.x+ (tested on v3.4.4)
- Protocols: Security+ 2.0 (yellow learn button), Security+ 1.0 (purple learn button)
- Platforms: Works alongside HomeKit/Apple Home. Not compatible with Home Assistant simultaneously (HomeKit single-pair limitation). Use web API for agent control, Apple Home for Siri/manual control.
- Vehicle sensor: Requires the optional laser parking sensor. Distance reading varies by vehicle position.
Notes
- - HomeKit pairing is separate from the web API. Both can operate simultaneously.
- The device broadcasts mDNS as
Garage-Door-XXXXXX.local where XXXXXX is derived from the MAC address.
ratgdo32 disco — 车库门控制器
通过本地REST API控制ratgdo32 disco(HomeKit固件)车库门开启器。
安全模型
ratgdo32 disco采用局域网信任模型。该设备的Web API仅可从您的局域网访问——它不向互联网暴露任何端口,且无云端依赖。
您的责任:
- - 将设备置于受信任、受密码保护的网络(WPA2/WPA3)中
- 请勿将设备的HTTP端口转发至互联网
- 如需额外隔离,可使用路由器的客户端隔离或VLAN功能
- 代理在执行操作前应始终确认门的状态(已内置于辅助脚本中)
这与大多数本地智能家居设备(Hue桥接器、Shelly继电器、ESPHome等)使用的信任模型相同。
设置
将RATGDO_HOST环境变量设置为设备的IP或mDNS主机名:
bash
export RATGDO_HOST=192.168.1.XXX # 或 your-device.local
若未设置,辅助脚本默认使用192.168.1.XXX——您必须更新此值。
通过路由器的DHCP表查找设备IP,或使用mDNS:
bash
dns-sd -B hap.tcp # 浏览HomeKit设备
设备信息
根据您的配置设置以下内容:
| 字段 | 查找方法 |
|---|
| IP | 路由器DHCP表或mDNS浏览 |
| mDNS |
通常为Garage-Door-XXXXXX.local(基于MAC地址) |
|
MAC | 印在ratgdo32板上或路由器客户端列表中 |
|
协议 | 查看车库门开启器的学习按钮颜色(黄色=Security+ 2.0,紫色=Security+ 1.0) |
|
Web界面 | http://
/ |
快速参考
| 操作 | 命令 |
|---|
| 获取完整状态 | curl -s http://$RATGDOHOST/status.json |
| 开门 |
curl -s -X POST -F garageDoorState=1 http://$RATGDOHOST/setgdo |
| 关门 | curl -s -X POST -F garageDoorState=0 http://$RATGDO_HOST/setgdo |
| 开灯 | curl -s -X POST -F garageLightOn=1 http://$RATGDO_HOST/setgdo |
| 关灯 | curl -s -X POST -F garageLightOn=0 http://$RATGDO_HOST/setgdo |
| 禁用遥控器 | curl -s -X POST -F garageLockState=1 http://$RATGDO_HOST/setgdo |
| 启用遥控器 | curl -s -X POST -F garageLockState=0 http://$RATGDO_HOST/setgdo |
状态API
GET http:///status.json 返回JSON:
json
{
garageDoorState: open|closed|opening|closing|stopped,
garageLightOn: true|false,
garageObstructed: true|false,
garageLockState: locked|unlocked,
vehicleState: present|absent|arriving|departing,
vehicleDistance: 42,
motionDetected: true|false
}
关键字段
- - garageDoorState — 当前门的位置
- garageLightOn — 天花板灯状态
- garageObstructed — 安全传感器触发(若为true则请勿关闭)
- garageLockState — locked表示物理遥控器已禁用
- vehicleState — 激光传感器检测到停放车辆
- vehicleDistance — 距车辆的距离(厘米,激光)
- motionDetected — PIR运动传感器
控制API
POST http:///setgdo 使用表单数据:
| 字段 | 值 | 效果 |
|---|
| garageDoorState | 1 = 打开, 0 = 关闭 | 打开或关闭门 |
| garageLightOn |
1 = 开, 0 = 关 | 切换天花板灯 |
| garageLockState | 1 = 锁定, 0 = 解锁 | 禁用/启用物理遥控器 |
安全规则
- 1. 若garageObstructed为true,切勿关闭门。 报告障碍物并停止操作。
- 在打开/关闭前始终检查状态,以确认当前状态并避免不必要的操作。
- 在禁用遥控器前请与用户确认——这将暂时锁定所有物理遥控器(墙壁按钮、汽车遥控器)。使用garageLockState=0重新启用。
辅助脚本
使用scripts/garage.sh进行常见操作:
bash
状态(人类可读)
bash scripts/garage.sh status
控制
bash scripts/garage.sh open
bash scripts/garage.sh close
bash scripts/garage.sh light-on
bash scripts/garage.sh light-off
bash scripts/garage.sh lock-remotes
bash scripts/garage.sh unlock-remotes
辅助脚本包含安全检查:在关闭前验证障碍物状态,在切换前确认当前状态。
兼容性
- - 固件: HomeKit固件v3.x+(已在v3.4.4上测试)
- 协议: Security+ 2.0(黄色学习按钮),Security+ 1.0(紫色学习按钮)
- 平台: 可与HomeKit/Apple Home同时使用。不兼容Home Assistant(HomeKit单配对限制)。使用Web API进行代理控制,使用Apple Home进行Siri/手动控制。
- 车辆传感器: 需要可选的激光停车传感器。距离读数因车辆位置而异。
备注
- - HomeKit配对与Web API是独立的。两者可同时运行。
- 设备以Garage-Door-XXXXXX.local广播mDNS,其中XXXXXX源自MAC地址。