I don’t fully understand your post.
To my knowledge, the Trådfri 5-button remote does not report its button presses to openHAB through the Trådfri binding. Nor does any of the other Trådfri sensors (dimmers, motion sensors). Only state changes for actuators (lamps, control outlets, blinds) are reported.
Hence, the only way to create a rule in openHAB is to detect whether a controllable thing changed. In practice, that means a light bulb, a control outlet or a blind.
For Trådfri lights, there are 2 or 3 channels that will be reported, which you can use in your rules:
- on/off (ON or OFF state)
- dimmer value (percentage between 0 and 100)
- color spectrum or color temperature (also percentage between 0 and 100)
For Trådfri control outlets, there is only one channel:
I don’t know the Trådfri blinds since I don’t have them at home. I expect there will be dimmer value channel (position as percentage value), a battery level channel and low battery channel.
For instance, the kitchen cabinet lights are dimmable but have a fixed color temperature. They are defined as follows (replace gwa0b1c2d3e4f5
with the ThingUID from your Trådfri gateway):
// Warm-white, dimmable
Switch Kitchen_Light_Toggle "Kitchen countertop" <light> (gHome_GF_Kitchen, gLight) ["Lighting", "Switchable"] {
channel="tradfri:0100:gwa0b1c2d3e4f5:65560:brightness"
}
Dimmer Kitchen_Light_Dimmer "Kitchen countertop [%d %%]" <light> (gHome_GF_Kitchen, gDimmer) ["Lighting", "Switchable"] {
channel="tradfri:0100:gwa0b1c2d3e4f5:65560:brightness"
}
In your rules, you could then check things like:
// Rules DSL:
rule "Kitchen Cabinet Light goes ON"
when Item Kitchen_Light_Toggle changed to ON
then
// Rule code here
end
or:
# JSR223 Jython:
@rule("Kitchen Cabinet Light goes ON")
@when("Item Kitchen_Light_Toggle changed to ON")
def Rule_KitchenCabinetLightGoesOn(event):
# Rule code here