Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix instability with HomeKit trigger accessories #80703

Merged
merged 25 commits into from
Nov 15, 2022

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 20, 2022

Proposed change

  • The key used to generate the unique_id to ensure the iid was stable was not unique enough which is only now obvious that we have stable restore of iids.
  • We need to skip triggers that require an input such as a number state (ie above, or below) since HomeKit has no way to take an input for these

fixes #78774 fixes #81685

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:

Checklist

  • 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
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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 link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@bdraco
Copy link
Member Author

bdraco commented Oct 29, 2022

So whats happening is that it wants a value but we can only support ones that don't require a value. So we need to skip thoose

2022-10-29 16:25:36.755 ERROR (MainThread) [homeassistant.components.homekit.type_triggers] Error setting up trigger
Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable
    return schema(data)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/homeassistant/helpers/config_validation.py", line 146, in validate
    raise vol.Invalid(f"must contain at least one of {expected}.")
voluptuous.error.Invalid: must contain at least one of below, above.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/homeassistant/components/device_automation/trigger.py", line 81, in async_attach_trigger
    return await platform.async_attach_trigger(hass, config, action, trigger_info)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/homeassistant/components/sensor/device_trigger.py", line 176, in async_attach_trigger
    numeric_state_config = await numeric_state_trigger.async_validate_trigger_config(
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/homeassistant/components/homeassistant/triggers/numeric_state.py", line 73, in async_validate_trigger_config
    config = _TRIGGER_SCHEMA(config)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec
    v = func(v)
  File "/Users/bdraco/home-assistant/venv/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 276, in __call__
    raise er.MultipleInvalid([e])
voluptuous.error.MultipleInvalid: must contain at least one of below, above.

@bdraco bdraco changed the title Prevent a single invalid trigger from affecting other HomeKit trigger accessories Fix instability with HomeKit trigger accessories Nov 8, 2022
@bdraco
Copy link
Member Author

bdraco commented Nov 8, 2022

They work now but hard to even tell which one is which with iOS 16 because of #78468

@bdraco bdraco added this to the 2022.11.3 milestone Nov 9, 2022
@bdraco bdraco marked this pull request as ready for review November 9, 2022 19:02
@frenck frenck merged commit ade4b62 into home-assistant:dev Nov 15, 2022
@bdraco
Copy link
Member Author

bdraco commented Nov 15, 2022

thanks

frenck pushed a commit that referenced this pull request Nov 16, 2022
@frenck frenck mentioned this pull request Nov 16, 2022
@bdraco bdraco mentioned this pull request Nov 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HomeKit - Error When Configuring Device Triggers Homekit - Error setting up trigger
2 participants