Connecting to IKEA PIR through ZigBee2MQTT

Hello Guys,

I am running OH2.5.5 on Rpi3B and connecting some zigbee devices through Zigbee2MQTT.

Currently I purchased a IKEA E PIR sensor but having problem reading the value of occupancy from json.

I can read both Link Quality and Battery.

Published MQTT :

{"battery":87,"linkquality":99,"occupancy":true,"update":{"state":"idle"},"update_available":false}

Things:

// IKEA PIR 01
Thing mqtt:topic:MQTT_IKEA_PIR_01 "MQTT IKEA PIR 01" (mqtt:broker:66b21258) @ "NAPPALI"  {
  Channels:
    Type number : LinkQuality     "Link Quality [%d %%]"  [ stateTopic="zigbee2mqtt/IKEA_PIR_01", transformationPattern="JSONPATH:$.linkquality" ]
    Type string : Battery         "Battery  [%d %%]"      [ stateTopic="zigbee2mqtt/IKEA_PIR_01", transformationPattern="JSONPATH:$.battery" ]
    Type switch : Occupancy      "Occupancy"             [ stateTopic="zigbee2mqtt/IKEA_PIR_01", transformationPattern="JSONPATH:$.occupancy" ]

Items:

Number    MQTT_IKEAPIR01_LinkQuality   "Link quality [%d %%]"   {channel="mqtt:topic:MQTT_IKEA_PIR_01:LinkQuality"}
String    MQTT_IKEAPIR01_Battery       "Battery [%d %%]"        {channel="mqtt:topic:MQTT_IKEA_PIR_01:Battery"}
Switch   MQTT_IKEAPIR01_Occupancy "Occupancy" {channel="mqtt:topic:MQTT_IKEA_PIR_01:Occupancy"}

I tried several mappings in the chanel definition but none of them was working.

Thanks fo your help

Which ones did you try?

on=true, off=false

would be my guess with the info provided.

Is this a copy/paste error? Otherwise your Item syntax is malformed.

Yes I tried on=true, off=false or on="true", off="false", on=1, off=0, etc

It was a copy/paste error :frowning:

There’s a chance you might be hitting the Things file bug - small changes might not have registered with openHAB. One workaround is to restart openHAB, but I do this.

Have you paired this PIR with another Tradfri product, like a light bulb?

1 Like

When I do like this
Type switch : Occupancy "Occupancy" [ stateTopic="zigbee2mqtt/IKEA_PIR_01", transformationPattern="JSONPATH:$.occupancy", on=true, off=false ] got an error in the OH log file: 2021-04-17 20:35:14.261 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'true' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.true

Yes i paired it with a bulb before started playing… But I reset it as written here: https://www.zigbee2mqtt.io/devices/E1743.html#ikea-e1743

AFter retart on="true", off="false" was working. Whish find the way…
Thanks