Initial commit: Olimex ESP32-C6-EVB HA integration + Arduino sketch

This commit is contained in:
ske087
2026-02-23 21:10:38 +02:00
commit b1ee2610ca
18 changed files with 2178 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
"""Webhook handler for Olimex ESP32-C6-EVB input events."""
import logging
from aiohttp import web
from homeassistant.core import HomeAssistant
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
async def handle_input_event(hass: HomeAssistant, webhook_id: str, request) -> web.Response:
"""Handle input event webhook from the board."""
try:
data = await request.json()
input_num = data.get("input")
state = data.get("state")
_LOGGER.info("Received input event: input=%s state=%s", input_num, state)
# Dispatch signal to update binary sensors immediately
signal = f"{DOMAIN}_input_{input_num}_event"
async_dispatcher_send(hass, signal, state)
return web.json_response({"status": "ok"})
except Exception as err:
_LOGGER.error("Error handling webhook: %s", err)
return web.json_response({"error": str(err)}, status=400)