Skip to content

Conversation

FrankBakkerNl
Copy link
Contributor

Breaking change

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • The code compiles without warnings (code quality check)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration are added/changed:

@FrankBakkerNl FrankBakkerNl force-pushed the minimal_damon branch 2 times, most recently from 3a031c7 to 9a7487f Compare July 25, 2025 20:14
@FrankBakkerNl FrankBakkerNl requested a review from Copilot July 25, 2025 20:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a "Minimal NetDaemon" implementation that allows simple console applications to connect to Home Assistant without the full NetDaemon runtime. The main addition is a new HaContextFactory that provides a simplified entry point for creating IHaContext instances.

Key changes:

  • Added a new HaContextFactory class with a static CreateAsync method for simple HA connections
  • Refactored cache initialization to accept IHomeAssistantConnection directly instead of relying on IHomeAssistantRunner
  • Added new overloaded connection methods in HomeAssistantClientConnector to support WebSocket URL strings
  • Created a debug console client project to demonstrate the minimal usage pattern

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/HassModel/NetDaemon.HassModel/HaContextFactory.cs New factory class providing simplified IHaContext creation for console apps
src/HassModel/NetDaemon.HassModel/ICacheManager.cs Updated interface to accept IHomeAssistantConnection parameter
src/HassModel/NetDaemon.HassModel/Internal/*.cs Refactored cache classes to use direct connection instead of runner dependency
src/Client/NetDaemon.HassClient/Common/HomeAssistantClientConnector.cs Added overloaded methods for WebSocket URL connection
src/debug/ConsoleClient/* New debug project demonstrating minimal NetDaemon usage
NetDaemon.sln Added new ConsoleClient project to solution

Copy link

codecov bot commented Aug 11, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (abec1da) to head (2428f31).

Files with missing lines Patch % Lines
...n.HassModel/Internal/AppScopedHaContextProvider.cs 66% 0 Missing and 2 partials ⚠️
...Daemon.HassModel/Internal/BackgroundTaskTracker.cs 33% 1 Missing and 1 partial ⚠️
....HassClient/Common/HomeAssistantClientConnector.cs 75% 0 Missing and 1 partial ⚠️
...odel/NetDaemon.HassModel/Internal/RegistryCache.cs 66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           main   #1315   +/-   ##
====================================
  Coverage    82%     82%           
====================================
  Files       197     198    +1     
  Lines      3877    3901   +24     
  Branches    429     429           
====================================
+ Hits       3193    3219   +26     
  Misses      518     518           
+ Partials    166     164    -2     
Flag Coverage Δ
unittests 82% <87%> (+<1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@FrankBakkerNl FrankBakkerNl marked this pull request as ready for review September 14, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants