1 API Reference
developer edited this page 2026-09-25 10:07:24 +00:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

API Reference

Base URL

http://localhost:8080/api

Endpoints

GET /api/buttons

Получить состояние кнопок.

Response:

{"mask": 5}

Example:

curl http://localhost:8080/api/buttons

PUT /api/buttons

Установить состояние кнопок.

Request:

{"mask": 5}

Example:

curl -X PUT http://localhost:8080/api/buttons \
  -H "Content-Type: application/json" \
  -d '{"mask": 5}'

Авторизация

Если API_TOKEN задан в .env, используйте Bearer-токен:

curl http://localhost:8080/api/buttons \
  -H "Authorization: Bearer ваш_токен"

Lease

При записи ненулевой маски создаётся lease на 2 сек. Веб-панель шлёт heartbeat каждые 500 мс для продления. Если lease истёк — кнопки сбрасываются.

Debug-канал

Можно писать напрямую в button file:

echo 0x0002 > /tmp/hhs-emu-demo/emulated_buttons

Этот метод не затрагивает lease.