OH3 MQTT Command Topic not triggered

Hello all,
I have been looking for a solution for the last two days to my problem and I’m getting crazy. Any hint or solution will be appreciated.

I have developed a solution for an irrigation system for my garden. I used this tutorial that perfectly match to what I was preparing. Thanks Hugo for writing it!
Small and simple irrigation solution - OH3

Now I have one thing and multiple channels defined from the OH3 UI, and the group and items defined in a text file. I also prepared a sitemap to switch open/close the valves.

Almost all is working as expected with one exception:

I have a channel to read and post through MQTT the max time for rainning.
The reads work well with the defined “stateTopic”, and it updates the item state.

But… when I update the item state with another amount of seconds, it does not trigger the corresponding MQTT Command Topic to inform tasmota.

Any hint about what could it be? Anything to try from my side?

I post here, partially, the configuration.

thing and channel:
channels:

  • id: huertot
    channelTypeUID: mqtt:string
    label: Huerto Tiempo
    configuration:
    commandTopic: cmnd/riego/PulseTime1
    postCommand: false
    formatBeforePublish: “%s”
    stateTopic: stat/riego/RESULT
    transformationPattern: REGEX:(.Set.)∩JSONPATH:$.PulseTime1.Set∩JS:minus100.js

item
Number n_Huerto_DuraH (g_Huerto) {channel = “mqtt:topic:mosquitto:riego:huertot” , homekit = “Valve.Duration” [homekitDefaultDuration = 300] }

I can update the item state from the sitemap or even from a script. Same result. Command not triggered. Mosquitto is not receiving it.
Here’s a portion of the test script I’m using:

n_Huerto_DuraH.postUpdate(60)
sw_Huerto.postUpdate(ON)

Again, any hint that helps me to troubleshoot the issue or tells me how to fix it is welcome.
Thans for your time reading this topic.

1 Like

It’s called a commandTopic because it reacts to commands, sent to the linked openHAB Item.
You can verify if that happens by looking in your events.log
It doesn’t happen with postUpdate(), which is about updates not commands.

Thanks Rossko57,
I think I get it. Sending a command from a rule would work.
Clearly I do have to look for a different manner to implement it.
Thanks again for the hint.

Just change

n_Huerto_DuraH.postUpdate(60)

to

n_Huerto_DuraH.sendCommand(60)
1 Like

Thanks hafniumzinc, I did the change and still didn’t work.

Then I did some more changes in the definitions and I did realize that I made an error, or confusion, defining the item.

The item was initially defined as “Number”, and the channel as “String”. I changed the item type by “String” and all started to work fine. Making changes from the sitemap, using a “selection” field, it sends the corresponding command to mqtt.

So, the item must be defined as follows:

String n_Huerto_DuraH (g_Huerto) {channel = “mqtt:topic:mosquitto:riego:huertot” , homekit = “Valve.Duration” [homekitDefaultDuration = 300] }

Thanks hafniumzinc and rossko57 for your support.