Xiaomi Switch in Openhab3: Rule or Profile?

Dear community,

I am moving from Openhab2 to Openhab3 and I am wondering what the preferred way in version 3 is to receive and act on the events of a Mijia & Aqara Wireless Switch

The switch exposes a channel called “button event”. In Openhab2 it was required to create a rule which acts on different trigger modes of the button (short press, double press, long press). See this snipped from the documentation of the Xiaomi Binding:

rule "Mijia & Aqara Wireless Switch"
when
    Channel "mihome:sensor_switch:<GwID>:<ID>:button" triggered
then
    var actionName = receivedEvent.getEvent()
    switch(actionName) {
        case "SHORT_PRESSED": {
            <ACTION>
        }

After reading the documentation I suspect that for exactly this purpose in OH3 “profiles” are to be used?
But somehow I am not able to create such a profile.
I can create an Item and Link this to the button channel of the switch.
When I open the Item and click on the button-event channel I see the link between Item and Channel (Button Event). Furthermore I see a profile section, with a link to the documentation. But I see no profiles available or the possibility to enter a profile. Instead I just see a message “loading” which does not terminate. See attached screenshot.

I am running a clean out of the box installation of openhabian.

Can anyone point me into the right direction?

Not necessarily. A Profile is a way to intercept and change an event coming from a Channel and modifying it in some way before it gets to the Item. Profiles only exist on the Link between a Channel and an Item.

Here you have an Event Channel. There is no Link and therefore no where to apply the Profile. Furthermore, you want to do more than just change the event from “SHORT_PRESSED” to something else, you want to do some <ACTION>.

So a rule really is the only thing to use here.

That doesn’t address why you are seeing the problem showing the profiles in MainUI. I suspect it might have to do with the fact that it’s an Event Channel and Event Channels cannot be linked to Items.

Thank you Rich for the clarification. I’ll go with rules then.

To be fair, there are special-purpose profiles to link event channels to Item states. I’ve never seen the use of that.

Related (interestingly enough, complains that profiles are offered)