Monthly Archives: November 2019

Hive Motion Sensor and OpenHab2

Recently I’ve started adding ZigBee based devices to my home automation solution – specifically I’ve added the Husbzb-1 stick to my setup. This has the benefit of combining both a Z-Wave and Zigbee controller in the same physical device, so I get to be agnostic as to the devices I add.

My next step was to try out a Hive Motion Sensor, for no other reason then there was one in the local store and a quick Google showed that it was Zigbee based.

This device is interesting in terms of form factor – suits what I was planning quite well, and the channels it provides;

  • Motion Intrusion (_intrusion) – Switch
  • Temperature (_temperature) – Number:Temperature
  • Tamper (_tamper) – Switch
  • Motion Presence (_motion) – Switch
  • Low Battery (_iaslowbattery) – Switch
  • Battery Voltage (_batteryvoltage) – Number
  • Illuminance (_illuminance) – Number

So I actually ended up with more then I expected since neither the illuminance nor the temperature are referenced in any documentation that I can find. I’ve no clue what the difference between Motion Intrusion and Motion Presence are though – both seem to trigger at the same time… will update when I learn more.

The other interesting thing is that on the very first trigger, the state is updated from NULL to ON for presence (_intrusion and _motion), but the sensor itself never seems to trigger a state change to OFF. In order to handle this, I’ve defined an item, subscribed to the _motion channel, and then a rule to reset it back to off after 5 mins.

var Timer vFrontDoor_holdDown  = null

rule "Reset Front Door trigger"
when
    Item FrontDoorMotion changed to ON
then
    if(vFrontDoor_holdDown === null || vFrontDoor_holdDown.hasTerminated){
        vFrontDoor_holdDown = createTimer(now.plusMinutes(5), [| 
            postUpdate(FrontDoorMotion, OFF)
            vFrontDoor_holdDown = null
        ])
    }
    else{
        vFrontDoor_holdDown.reschedule(now.plusMinutes(5)) 
    }
end