Skip to content

Conversation

@FrankBakkerNl
Copy link
Contributor

@FrankBakkerNl FrankBakkerNl commented Nov 16, 2025

Breaking change

Proposed change

Fix deserialzing devices that have a numeric manufacturer

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:

@codecov
Copy link

codecov bot commented Nov 16, 2025

Codecov Report

❌ Patch coverage is 92.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82%. Comparing base (89da80a) to head (e1afab2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ient/Internal/Json/EnsureArrayOfStringConverter.cs 76% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           main   #1348   +/-   ##
====================================
- Coverage    82%     82%   -1%     
====================================
  Files       198     199    +1     
  Lines      3892    3909   +17     
  Branches    438     443    +5     
====================================
+ Hits       3207    3216    +9     
- Misses      517     523    +6     
- Partials    168     170    +2     
Flag Coverage Δ
unittests 82% <92%> (-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.

Copy link
Contributor

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 fixes deserialization issues when Home Assistant devices have numeric values for string properties like manufacturer, ID, area_id, and labels. It introduces a new EnsureArrayOfStringConverter to handle array properties that may contain mixed string/numeric values.

  • Added EnsureArrayOfStringConverter to handle arrays with mixed string/numeric elements
  • Applied EnsureStringConverter to all string properties in HassDevice for consistency
  • Applied EnsureArrayOfStringConverter to the Labels property
  • Updated tests to verify numeric manufacturer and mixed-type labels are properly converted

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Client/NetDaemon.HassClient/Internal/Json/EnsureArrayOfStringConverter.cs New JSON converter that handles arrays of strings/numbers and single values, converting everything to string lists
src/Client/NetDaemon.HassClient/Common/HomeAssistant/Model/HassDevice.cs Applied converters to all string and string array properties; reformatted for consistency with attributes on separate lines
src/Client/NetDaemon.HassClient.Tests/Json/HassDeviceConverterTests.cs Enhanced tests to verify numeric manufacturer and mixed-type labels are properly deserialized to strings

@FrankBakkerNl FrankBakkerNl merged commit 5069f2b into net-daemon:main Nov 18, 2025
7 checks passed
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