Configure irrigation system over mqtt

I´ve an irrigation system that can be configured and controlled over mqtt, just publising messages.

For example:
// (1) to enable an irrigation line
irrigation/greenhouse/pots/enable “1”
// (2) to start irrigation manually
irrigation/greenhouse/state “1”
// (3) to set the irrigation time of specific line
irrigation/greenhouse/pots/time “15”
// (4) to set irrigation schedule
irrigation/greenhouse/schedule “0 0 4 * * ?”

How can I integrate this to OH. I already have some lights working with mqtt just fine but in this case my specific doubt is when I need to send data to it, not just changing its state (examples 3 & 4)

Any help will be appreciated.

You can install and use the mqtt action:

publish(String brokerName, String topic, String message)

Use this in a rules

publish(String brokerName, String topic, String message)

For example:

publish("yourbroker", "irrigation/greenhouse/schedule", "0 0 4 * * ? *")

Thanks for your response. What you suggest is good, but the value would be harcoded within the rule. Is there any way to take that value from any source in a way that could be updated from any of the UI’s??

Yes of course there is
Depends what your cron string needs basicaly
Your current string triggers at 4am everyday
So you could have the value 4 in a Dimmer item in the UI and use a slider to select the number
Then your rule will be like:

rule "schedule changed"
    Item Irrigation_Schedule changed
    val hour = String::format("%d", (Irrigation_Schedule.state as DecimalType).floatValue())
    val cronString = "0 0 " + hour + " * * ? *"
    publish("yourbroker", "irrigation/greenhouse/schedule", cronString)

I’ll try it! Tranks for your help.