Skip to content

Changes for Home assistant support#368

Open
mretallack wants to merge 14 commits intoStypox:masterfrom
mretallack:changes-for-ha
Open

Changes for Home assistant support#368
mretallack wants to merge 14 commits intoStypox:masterfrom
mretallack:changes-for-ha

Conversation

@mretallack
Copy link

@mretallack mretallack commented Dec 8, 2025

[HomeAssistant] - Voice Control Integration

Status: Ready for Merge

This PR isHome Assistant integration with Dicio. It is now ready for production but requires review, it has been been tested for the past 2 months.

Note: This implementation was developed with assistance from AWS Kiro AI to accelerate the initial development and explore the feasibility of Home Assistant integration.

Overview

Adds a new skill that allows users to control and query Home Assistant entities using voice commands. Users can turn devices on/off, check status, and query person locations through natural language.

Features Implemented

Voice Commands

Entity Control:

  • Turn entities on/off/toggle: "Turn living room light on", "Switch bedroom lamp off"
  • Check entity status: "Get status of garage door", "Check front door"
  • Person location: "Where is the person Mark", "What is Sarah location"

Supported Entity Types

  • Lights, switches, covers, locks, fans, media players
  • Person entities for location tracking
  • Any entity that supports standard Home Assistant services

Configuration

  • Settings UI for Base URL and Access Token
  • Entity mapping system (friendly name → entity ID)
  • Secure token storage using DataStore

Technical Implementation

Files Added/Modified

Core Implementation:

  • app/src/main/kotlin/org/stypox/dicio/skills/homeassistant/
    • HomeAssistantInfo.kt - Skill registration
    • HomeAssistantSkill.kt - Main skill logic
    • HomeAssistantOutput.kt - Output handling
    • HomeAssistantApi.kt - REST API client
    • HomeAssistantSettings.kt - Settings UI

Sentence Definitions:

  • app/src/main/sentences/skill_definitions.yml - Added sentence IDs
  • app/src/main/sentences/en/home_assistant.yml - English patterns

Proto/DataStore:

  • app/src/main/proto/skill_settings_home_assistant.proto - Settings schema

Tests:

  • app/src/test/kotlin/org/stypox/dicio/skills/homeassistant/HomeAssistantSkillTest.kt - 19 comprehensive tests

Documentation:

  • SETUP.md - Complete setup guide for users

Resources:

  • String resources for UI and speech output
  • Icon for the skill

Architecture

  • Uses Home Assistant REST API for all operations
  • Implements entity mapping for flexible friendly names
  • Handles multiple entity domains (light, switch, cover, lock, person, etc.)
  • Provides detailed error messages for troubleshooting

Testing

✅ All 19 unit tests passing:

  • Entity control (on/off/toggle) - 8 tests
  • Status queries - 7 tests
  • Person location - 4 tests

Tests cover:

  • All sentence pattern variations
  • With/without "the" article
  • Different command verbs (turn, switch, get, check, etc.)
  • Edge cases and pattern conflicts

Known Issues / TODO

Before Merge:

  • Error handling - More robust network error handling
  • UI/UX review - Settings screen design
  • Integration tests - Test against real Home Assistant instance
  • Code review - General code quality and style
  • Performance - Test with large numbers of entities

Pattern Conflicts:

  • Avoided conflict with navigation skill by using "where is the person <name>" instead of "where is <name>"

Limitations:

  • Only supports basic on/off/toggle/status operations
  • No support for setting specific values (brightness, temperature, etc.)
  • No support for scenes or automations
  • Person location returns raw state (not formatted nicely)

Future Enhancements

Potential improvements for future iterations:

  • Support for setting brightness, color, temperature
  • Scene activation
  • Automation triggering
  • Better person location formatting (zone names)
  • Support for climate entities (thermostats)
  • Multi-entity commands ("Turn off all lights")
  • Confirmation prompts for sensitive actions

How to Test

  1. Set up a Home Assistant instance (or use existing)
  2. Build and install the app
  3. Go to Settings > Skills > Home Assistant
  4. Configure Base URL and Access Token
  5. Add entity mappings
  6. Try voice commands (see SETUP.md for examples)

Screenshots

TODO: Add screenshots of settings UI and example interactions

Related Issues

Link to any related issues or discussions

Checklist

  • Code compiles without errors
  • All tests pass
  • Documentation added (SETUP.md)
  • Tested on physical device
  • Security review completed
  • Ready for merge

Feedback and suggestions are welcome!

@mretallack
Copy link
Author

A screen shot.
Screenshot_20251210-180927_Dicio-changes-for-ha

@mretallack
Copy link
Author

The main area to review are the rule, especially the "where is person xxx". It can sometimes trigger the navigation skill.

- Added get_help sentence patterns to home_assistant.yml
- Implemented handleGetHelp() method in HomeAssistantSkill
- Created HelpResponse output class with Compose UI
- Added detailed help strings with command examples and entity types
- Updated skill_definitions.yml to include get_help sentence ID
- Corrected person location syntax in help text to avoid navigation conflicts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants