[SOLVED] MQTT : Same command message in event log every 30 seconds

I have two Shelly 2 switches in OpenHAB. I can send command on/off and the switches respond accordingly.
However, I noticed something in the events log which I want to see differently.
When a switch is turned on and it stays on after that (so no more interaction), the events log shows each 30 seconds a message “Item received command ON” and another one for “Item predicted to become ON”. Obviously, both messages should only be shown once at the time of activation of the switch.

The MQTT setup in OpenHAB2 is using MQTT binding 2.4.0 and embedded MQTT broker.

The Shelly switch configuration for MQTT is
clean session : False
Retain : False
Max. QoS : 0
Min. reconnection timeout : 2
Max. reconnection timeout : 60
Keep alive : 60
Will message : False

Is this a matter of changing something in the configuration or is the MQTT binding designed as such (or is it a bug ?)

Thanks !

This one is a consequence of openHAB’s autoupdate feature. Whenever you send a command to an Item, autoupdate makes its best guess at what the result might be and updates that Items state.
If you don’t want that, you can add autoupdate=“false” in the bindings area { } of your Item definition. Where you get reliable updates from a real device, it often is not wanted.

For the command message, are you requesting an incoming status update to be translated to a command?

1 Like

@rossko57 Thanks.
I don’t mind the “predicted” message.
The issue is that it seems like OpenHAB is receiving the command every 30 seconds. While in reality, the command is only triggered once manually.

The flags “retained” and “Is command” in the channel are set to True.

Making the assumption that you don’t have any rules firing off commands periodically (which would be usual cause of this kind of message)

I’m guessing the binding is doing what it is told. When a periodic update comes in from the Shelly, the binding makes it into a command.

This is not the usual requirement in openHAB. The convention is that commands originate from UI or rules, and get passed via bindings to devices. Status updates from devices are treated as, well, state updates for Items.

This looks relevant

There is a toggle that is turned off by default that tells a Channel how to treat incoming messages.