Skip to content

fix Myneomitis sub-devices#168631

Open
l-pr wants to merge 166 commits intohome-assistant:devfrom
AXENCO-FR:myneomitis
Open

fix Myneomitis sub-devices#168631
l-pr wants to merge 166 commits intohome-assistant:devfrom
AXENCO-FR:myneomitis

Conversation

@l-pr
Copy link
Copy Markdown
Contributor

@l-pr l-pr commented Apr 20, 2026

Proposed change

Fixes the retrieval and transmission of the correct attributes for sub-devices, allowing them to operate without critical errors.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • 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:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
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

Fixes MyNeomitis sub-device handling by adjusting how sub-device attributes (parents, rfid, and NTD cooling detection fields) are interpreted so sub-devices can operate without errors.

Changes:

  • Updates sub-device gateway lookup to use the parents attribute as a comma-delimited string instead of a dict.
  • Adjusts NTD HVAC mode initialization to infer COOL vs HEAT from comfTemp/ecoTemp.
  • Updates tests/fixtures to reflect the new sub-device attribute shapes.

Reviewed changes

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

File Description
homeassistant/components/myneomitis/select.py Adds UFH sub-device API call path using parents/rfid, with error handling.
homeassistant/components/myneomitis/climate.py Changes sub-device gateway extraction and NTD initial HVAC mode selection logic.
tests/components/myneomitis/test_select.py Updates UFH test fixture to include parents and rfid fields.
tests/components/myneomitis/test_climate.py Updates NTD fixtures to include parents string and comfTemp/ecoTemp, and adjusts expectations.

else None
)
if model == "NTD" and state.get("changeOverUser") == 1:
if model == "NTD" and state.get("comfTemp") < state.get("ecoTemp"):
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Guard the NTD COOL/OFF detection against missing/non-numeric comfTemp/ecoTemp values (or make them required) to avoid a TypeError when comparing None to a number.

Suggested change
if model == "NTD" and state.get("comfTemp") < state.get("ecoTemp"):
comf_temp = state.get("comfTemp")
eco_temp = state.get("ecoTemp")
if (
model == "NTD"
and isinstance(comf_temp, int | float)
and isinstance(eco_temp, int | float)
and comf_temp < eco_temp
):

Copilot uses AI. Check for mistakes.
Comment on lines +318 to +322
gateway = (
self._parents.split(",")[1]
if isinstance(self._parents, str)
else None
)
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Parse the gateway from parents without relying on a fixed comma layout (the current split(',')[1] can raise IndexError for a string that doesn’t contain at least two comma-separated parts).

Copilot uses AI. Check for mistakes.
Comment on lines +343 to +347
gateway = (
self._parents.split(",")[1]
if isinstance(self._parents, str)
else None
)
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Parse the gateway from parents without relying on a fixed comma layout (the current split(',')[1] can raise IndexError for a string that doesn’t contain at least two comma-separated parts).

Suggested change
gateway = (
self._parents.split(",")[1]
if isinstance(self._parents, str)
else None
)
gateway = None
if isinstance(self._parents, str):
parent_parts = [
part.strip() for part in self._parents.split(",") if part.strip()
]
if parent_parts:
gateway = parent_parts[-1]

Copilot uses AI. Check for mistakes.
Comment on lines +209 to +213
gateway = (
self._parents.split(",")[1]
if isinstance(self._parents, str)
else None
)
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Parse the gateway from parents without relying on a fixed comma layout (the current split(',')[1] can raise IndexError for a string that doesn’t contain at least two comma-separated parts).

Suggested change
gateway = (
self._parents.split(",")[1]
if isinstance(self._parents, str)
else None
)
gateway = None
if isinstance(self._parents, str):
parent_parts = [
part.strip() for part in self._parents.split(",") if part.strip()
]
if len(parent_parts) >= 2:
gateway = parent_parts[-1]

Copilot uses AI. Check for mistakes.
Comment on lines +206 to +223
if self._device["model"] in SUPPORTED_MODELS:
await self._api.set_device_mode(self._device["_id"], mode_code)
else: # UFH
gateway = (
self._parents.split(",")[1]
if isinstance(self._parents, str)
else None
)
rfid = self._device.get("rfid")
if not gateway or not rfid:
_LOGGER.error(
"Missing gateway or rfid for sub-device %s, cannot set mode",
self._attr_unique_id,
)
raise HomeAssistantError(f"Failed to set mode for {self.entity_id}")

await self._api.set_sub_device_mode_ufh(gateway, str(rfid), mode_code)
except (aiohttp.ClientError, TimeoutError, ConnectionError) as err:
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

Add a test that exercises the UFH sub-device path in async_select_option (including the parents/rfid handling and the set_sub_device_mode_ufh call), since current tests only cover the non-sub-device set_device_mode branch.

Copilot uses AI. Check for mistakes.
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