5fe8f228c1
Add a read-only /ecosystem page that consumes the sibling services' JSON APIs (Nexus entities, Praxis attention, Hexis capabilities), fetched concurrently with honest per-panel error states. Siblings stay headless — mavweb is their human surface (arch §16). Wired via mavweb -nexus/-praxis/-hexis flags; mavweb joins the ecosystem compose network. Fix mobile horizontal overflow across all pages: .content is a flex child with default min-width:auto, so it refused to shrink below the tables' intrinsic width. min-width:0 lets wide tables pan inside .scroll instead of dragging the page sideways. Verified via CDP geometry check (scrollWidth === clientWidth at 430px). Also includes in-progress Ethos UI redesign, ecosystem deploy compose, and planning docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Plan: SmartHome Ecosystem Integration
Goal: Maven connects to the SmartHome ecosystem — Home Assistant, MQTT, Zigbee2MQTT, or direct HTTP APIs — to read sensor states, control devices, and trigger automations based on facts and presence.
Done when:
- MQTT client in
internal/smarthome/mqtt.go— connects to broker, subscribes to topic patterns, publishes control messages - Home Assistant API client in
internal/smarthome/ha.go— REST API + WebSocket for state reads and service calls - SmartHome entities are writable as facts (sensor → fact write for loop predicates)
- Tool verbs for device control:
turn_on,turn_off,set_temp,set_brightness— mapped to existingtool.Executoror the SmartHome API directly - Presence integration: motion sensors, door sensors, WiFi presence feed into the existing
store.PresenceProbespipeline - Voice control: "maven, выключи свет в гостиной" routes through
IntentAct→ SmartHome tool
Scope:
- New
internal/smarthome/package — MQTT client, Home Assistant client, entity registry - New
cmd/mavpoll/extension — existing polling infrastructure extended with SmartHome sensors - Config:
smarthomeblock inconfig.Config—{provider: "homeassistant|mqtt", url, token, mqtt_broker} - Reuses
internal/tool.Executorfor device control tools - Reuses
internal/store.PresenceProbesfor presence input
Steps:
- Create
internal/smarthome/ha.go— Home Assistant REST client:GetStates(),CallService(domain, service, target, data), subscribe to WebSocket events - Create
internal/smarthome/mqtt.go— MQTT client viagithub.com/eclipse/paho.mqtt.golang: subscribe tozigbee2mqtt/#,homeassistant/#, publish tocmnd/# - Create
internal/smarthome/entity.go— entity registry: maps entity_id → fact key, device_class → fact kind - Create programmatic tool registration — on startup, enumerate SmartHome entities and call
ProposeToolfor each controllable device (light, switch, climate, cover) - Wire MQTT sensor updates into
store.WriteFact— e.g.,zigbee2mqtt/temperature→WriteFact(kind="env", key="temp:living_room", value="22.5") - Wire SmartHome presence signals into
store.PresenceProbes— e.g., WiFi presence or motion sensor →presence_wifi/presence_motionprobes - Add
smarthomeblock toconfig.Configand wire intocmd/mavend/main.go— starts separate goroutine for MQTT/WebSocket event loop - Test with a local MQTT broker and simulated sensor messages — verify facts are written and loop predicates can read them