Write a rule that turns on an item when a temporary item is received

  • Platform information:
    • Hardware: amd64 / 4 cores / 8G RAM
    • OS: Manjaro
    • Java Runtime Environment: Oracle 11.0.18
    • openHAB version: 3.4.2
  • Issue of the topic:

Hello,

I have a button here that posts temporary actions via mqtt like “simple”, “double” and “long” for associated tap behavior on the device.
This is mapped as a Thing and a Channel properly in openhab and I can see this in the log:

10:04:49.664 [INFO ] [openhab.event.ChannelTriggeredEvent  ] - mqtt:homeassistant_zigbee2mqtt_5F0x00124b00253bab2a:6b3d5af049:zigbee2mqtt_5F0x00124b00253bab2a:0x00124b00253bab2a_5Faction_5Fzigbee2mqtt#sensor triggered single
10:04:49.673 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action' received command single
10:04:49.676 [INFO ] [openhab.event.ChannelTriggeredEvent  ] - mqtt:homeassistant_zigbee2mqtt_5F0x00124b00253bab2a:6b3d5af049:zigbee2mqtt_5F0x00124b00253bab2a:0x00124b00253bab2a_5Faction_5Fzigbee2mqtt#sensor triggered
10:04:49.679 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action' predicted to become single
10:04:49.685 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action' received command
10:04:49.687 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action' changed from  to single
10:04:49.688 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action' predicted to become
10:04:49.691 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action' changed from single to

So the “simple” action command is received, immediately replaced by an empty action command because the state is temporary.
I’m trying to write a rule in MainUI that turns ON a switch item when the “simple” command is received, and here is the generated code so far:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action
      command: simple
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: VMC_5_Minutes
      command: ON
    type: core.ItemCommandAction

Unfortunately, I’m not seeing the rule being triggered in the log, and the switch item is not turned on.
I have also tried with the following trigger:

  - id: "1"
    configuration:
      itemName: Bouton_VMC__eWeLink_WB01_zigbee2mqtt_Bouton_VMC__eWeLink_WB01_action
      state: simple
    type: core.ItemStateChangeTrigger

But it does not send the “ON” command either.

What have I missed here?

Is the command simple or single ? Typo?

I’m stupid, you are indeed right, I must use the word single and then the rule triggers.
I don’t know how I came to misread that one…

Sorry for the noise

Hey sometimes it takes a second set of eyes!

I am just in awe of how long your item names are :smiley:

I’m not typing them, it’s the mqtt homeassistant discovery binding that creates them for me.