Rule - Problem (update/command)

Hi,
i’m with OH2.3 build1225 and suffering a rule that does not exactly what i want…

I have an MQTT publisher that sends a string with information about the person opening the front door…
via MQTT it seems that an update results in a “change” as the event log shows the following log:

2018-03-11 11:21:23.950 [vent.ItemStateChangedEvent] - LockLog changed from Outside locked. to Evi fprint2
2018-03-11 15:35:48.131 [vent.ItemStateChangedEvent] - LockLog changed from Evi fprint2 to Outside locked.
2018-03-11 16:45:28.084 [vent.ItemStateChangedEvent] - LockLog changed from Outside locked. to NJ RFID
2018-03-11 16:45:34.312 [vent.ItemStateChangedEvent] - LockLog changed from NJ RFID to Outside locked.

The rule looks as follows:

rule "SmartLOCK - Timestamp"
    when
        Item LockLog received command
    then
        postUpdate(MyLockStamp, new DateTimeType())
        if ((LockLog.state=="Evi RFID") || (LockLog.state=="Evi fprint2")) { playSound("evihome2.mp3") }
        if ((LockLog.state=="Frog RFID") || (LockLog.state=="NJ RFID") || (LockLog.state=="NJ fprint")) { playSound("njhome2.mp3") }
    end

I’ve tried received command/received update…but the rule only shoots in case i send a http command directly via browser:
http://192.168.1.11:8080/classicui/CMD?LockLog=Evi fprint2

Any idea why it does not work with MQTT? the result is that depending on who comes home a different tone is played in the living room.

Cheers, Norbert

The MQTT binding {broker:topic:state:default} will send an update to the item NOT a command
As a rule of thumb use command to send out orders to physical devices

Add logInfo to you rules to help debug.
In your case, the rule may have executed but not the ifs statements

Add the toString() to the state comparisons because you are comparing a string

This should work, I hope…

rule "SmartLOCK - Timestamp"
    when
        Item LockLog received update
    then
        logInfo("TEST","Rule Smartlocl Timestamp")
        postUpdate(MyLockStamp, new DateTimeType())
        if ((LockLog.state.toString == "Evi RFID") || (LockLog.state.toString == "Evi fprint2")) { playSound("evihome2.mp3") }
        if ((LockLog.state.toString == "Frog RFID") || (LockLog.state.toString == "NJ RFID") || (LockLog.state=="NJ fprint")) { playSound("njhome2.mp3") }
    end