OH2: functioning system, added new MQTT publish rule, which does not run

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Rev 1.2_
    • Host: rpi3ohv2 Kernel: 5.4.51-v7+ armv7l bits: 32 Console: tty 2
    • Distro: Raspbian GNU/Linux 10 (buster)
    • OpenJDK Runtime Environment (Zulu 8.31.1.122-linux_aarch32hf) (build 1.8.0_181-b122)
  • Version: 2.5.11 (Build) (apt-get), text-based config
    • binding = astro, exec, logreader, network, ntp, systeminfo, fritzboxtr0641, expire1, mqtt1, weather1
    • ui = paper, basic, classic, restdocs
    • persistence = rrd4j, mapdb
    • action = mail, mqtt
    • transformation = map, javascript, xslt, scale, jsonpath

(Sytem will not be touched; e.g.,updated, etc. only item and rule changes)

On the risk of getting reminded to upgrade, I post anyway :slight_smile:

I have a fully functioning system; no problem, no errors.
Have rules that send MQTT publish command perfectly fine.

Created a new rule file with a MQTT publish rule in it, which does not send its payload.

Here a rule that works

rule "Stop Irrigation1"
    when
        Item Irrigation1_Now  changed from ON to OFF or
        Item Irrigation1_Auto changed from ON to OFF
    then
        // if not allowed, valves were/are not ON; hence, no fail-safe required either
        if (Irrigation1_Allowed.state == ON)
        {
            // Cancel any timers
            logInfo(logPrefix + "09.01", "Irrigation1: stopping = cancelling timer(s)")
            // Cancel the timer if there is one, the ? will cause the line to be skipped if timer is null
            irrigation1Timer?.cancel
            irrigation1Timer = null

            // Turn off any open valves
            //logInfo(logPrefix + "09.02", "Irrigation1: turning OFF all valves regardless of state")
            publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Valve", "0000")

            // Update the status
            //Irrigation1_Curr.sendCommand("None")
            Irrigation1_Curr.postUpdate("None")
            //logInfo(logPrefix + "09.03", "Irrigation1: cancelled!")
            Irrigation1_Reset.postUpdate(ON)

            // switch on pump failsafe
            PumpStation1_PumpFailsafe.postUpdate(ON)
            logInfo(logPrefix + "09.04", "Irrigation1: turning ON pump failsafe and timer")

            // switch OFF failsafe after ten minutes and kill timer
            station1_pump_failsafe_timer = createTimer(now.plusMinutes(10), [|
                logInfo(logPrefix + "09.05", "Irrigation1: turning OFF pump failsafe and timer")
                PumpStation1_PumpFailsafe.postUpdate(OFF)
                station1_pump_failsafe_timer = null
            ])
        }
end

Here my new rule:

rule "Solar hybrid schedule 1"
	when
		Item spm_Solar_Hybrid_Control_1 changed
	then
		if (spm_Solar_Hybrid_Control_1.state == ON)
		{
            publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
            //mqttActions.publishMQTT(mqttTopicRoot + "Command", "8051,0,1")
		}
		else
		{
            publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,0")
		}

		logInfo(logPrefix + "03.02", "set solar hybrid 1.: {}", spm_Solar_Hybrid_Control_1.state)
end

To put a publish command from each file under each other

publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Valve", "0000")
publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")

I do not understand why this new rule is not working.
Don’t even know how to figure this out.

Have, as a last ditch effort, rebooted openHAB (in fact the rPi too), to no avail.
Any hints appreciated.

Try

val mqttActions = getActions("mqtt","mqtt:broker:myBroker")
mqttActions.publishMQTT("mytopic","myvalue", true)
rule "Solar hybrid schedule 1"
	when
		Item spm_Solar_Hybrid_Control_1 changed
	then
        val mqttActions = getActions("mqtt","mqtt:broker:myBroker") // Your Broker Name
		if (spm_Solar_Hybrid_Control_1.state == ON)
		{
            //publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
            mqttActions.publishMQTT("ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
		}
		else
		{
            publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,0")
		}

		logInfo(logPrefix + "03.02", "set solar hybrid 1.: {}", spm_Solar_Hybrid_Control_1.state)
end

Thanks…

It did not like the mqttActions…

2022-10-08 21:24:49.950 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Solar hybrid schedule 1': The name 'mqttActions' cannot be resolved to an item or type; line 229, column 13, length 11

This system only uses the v1 mqtt publish function; works in all other rules; just not this one.

Manual issue of the command works:

# [2022-10-05 19:56] maxg@x570 ~ $ 
mosquitto_pub -h 192.168.1.5 -t ArgyleCourt/Shed/Modbus/Command -m "8051,0,1"
# [2022-10-05 19:57] maxg@x570 ~ $ 
mosquitto_pub -h 192.168.1.5 -t ArgyleCourt/Shed/Modbus/Command -m "8051,0,0"
# [2022-10-05 19:57] maxg@x570 ~ $ 
mosquitto_pub -h 192.168.1.5 -t ArgyleCourt/Shed/Modbus/Command -m "8051,0,0"

10/05/22 19:57:15.756 ArgyleCourt/Shed/Modbus/Command 8051,0,1
10/05/22 19:57:21.913 ArgyleCourt/Shed/Modbus/Command 8051,0,0
10/05/22 19:58:05.944 ArgyleCourt/Shed/Modbus/Command 8051,0,0

Go figure… :slight_smile:

is the related jar file installed ( see MQTT action problems - #2 by rlkoshak ) ?

would it work in case you create a separate rule file for your original rule ( just to check if this is caused by something before your rule lines ) ?

I’m just guessing, but this feels like a rule file has a duplicate name or rule in file has a duplicate rule name or something
Working rule is in existing rule file. New rule added to existing rule file or new rule file. You watched the log and saw new rule file or existing file with new rule load ok?
Try creating a new file, just to test. Or comment out everything but a log statement and see if rule will run

Thanks :slight_smile:

Have no duplicate rule names.

rule "433: identify sensors"
rule "433 rules started"
rule "433: Shed_NLO_PIR timer"
rule "Allow hot water system heating for 2h after SOC reached 100 AND Irrigation tank is full"
rule "Annual Selectronic data resets"
rule "Astro rules started"
rule "Auto-shading Roller Shutter Living West"
rule "Auto-Start Irrigation1"
rule "Battery power last updated"
rule "Bootstrap for init"
rule "Bootstrap in watersystems"
rule "Bore Pump run time today reset"
rule "Bore Pump started"
rule "Bore Pump stopped"
rule "Calculate solar PV total"
rule "check if pump runs too long after irrigation stopped"
rule "Check Internet Speed"
rule "Compute outdoor humidex"
rule "Convert UTC timestamp to local date-time"
rule "correct state for bedroom window to close"
rule "correct state for bedroom window to open"
rule "correct state for mediaroom external door to closed"
rule "correct state for mediaroom external door to open"
rule "Disable all grid charge schedules"
rule "Do not allow Irrigation1"
rule "Door bell gate OFF"
rule "Fritzbox: Incoming call, get number and resolve name from phonebook"
rule "Frtizbox rules started"
rule "Garbage bin collection today"
rule "Garbage bin collection today cancel"
rule "Garbage bin collection tomorrow"
rule "Geo Location Helga"
rule "Geo Location Max"
rule "GPS_Base_LastReboot and update"
rule "GPS_Base operational set values"
rule "GPS Base station started"
rule "GPS location system started"
rule "Grid-charge if required"
rule "Grid profit and loss"
rule "Heated Blanket Helga last ON"
rule "Heated Blankets Helga OFF"
rule "Heated Blankets Helga ON"
rule "Heated Blankets OFF"
rule "Heated Blankets ON"
rule "House_TriS: last reboot and update"
rule "Irrigation1 enabled"
rule "Irrigation1: Switches Auto and Now off"
rule "Irrigation1 system started"
rule "Irrigation1 valve cascade ON"
rule "Irrigation2 system started"
rule "Irrigation tank filled up"
rule "Irrigation tank update not received"
rule "Irrigation valves OFF"
rule "Last time speedtest was run"
rule "lower all blinds"
rule "MainGate: last reboot and update"
rule "MainGate rules started"
rule "Midnight cron resets"
rule "Modbus Last Reboot"
rule "Modbus started"
rule "NLO KDL door standard shade position"
rule "NLO KDL window standard shade position"
rule "Notify of cell under voltage"
rule "Notify of log reader messages"
rule "Other rules started"
rule "OutsideShell Notifications"
rule "OutsideShell updated"
rule "Post last date of Internet going down"
rule "PumpStation1_LastReboot and update"
rule "PumpStation1 reset volumes"
rule "PumpStation2 add up volumes"
rule "PumpStation2 check actual number of valves recorded"
rule "PumpStation2 force active valve based on current time"
rule "PumpStation2_LastReboot and update"
rule "PumpStation2 reset and update values"
rule "PumpStation2 reset some values before session start"
rule "PumpStation2 update current valve and count"
rule "PumpStation2 update flow and volume"
rule "PumpStation2 update last ON time for valve and irrigation"
rule "Rainfall prior to today"
rule "raise all blinds"
rule "reset AM/PM counters"
rule "Reset blnEmailLock_CellV"
rule "Reset errMsgCount to zero"
rule "reset flag if SOC reached 100 percent"
rule "Reset Internet down"
rule "reset items in case they were triggered and need resetting"
rule "RF433TX system started"
rule "rPiAutomation memory too low alert"
rule "RTL433 data received"
rule "Set Light_House_Master_Bed_North value"
rule "Shed_RC41_LastReboot and update"
rule "Shed rules starting"
rule "SLO bedroom window standard shade position"
rule "SLO Media room door standard shade position"
rule "SLO window blind non-astro time ON"
rule "Solar hybrid schedule 1"
rule "Solar hybrid schedule 2"
rule "Solar hybrid schedule 3"
rule "Solar hybrid schedule 4"
rule "Solar hybrid schedule 5"
rule "SPPRO-BMS system started"
rule "SP PRO GO: Grid Support"
rule "SP PRO GO: Manual grid support OFF"
rule "SP PRO GO: Manual grid support ON"
rule "SP PRO GO: reduce charge rate by 1% every 12 minutes"
rule "SP PRO GO: start grid support at 1500 if SOC less than 90"
rule "Start Allow refilling of bore water tanks"
rule "Start Irrigation1"
rule "start timer for HWS boost if required"
rule "Stop Allow refilling of bore water tanks"
rule "Stop boosting HWS"
rule "Stop Irrigation1"
rule "System started House sensors"
rule "System started, make sure everything is off"
rule "System started, restart the cascade"
rule "System started test rules"
rule "Tesla rules started"
rule "test start timer for HWS boost if required"
rule "test Stop boosting HWS"
rule "TX433: last reboot and update"
rule "Update Bore Pump run time"
rule "Update DarkSky temperature min/max"
rule "Update last time air pump was ON in irrigation tank controller"
rule "Update last time door bell was rung"
rule "Update last time main gate closed"
rule "Update last time the bore pump updated"
rule "Update last time the house bore water tank updated"
rule "Update last time The Hub updated"
rule "Update last update datum for DarkSky weather"
rule "Update night state"
rule "Update rain last 24H"
rule "Update SOC Level max / min values"
rule "Update Tank Irrigation Level max / min values"
rule "Update when HWS was last on"
rule "Weather sensor rules starting"
rule "Zeva BMS started"
rule "Zeva Cell sets values"
rule "Zeva Current update"
rule "Zeva Last Reboot"
rule "Zeva Operational set values"
rule "Zeva update min max"

However, I do not know if rule names have a character limitation, cannot start with a number or cannot have colon in it.

I did watch the log and it runs the rule. Had initially a log statement in if and else (before simplifying it to the end of it.

And added the rule in a file of its own. It does not publish either.

2022-10-09 08:10:00.721 [INFO ] [.smarthome.model.script.Modbus.03.02] - set solar hybrid 1.: ON
2022-10-09 08:10:06.842 [INFO ] [.smarthome.model.script.Modbus.03.02] - set solar hybrid 1.: OFF
2022-10-09 08:21:19.408 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'test.rules'
2022-10-09 08:21:27.164 [INFO ] [arthome.model.script.testRules.00.00] - System start or rule file reload for testRules.
2022-10-09 08:21:45.163 [INFO ] [arthome.model.script.testRules.01.01] - set solar hybrid 1.: ON
2022-10-09 08:21:45.167 [INFO ] [.smarthome.model.script.Modbus.03.02] - set solar hybrid 1.: ON
2022-10-09 08:21:51.336 [INFO ] [arthome.model.script.testRules.01.01] - set solar hybrid 1.: OFF
2022-10-09 08:21:51.336 [INFO ] [.smarthome.model.script.Modbus.03.02] - set solar hybrid 1.: OFF

The last lines show that the original and test rules get triggered.
Here the test rule:

rule "Solar hybrid schedule 1 test"
	when
		Item spm_Solar_Hybrid_Control_1 changed
	then
		if (spm_Solar_Hybrid_Control_1.state == ON)
		{
            publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
		}
		else
		{
            publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,0")
		}

		logInfo(logPrefix + "01.01", "set solar hybrid 1.: {}", spm_Solar_Hybrid_Control_1.state)
end

openhab> bundle:list -s | grep -i mqtt
230 │ Active │ 80 │ 1.14.0 │ org.openhab.binding.mqtt
237 │ Active │ 80 │ 1.14.0 │ org.openhab.io.transport.mqtt
255 │ Active │ 80 │ 1.14.0 │ org.openhab.action.mqtt


Also, all rules are owned by openhab:

-rw-rw-rw-  1 openhab openhab  3773 May  7 17:22 astro.rules
-rw-rw-rw-  1 openhab openhab  8384 Jan 18  2022 bms_zeva.rules
-rw-rw-rw-  1 openhab openhab  5058 Jan 18  2022 fritzbox.rules
-rw-rw-rw-  1 openhab openhab 15342 Mar 30  2022 geoLocation.rules
-rw-rw-rw-  1 openhab openhab  2829 Apr 11 19:30 gps.rules
-rw-rw-rw-  1 openhab openhab  1872 Jan 18  2022 house.rules
-rw-rw-rw-  1 openhab openhab  7309 Apr 23 08:55 init.rules
-rw-rw-rw-  1 openhab openhab 32066 Jan  3  2022 irrigation1.rules
-rw-rw-rw-  1 openhab openhab 13487 Jan 18  2022 irrigation2.rules
-rw-rw-rw-  1 openhab openhab  3072 Jan 18  2022 maingate.rules
-rw-rw-rw-  1 openhab openhab  7723 Jan 18  2022 max01.rules
-rw-rw-rw-  1 openhab openhab  5054 Jan 18  2022 other.rules
-rw-rw-rw-  1 openhab openhab  4824 May  1 08:55 rf433tx.rules
-rw-rw-rw-  1 openhab openhab 11701 Sep 25 16:21 sensor433.rules
-rw-rw-rw-  1 openhab openhab  4606 Mar 26  2022 shed.rules
-rw-rw-rw-  1 openhab openhab 23955 Oct  9 07:52 sppro_bms.rules
-rw-rw-rw-  1 openhab openhab 11413 Oct  8 21:34 sppro_modbus.rules
-rw-rw-rw-  1 openhab openhab  2097 Jan 18  2022 tesla.rules
-rw-rw-rw-  1 openhab openhab   226 Jan 18  2022 test.rules
-rw-rw-rw-  1 openhab openhab 15251 Oct  9 07:02 watersystem.rules
-rw-rw-rw-  1 openhab openhab 31123 Oct  9 07:00 weather.rules

All publish rules work, except for those in the sppro_modbus.rules file.

astro.rules:            publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "32")
astro.rules:            publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "33")
astro.rules:            publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "33")
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Valve", "0000")
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Volume2", "99")
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Command", "resetMeter")
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Meter", "0")
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Valve", valveMessageOn)
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Valve", finalValveMessageOff)
irrigation1.rules:      publish("mymosquitto", mqttTopicRoot + "Flow" + valveNumber, valveFlow.toString)
irrigation1.rules:      publish("mymosquitto", mqttTopicRoot + "Volume" + valveNumber, valveVolume.toString)
irrigation1.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation1/Valve", "0000")
irrigation2.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation2/Command", "resetMeter")
irrigation2.rules:      publish("mymosquitto", "ArgyleCourt/Property/PumpStation2/Command", "resetMeter")
maingate.rules:         publish("mymosquitto", "ArgyleCourt/Shed/RC41/Relay2", "ON")
maingate.rules:         publish("mymosquitto", "ArgyleCourt/Shed/RC41/Relay2", "OFF")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "12")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "13")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "13")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "22")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "23")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "23")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "32")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "33")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "33")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "42")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "43")
rf433tx.rules:          publish("mymosquitto", "ArgyleCourt/Shed/RF433TX/Command", "43")
shed.rules:             publish("mymosquitto", "ArgyleCourt/Shed/Master/Blanket1/Command", BlanketMessage)
shed.rules:             publish("mymosquitto", "ArgyleCourt/Shed/Master/Blanket1/Command", "0")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8052,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8053,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8054,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8055,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", modbus_message)
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,0")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8052,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8052,0,0")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8053,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8053,0,0")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8054,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8054,0,0")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8055,0,1")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8055,0,0")
sppro_modbus.rules:     publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", modbus_message)
test.rules:             publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,1")
test.rules:             publish("mymosquitto", "ArgyleCourt/Shed/Modbus/Data/Command", "8051,0,0")

I thought the underscore in the file name could be a culprit, but the same rule in test.rules, publish does not execute either.

I had DEBUG and TRACE enabled, but no entry was recorded during executing the rule.

openhab> log:set DEBUG org.openhab.binding.mqtt
openhab> log:set TRACE org.openhab.binding.mqtt                                                                        
openhab> log:set INFO org.openhab.binding.mqtt                                                                        

I think we are at a dead end, which is usually addressed by “upgrade to OHv3”.

1 Like

The only thing I noticed as being odd: I get this error when saving the rule file:

2022-10-09 10:09:17.823 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.NullPointerException: null
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleContextHelper.getContext(RuleContextHelper.java:67) ~[?:?]
	at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl.lambda$2(RuleEngineImpl.java:311) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_181]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_181]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_181]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
2022-10-09 10:09:18.696 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sppro_modbus.rules'

However, there is some success… I removed the ON|OFF rule and augmented the item with sending ON|OFF.

Switch   spm_Solar_Hybrid_Control_1     "Solar Hybrid Control 1 [%s]"                               (gSpProModbus, gSolarHybridControl)     {mqtt="<[mymosquitto:ArgyleCourt/Shed/Modbus/Data/8051:state:MAP(onoff.map)],>[mymosquitto:ArgyleCourt/Shed/Modbus/Command:command:ON:8051,0,1],>[mymosquitto:ArgyleCourt/Shed/Modbus/Command:command:OFF:8051,0,0]"}

Which does issue the MQTT command:

10/09/22 10:16:28.546 ArgyleCourt/Shed/Modbus/Command 8051,0,1
10/09/22 10:17:26.049 ArgyleCourt/Shed/Modbus/Command 8051,0,0

I reckon I clean out the rule file and add one rule after the other…

[edit_1]
I give up… no luck either.
However, I changed my approach.
The item now has the ON|OFF command, and instead of using publish() in the rules, and where I need publish in the rules I use sendCommand() to the respective spm_Solar_Hybrid_Control_n item.

Thank you to all for having a crack at this :slight_smile:
[/edit_1]

1 Like