feat: Add Home Assistant smart device integration (Issue #366) - #2435
feat: Add Home Assistant smart device integration (Issue #366)#2435Wanbogang wants to merge 5 commits into
Conversation
- Add home_assistant action with 3 connectors: - REST API (rest_api.py) - WebSocket (websocket.py) - MQTT (mqtt.py) - Each connector supports: - Light (on/off, brightness, color) - Switch (on/off) - Climate/thermostat (temperature, on/off) - Add HomeAssistantStateInput plugin for real-time device state monitoring - Add config/home_assistant.json5 example configuration - Add aiomqtt==2.5.0 dependency - Add 125 unit tests, all passing at 100% coverage - Ruff and pyright clean Follows OM1 action/input plugin architecture conventions.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Hi @Wanbogang |
…t-integration # Conflicts: # pyproject.toml
The LLM may emit empty-string values for optional numeric fields (brightness, temperature) when they are not relevant to the chosen action (e.g. turn_on). The orchestrator's blind int()/float() cast then raised ValueError: invalid literal for int() with base 10: ''. Change brightness/temperature to str in the interface and convert them safely inside each connector (rest_api, mqtt, websocket), falling back to sane defaults on empty/invalid input. Tests updated accordingly. Add aiomqtt to uv.lock for the MQTT connector.
|
Hi @Prachi1615 I don't have a recorded video at the moment (screen recording is glitchy on my setup), but I tested the integration end-to-end against a real Home Assistant instance (HA running in Docker with the demo platform providing virtual light/switch/climate entities). I'm attaching screenshots below that walk through the full pipeline. Setup: OM1 running the What the screenshots show:
The One extra thing I found while testing: when the LLM emits empty-string values for optional numeric params (brightness/temperature) on a plain turn_on, the orchestrator's I can record a proper video once I sort out the screen-recording issue on my machine — let me know if the screenshots are enough for now. Thanks!
|
|
Hi @Wanbogang |





Summary
Implements Home Assistant smart device integration, allowing OM1 robots to control smart home devices via Home Assistant. #366
Changes
New:
src/actions/home_assistant/interface.py— definesHADeviceType,HAAction,HomeAssistantInput, and sharedCOLOR_MAPconnector/rest_api.py— REST API connectorconnector/websocket.py— WebSocket connectorconnector/mqtt.py— MQTT connectorEach connector supports:
New:
src/inputs/plugins/home_assistant.pyHomeAssistantStateInputplugin for real-time device state monitoring via REST pollingNew:
config/home_assistant.json5Updated:
pyproject.tomlaiomqtt==2.5.0dependency for MQTT connector