I have a .thing file like such:
Thing mqtt:topic:mosquitto:bhyve_backyard_lawn "Watering Backyard Lawn" (mqtt:broker:mosquitto) @ "Garden" {
Channels:
Type switch: tap "Tap" [ commandTopic="bhyve/device/device_id_xxx/zone/xxx/set", transformationPatternOut="JSONPATH:$.state" ]
}
.item file
Switch BackyardLawnTimer_Tap "Tap" (gWateringTaps) { channel="mqtt:topic:mosquitto:bhyve_backyard_lawn:tap" }
how can I get the commandTopic string from inside a rule?
This may be a type of XY question. What I’d really like to achieve is for the MQTT command to be published as { state: “ON”, duration: xxx } where xxx is taken from another item. But I “believe” that is not possible. So as an alternative, I am writing a rule to publish the command using an MQTT action. However I’d like to get the triggering item’s commandTopic from within the rule. Is this possible?