Repository navigation
Conversation
|
Hi @Eddine97 Thanks for your PR! The summary is helpful, but I feel some context is still missing. Can you please provide a bit more detail about the PR, particularly the current challenge it addresses and how this change solves the problem? This would help us better understand the motivation behind the changes. |
pendingRebootCount is exposed for tests but was not exercised by any test, which golangci-lint flagged as unused. Add a minimal test that covers the empty, add, remove, and cleanup paths.
|
Thanks for the review. The missing context is the OTA strategy itself. The problemMySensors has two OTA mechanisms that need opposite controller behaviors,
The controller had no way to know which kind of node it was talking to, How it works
This is why the two features are in the same PR: they share the queue. What changes in the logsBefore: After: Tested in productionI have been running this patched version since early October, together This PR is part of a broader effort to bring the most useful MYSController Backward compatibility
Notes
|
Summary
Detect the bootloader kind from ST_FIRMWARE_CONFIG_REQUEST and persist it in
node labels (bootloader_kind, bootloader_version). This lets the controller
pick the right OTA strategy:
Add set-sleep-duration node action for smart-sleep nodes:
These features are coupled: bootloader detection is what makes OTA reliable, and the queue introduced for set-sleep-duration is reused for the pré-OTA reboot of sleeping nodes.
Why bootloader detection
OTA needs a different strategy depending on two independent axes:
I_REBOOThere is a pré-OTA reboot, sent only to put MYSBootloader nodesinto bootloader mode before serving firmware; it is never sent for Protocol 3.1
nodes, whose application handles the OTA directly. Independently, every node
performs a post-OTA reset (bootloader or watchdog) once the new firmware is
written — that reset is initiated by the node, not by the controller.
Without knowing the bootloader kind, the controller cannot pick the right
strategy. On MYSBootloader nodes, OTA silently fails today: the node never
enters bootloader mode, so it never sends ST_FIRMWARE_CONFIG_REQUEST.
Detecting bootloader_kind from the first ST_FIRMWARE_CONFIG_REQUEST
lets the controller:
The bootloader_ota_reboot=true label remains available as a manual override,
for cases where the user wants to force or disable the pré-OTA reboot regardless
of the detected kind.
Backward compatibility
Client.ExecuteNodeAction(action, ids)still works. New usage:Client.ExecuteNodeAction(action, ids, payload). No server-side break.ExecuteNodeAction gains an optional payload parameter, variadic for
backward compatibility.
Test plan
go test ./cmd/client/command/action/ ./plugin/gateway/provider/mysensors_v2/myc action node <alias> set-sleep-duration:<sensor_id>:<pct> <gw.node>sendsC_SET/V_PERCENTAGE.sleep command queued until next wake.sent I_REBOOT before OTAandsuccessful config handshake.
detected bootloaderlog line with correct kind and version.Notes
This is a behavior change for users who previously relied on the OTA being
passive. The
bootloader_ota_reboot=falselabel does not currently disablethe automatic reboot; if this is desired, a follow-up PR can add an opt-out
label.