Repository navigation
Warn on unanswered optional cluster reads - #12
Merged
Merged
Conversation
Also log exceptions of fire-and-forget tasks instead of leaving them unretrieved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Log line (pairing a Tuya TS0001 relay):
ERROR majordom_zigbee.controller:controller.py:976 [PAIR] read_attributes error device=…(TS0001) endpoint=1(ON_OFF_LIGHT) cluster=1794(Metering) error=TimeoutError attrs=plus, once on the CM4 run:
ERROR asyncio:base_events.py:1871 Task exception was never retrieved.Cause
_read_cluster_attributeslogged every exception at ERROR and kept reading the next chunks, so a listed-but-unanswered cluster (Metering on the TS0001) logged an ERROR per chunk and waited the 2 s timeout for each._create_task(and the reconnect task) only discarded finished tasks; nobody retrieved their exceptions.Fix
TimeoutErrornow logs once per cluster read and stops the remaining chunks: WARNING for optional clusters, ERROR still for main-parameter clusters (OnOff, LevelControl, …). Other exceptions stay ERROR. Timeouts unchanged._log_task_exceptiondone-callback on every_create_tasktask and on the reconnect task logs the exception (ERROR with traceback) and so retrieves it.Tested
test_an_unanswered_optional_cluster_read_is_a_warning_not_an_error(TS0001 with Metering timing out: only WARNINGs, one request per read),test_a_failed_background_task_is_logged_not_left_unretrieved.