One Thing - Two Items, One of which with Expire

Platform information:

  • Hardware: Raspberry Pi 4
  • OS: openhabian
  • openHAB version: 3.3
  • Key bindings: KNX, MQTT

I have a lighting circuit on a KNX standard switching module bound into openhab via the KNX binding to a a banale swith Thing, like so:

  - id: BDL1
    channelTypeUID: knx:switch
    label: 💡⊡ Central Light 💻
    configuration:
      ga: 1/2/11+<1/2/111

(1/2/11 is the sending, and 1/2/111 in the acknowledging KNX Group Address).

I would like to control this light from the (KNX Wall switch - done!), and the openhab MainUI through an Item (easy :wink: ). In addition I would like to switch the Thing ON via a (zigbee2mqtt linked Presence sensor) and switch it OFF after a fixed period of time.

I thought to realize that through 2 separate Items, like so:

  Switch OfficeDirk_Light_Central "Suspension" <suspension> (OfficeDirk_Lights) ["Switch","Light"]
    {channel="knx:device:_:__L:BDL1"}
  Switch OfficeDirk_Light_CentralAuto "Suspension Auto" <suspension> (OfficeDirk_Lights) ["Switch","Light"]
    {channel="knx:device:_:__L:BDL1", expire="15s,command=OFF"}

However, that doesn’t work as desired. The first OfficeDirk_Light_Central *Item* also triggers the expire timer. I suspect that’s because the acknowledgment Group Address 1/2/111 changes the state of the second OfficeDirk_Light_CentralAuto *Item* and hence starts the expire timer on that Item.

Any hint for a working setup, where the same thing can be manually switched through one item, while at the same time be motion-switched on and than timer-switched out?

as you have the 2nd item on the same knx channel, they are always hard linked.
via knx itself, in your current setup you do not know, if it was triggered via wallswitch or the zigbee2mqtt presence, right?

so that sounds really like something like rules for myself…

or: [Deprecated] Design Pattern: Motion Sensor Timer
or: Design Pattern: Proxy Item

here would be some DSL rule code:

var Timer waittimer = null
rule "disable central light by motion after time"
when
    Item zigbee2mqttpresencesensor received update (or changed from OFF to ON)
then
   OfficeDirk_Light_Central .postUpdate(ON)
   if(waittimer === null) {
        waittimer = createTimer(now.plusSeconds(15), [|
            // send alert
            OfficeDirk_Light_Central .postUpdate(OFF)
            waittimer = null // rest the timer variable so we know the timer is no longer running
        ])
    }
    // else if(zigbee2mqttpresencesensor == OFF){
    //     waittimer?.cancel // cancel the timer if it is running
    //     waittimer = null
    // }
end
1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.