[matter] Small OTBR action cleanups (#19896)

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
Dan Cunningham
2025-12-27 22:33:53 +01:00
committed by GitHub
parent c97cdf3f02
commit 7180004203
3 changed files with 21 additions and 11 deletions
@@ -375,6 +375,8 @@ public class MatterBindingConstants {
public static final String THING_ACTION_LABEL_OTBR_PUSH_DATASET = "@text/thing-action.otbr.pushDataset.label";
public static final String THING_ACTION_DESC_OTBR_PUSH_DATASET = "@text/thing-action.otbr.pushDataset.description";
public static final String THING_ACTION_LABEL_OTBR_PUSH_DATASET_PUSH_AS_ACTIVE = "@text/thing-action.otbr.pushDataset.pushAsActive.label";
public static final String THING_ACTION_DESC_OTBR_PUSH_DATASET_PUSH_AS_ACTIVE = "@text/thing-action.otbr.pushDataset.pushAsActive.description";
public static final String THING_ACTION_LABEL_OTBR_PUSH_DATASET_RESULT = "@text/thing-action.otbr.pushDataset.result.label";
public static final String THING_ACTION_LABEL_OTBR_PUSH_DATASET_DELAY = "@text/thing-action.otbr.pushDataset.delay.label";
public static final String THING_ACTION_DESC_OTBR_PUSH_DATASET_DELAY = "@text/thing-action.otbr.pushDataset.delay.description";
@@ -139,6 +139,8 @@ public class MatterOTBRActions implements ThingActions {
@RuleAction(label = MatterBindingConstants.THING_ACTION_LABEL_OTBR_PUSH_DATASET, description = MatterBindingConstants.THING_ACTION_DESC_OTBR_PUSH_DATASET)
public @ActionOutputs({
@ActionOutput(name = "result", label = MatterBindingConstants.THING_ACTION_LABEL_OTBR_PUSH_DATASET_RESULT, type = "java.lang.String") }) String pushOperationalDataSetHex(
@ActionInput(name = "pushAsActive", label = MatterBindingConstants.THING_ACTION_LABEL_OTBR_PUSH_DATASET_PUSH_AS_ACTIVE, description = MatterBindingConstants.THING_ACTION_DESC_OTBR_PUSH_DATASET_PUSH_AS_ACTIVE, defaultValue = "false", required = true) @Nullable Boolean pushAsActive,
@ActionInput(name = "delay", label = MatterBindingConstants.THING_ACTION_LABEL_OTBR_PUSH_DATASET_DELAY, description = MatterBindingConstants.THING_ACTION_DESC_OTBR_PUSH_DATASET_DELAY, defaultValue = "30000", required = true) @Nullable Long delay,
@ActionInput(name = "generatePendingTime", label = MatterBindingConstants.THING_ACTION_LABEL_OTBR_PUSH_DATASET_GENERATE_TIME, description = MatterBindingConstants.THING_ACTION_DESC_OTBR_PUSH_DATASET_GENERATE_TIME, defaultValue = "true", required = true) @Nullable Boolean generatePendingTime,
@ActionInput(name = "incrementActiveTime", label = MatterBindingConstants.THING_ACTION_LABEL_OTBR_PUSH_DATASET_INCREMENT_TIME, description = MatterBindingConstants.THING_ACTION_DESC_OTBR_PUSH_DATASET_INCREMENT_TIME, defaultValue = "1", required = true) @Nullable Integer incrementActiveTime) {
@@ -155,8 +157,8 @@ public class MatterOTBRActions implements ThingActions {
if (delay == null) {
delay = 30000L;
}
// default to generating a new pending timestamp
if (generatePendingTime == null || generatePendingTime.booleanValue()) {
if (!Boolean.TRUE.equals(pushAsActive) && !Boolean.FALSE.equals(generatePendingTime)) {
// default to generating a new pending timestamp
tds.setPendingTimestamp(ThreadTimestamp.now(false));
}
ThreadTimestamp ts = Objects
@@ -169,7 +171,11 @@ public class MatterOTBRActions implements ThingActions {
String dataset = tds.toHex();
logger.debug("New dataset hex: {}", dataset);
try {
converter.setPendingDataset(dataset).get();
if (Boolean.TRUE.equals(pushAsActive)) {
converter.setActiveDataset(dataset).get();
} else {
converter.setPendingDataset(dataset).get();
}
return translationService.getTranslation(MatterBindingConstants.THING_ACTION_RESULT_SUCCESS) + ": "
+ tds.toJson();
} catch (Exception e) {
@@ -361,8 +361,8 @@ thing-action.result.error-setting-dataset = Error setting active dataset
# matter otbr actions
thing-action.otbr.generateDataset.label = Thread: Operational Dataset Generator
thing-action.otbr.generateDataset.description = Generates a new operational dataset and optionally saves it locally.
thing-action.otbr.generateDataset.label = Thread: New Operational Dataset Generator (Advanced)
thing-action.otbr.generateDataset.description = Allows the creation of a new operational dataset with custom parameters and optionally saves it locally to the thing's configuration.
thing-action.otbr.generateDataset.result.label = Set Result
thing-action.otbr.generateDataset.json.label = Operational Dataset JSON
thing-action.otbr.generateDataset.hex.label = Operational Dataset Hex
@@ -408,18 +408,20 @@ thing-action.otbr.generateDataset.tobleLink.label = Security Policy: TO BLE Link
thing-action.otbr.generateDataset.tobleLink.description = Security Policy: TO BLE Link. Defaults to true.
thing-action.otbr.generateDataset.nonCcmRouters.label = Security Policy: Non-CCM Routers
thing-action.otbr.generateDataset.nonCcmRouters.description = Security Policy: Non-CCM Routers. Defaults to false.
thing-action.otbr.loadActiveDataset.label = Thread: Load operational dataset from device
thing-action.otbr.loadActiveDataset.description = Updates the local operational dataset configuration from the device.
thing-action.otbr.loadActiveDataset.label = Thread: Sync operational dataset from device
thing-action.otbr.loadActiveDataset.description = Updates the local operational dataset configuration for this thing from the device.
thing-action.otbr.loadActiveDataset.result.label = Set Result
thing-action.otbr.loadActiveDataset.dataset.label = Operational Dataset (Hex)
thing-action.otbr.loadExternalDataset.label = Thread: Load external operational dataset
thing-action.otbr.loadExternalDataset.description = Updates the local operational dataset configuration from a hex or JSON string for the node. Use the 'Push local operational dataset' action to push the dataset back to the device after loading.
thing-action.otbr.loadExternalDataset.label = Thread: Import operational dataset from JSON or Hex string
thing-action.otbr.loadExternalDataset.description = Updates the local operational dataset configuration for this thing from a hex or JSON string for the node. Use the 'Push local operational dataset' action to push the dataset back to the device after loading.
thing-action.otbr.loadExternalDataset.dataset.label = Thread operational dataset
thing-action.otbr.loadExternalDataset.dataset.description = The thread operational dataset to set (hex or JSON)
thing-action.otbr.loadExternalDataset.result.label = Set Result
thing-action.otbr.pushDataset.label = Thread: Push local operational dataset
thing-action.otbr.pushDataset.description = Pushes the local operational dataset configuration to the device.
thing-action.otbr.pushDataset.label = Thread: Push local operational dataset configuration to device
thing-action.otbr.pushDataset.description = Pushes the local operational dataset configuration for this thing to the device as a pending (default) or active dataset.
thing-action.otbr.pushDataset.result.label = Set Result
thing-action.otbr.pushDataset.pushAsActive.label = Push as Active
thing-action.otbr.pushDataset.pushAsActive.description = Push the dataset as the active dataset. If this is the first time pushing the dataset, set this to true, otherwise leave it as false (default) to push as a pending dataset which will be activated when the delay timer expires giving Thread devices time to transition to the new dataset.
thing-action.otbr.pushDataset.delay.label = Pending Delay
thing-action.otbr.pushDataset.delay.description = The delay in milliseconds before the pending dataset is active. Required to be a minimum of 30 seconds (30000ms), use a longer value of 5 minutes or more if battery powered (sleepy) devices are present to ensure all device are notified of the new dataset.
thing-action.otbr.pushDataset.generateTime.label = Generate New Pending Timestamp