-
-
Notifications
You must be signed in to change notification settings - Fork 0
Alle Kommandos via mqtt abbilden #8
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
Open
sidey79
wants to merge
26
commits into
main
Choose a base branch
from
feat/mqttCommands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
STX messages (sensor data) can be interleaved with command responses, similar to MU/MS messages. The controller must skip these messages and continue waiting for the actual command response. The STX message is parsed to ensure sensor data is handled correctly while waiting.
- Fix busy loop in `mock_transport` fixture by adding `asyncio.sleep` to `readline` side effect. - Fix `test_initialize_retry_logic` assertion to account for 'XQ' command sent during initialization. - Fix `test_stx_message_bypasses_command_response` by manually starting controller tasks and updating mock response. - Fix `test_send_command_with_response` by starting the missing `_parser_task`, updating mock to avoid StopIteration, and increasing timeout. - Fix `test_message_callback` mock setup to yield message once and then None. - Fix `test_send_command_fire_and_forget` cleanup logic to remove undefined `reader_task` cancellation.
This commit introduces new functionality to process Signalduino commands received via MQTT, significantly enhancing the integration capabilities of PySignalduino. Key changes include: - Extended the command list in `signalduino/commands.py` to include new MQTT-related commands and specific CC1101 register commands. - Implemented and integrated the MQTT publisher logic within `signalduino/controller.py`. - Introduced and adapted unit tests in `tests/test_mqtt_commands.py` and other test files to ensure full coverage of the new MQTT command processing.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
+ Coverage 79.02% 80.62% +1.59%
==========================================
Files 55 57 +2
Lines 5177 5413 +236
Branches 628 597 -31
==========================================
+ Hits 4091 4364 +273
+ Misses 863 839 -24
+ Partials 223 210 -13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… CPU idle usage The `_reader_task`'s `await asyncio.sleep(0)` call was conditionally placed inside the `if line is not None:` block. If the underlying transport's `readline()` implementation unexpectedly returns immediately without raising an exception or yielding correctly (e.g., in a race condition or specific platform behavior), the `while` loop could consume 100% CPU in the idle state. Moving `await asyncio.sleep(0)` to be unconditionally executed at the end of the `try` block ensures the event loop yields to other tasks in every loop iteration, even if no line was received.
Integriert einen dedizierten MQTT Command-Listener und refaktoriert die Publisher/Controller-Beziehung für direktes Command-Handling. - feat(mqtt): MqttPublisher verarbeitet Commands nun intern über `_handle_command` - refactor(controller): Controller injiziert MqttPublisher für Heartbeats und direkten Zugriff - perf(protocols): Optimierung der Demodulationsschleife für inaktive Protokolle in `message_unsynced.py` - fix(main): Auflösung der zirkulären Abhängigkeit zwischen Controller und Publisher - test: Anpassung der Testsuite an neue Architektur und Mocking-Strategie
Refactor MQTT handling to use MqttCommandDispatcher. Add CLI tool for MQTT commands. Add tests and architecture documentation.
4aaed61 to
c3c36c4
Compare
The 'req_id' field in MQTT command payloads is now optional. This required changes to the JSON schema validation and the response handling logic. - Updates `BASE_SCHEMA` and `SEND_MSG_SCHEMA` in `signalduino/commands.py` to remove the `req_id` requirement. - Modifies `MqttCommandDispatcher.dispatch` to return `None` for `req_id` if not present in the payload. - Adjusts `MqttPublisher._handle_command` to correctly extract the optional `req_id` for success and error responses. - Adds `test_controller_handles_get_frequency_without_req_id` to verify the new optional behavior. - Updates `docs/architecture/proposals/mqtt_set_commands.adoc` to document the optional nature of `req_id`.
Die Debug-Meldungen in den Protokolldateien wurden fälschlicherweise über print() ausgegeben, was dazu führte, dass sie unabhängig vom konfigurierten log-level (z.B. INFO) im Terminal erschienen. Die direkten print()-Aufrufe wurden durch korrekte logging.debug()-Aufrufe in sd_protocols/message_synced.py und sd_protocols/pattern_utils.py ersetzt.
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.
No description provided.