Having trouble toggling a switch with a zigbee device

Hello,

I’ve been working on this for a while but I can’t get my Ikea Styrbar E2002 zigbee device to toggle a light.

I am running an esphome switch and can control its power channel by linking it to an item. Switching this item on and off in the openhab interface does in fact toggle this light.

However, I also want to toggle this light with a zigbee remote. Linking this item to the aforementioned item and pressing the button changes its status in Openhab but doesn’t actually toggle the light. It’s very strange as toggling this button in the Openhab interface still does toggle the light!

Can anybody help me with this?

I would suggest linking the styrbar to its own item, and then create a rule to trigger when the styrbar receives a button action, you can then toggle / activate the esphome switch item accordingly.

Thank you, that worked.

For future readers: I added a rule with the GUI:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: styrbar
      previousState: ""
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: bedlight.sendCommand(styrbar.state.toString)
    type: script.ScriptAction


You could send a command to the item without using an inline script. It would be more efficient, although what you have right now is perfectly fine too, since rules far more complex would still be fine.