[SOLVED] Hue motion outdoor sensor + Zigbee2Mqtt How they work together?

Hi,
I get some problems to read the MQTT telegram from a Philips 9290019758 Hue motion outdoor sensor via zigbee2MQTT.
The Sensor is paired to the Connector.

databas.db

{“id”:2,“type”:“EndDevice”,“ieeeAddr”:“0x001788010646f86c”,“nwkAddr”:25305,“manufId”:4107,“manufName”:“Philips”,“powerSource”:“Battery”,“modelId”:“SML002”,“epList”:[2,1],“endpoints”:{“1”:{“profId”:49246,“epId”:1,“devId”:2128,“inClusterList”:[0],“outClusterList”:[0,3,4,6,8,768,5],“clusters”:{},“binds”:},“2”:{“profId”:260,“epId”:2,“devId”:263,“inClusterList”:[0,1,3,1030,1024,1026],“outClusterList”:[25],“clusters”:{“genBasic”:{“attributes”:{“modelId”:“SML002”,“manufacturerName”:“Philips”,“powerSource”:3,“zclVersion”:1,“appVersion”:2,“stackVersion”:1,“hwVersion”:1,“dateCode”:“20180828”,“swBuildId”:“6.1.0.25261”}}},“binds”:[{“cluster”:1,“type”:“endpoint”,“deviceIeeeAddress”:“0x00124b00014d7276”,“endpointID”:1},{“cluster”:1024,“type”:“endpoint”,“deviceIeeeAddress”:“0x00124b00014d7276”,“endpointID”:1},{“cluster”:1026,“type”:“endpoint”,“deviceIeeeAddress”:“0x00124b00014d7276”,“endpointID”:1},{“cluster”:1030,“type”:“endpoint”,“deviceIeeeAddress”:“0x00124b00014d7276”,“endpointID”:1}]}},“appVersion”:2,“stackVersion”:1,“hwVersion”:1,“dateCode”:“20180828”,“swBuildId”:“6.1.0.25261”,“zclVersion”:1,“interviewCompleted”:true,“meta”:{“configured”:1}}Preformatted text

Config,yaml :

homeassistant: false
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: ‘mqtt://localhost’
user: XXXX
password: XXXX
serial:
port: /dev/ttyACM0
devices:
‘0x001788010646f86c’:
friendly_name: pir_out_zig_1

but when i look at MQTT.fx there is noch motion detection if i walk, sit oder dance in front of the Sensor :sunglasses:
Is anybody here how get this Sensor to work?

Thanks
André

I didn’t see it listed as a working device on zigbee2mqtt page. Have you looked at how to support new devices? https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html


I think this seems to be supoortted

1 Like

Dang, how did I miss that?:grimacing:

Did you try doing a cartwheel in front of the sensor?:laughing:

Jokes aside, check that you’re using the correct topic in MQTT.fx. If MQTT.fx does not see the message then try opening an issue with zigbee2mqtt. Is this the only device your trying to use with zigbee2mqtt or you have others that are working? If this is the only device then you may need to verify zigbee2mqtt was installed correctly and your communicator is working with correct firmware installed.

1 Like

Oh I didn´t know that’s nessary to do this… I only walked like an egyptian… :rofl:

end of joke…

I read this in the log file in /zigbee2mqtt/data/log/

info 2019-12-23 14:00:43: Logging to console and directory: ‘/opt/zigbee2mqtt/data/log/2019-12-23.14-00-43’
info 2019-12-23 14:00:43: Starting zigbee2mqtt version 1.8.0 (commit #da4d26a)
info 2019-12-23 14:00:43: Starting zigbee-herdsman…
info 2019-12-23 14:00:45: zigbee-herdsman started
info 2019-12-23 14:00:45: Coordinator firmware version: ‘{“type”:“zStack12”,“meta”:{“transportrev”:2,“product”:0,“majorrel”:2,“minorrel”:6,“maintrel”:3,“revision”:20190608}}’
info 2019-12-23 14:00:45: Currently 1 devices are joined:
info 2019-12-23 14:00:45: pir_out_zig_1 (0x001788010646f86c): 9290019758 - Philips Hue motion outdoor sensor (EndDevice)
warn 2019-12-23 14:00:45: permit_join set to true in configuration.yaml.
warn 2019-12-23 14:00:45: Allowing new devices to join.
warn 2019-12-23 14:00:45: Set permit_join to false once you joined all devices.
info 2019-12-23 14:00:45: Zigbee: allowing new devices to join.
info 2019-12-23 14:00:45: Connecting to MQTT server at mqtt://localhost
info 2019-12-23 14:00:45: Connected to MQTT server
info 2019-12-23 14:00:45: MQTT publish: topic ‘zigbee2mqtt/bridge/state’, payload ‘online’

On this I think the Cordinator is running…

On Console

[17:53:48] openhabian@openhab:~$ systemctl status zigbee2mqtt.service
● zigbee2mqtt.service - zigbee2mqtt
Loaded: loaded (/etc/systemd/system/zigbee2mqtt.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2019-12-23 14:00:41 CET; 3h 55min ago
Main PID: 18917 (npm)
Tasks: 23 (limit: 2319)
Memory: 30.7M
CGroup: /system.slice/zigbee2mqtt.service
├─18917 npm
├─18931 sh -c node index.js
└─18932 node index.js

Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:warn 2019-12-23 14:00:45: permit_join set to true in configuration.yaml.
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:warn 2019-12-23 14:00:45: Allowing new devices to join.
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:warn 2019-12-23 14:00:45: Set permit_join to false once you joined all devices.
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 14:00:45: Zigbee: allowing new devices to join.
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 14:00:45: Connecting to MQTT server at mqtt://localhost
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 14:00:45: Connected to MQTT server
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 14:00:45: MQTT publish: topic ‘zigbee2mqtt/bridge/state’, payload ‘online’
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 14:00:45: MQTT publish: topic ‘zigbee2mqtt/pir_out_zig_1’, payload '{“battery”:100,"linkq
Dez 23 14:00:45 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 14:00:45: MQTT publish: topic ‘zigbee2mqtt/bridge/config’, payload '{“version”:“1.8.0”,"c
Dez 23 17:16:23 openhab npm[18917]: zigbee2mqtt:info 2019-12-23 17:16:23: MQTT publish: topic ‘zigbee2mqtt/bridge/log’, payload '{“type”:“devices”,"messa
lines 1-21/21 (END)

The Motion Sensor is my only zigbee device at the moment.
What is the right Topic? I Think this one

zigbee2mqtt/pir_out_zig_1/#

The # or it may be the * at the end is wildcard that should show everything. Try both with MQTT.fx and see what shows up.

This is what I have for one of my zigbee2mqtt devices.

Thing:

Thing topic zigbee2mqtt "Bedroom Light" @ "Bedroom" {
    Channels:
        Type switch : power  "Power"               [ stateTopic="zigbee/0xb0ce1814030ac279", transformationPattern="JSONPATH:$.state",
                                                    commandTopic="zigbee/0xb0ce1814030ac279/set", on="ON", off="OFF" ]
        Type dimmer : dimmer "Dimmer"              [ stateTopic="zigbee/0xb0ce1814030ac279",
                                                    commandTopic="zigbee/0xb0ce1814030ac279/set", transformationPattern="JSONPATH:$.brightness", formatBeforePublish="{\"brightness\":%s}" ]
    }

Item:

Switch BedroomLight "Bedroom Light"    <light> ["Lighting"]  { channel="mqtt:topic:pibroker:zigbee2mqtt:power", expire="120m,command=OFF" }
Dimmer BedroomLight_Level "Bedroom Light Level [%.0f %%]"    <light> ["Lighting"]  { channel="mqtt:topic:pibroker:zigbee2mqtt:dimmer" }

This device is using Esp_Easy but uses two switches, one is for motion.

Thing:

Thing topic Esp1 "Garage Light Level" @ "Garage" {
    Channels:
        Type number : level  "Light Level"          [ stateTopic="/Esp1/Garage/LightLevel" ]
        Type switch : contact  "Open Closed"        [ stateTopic="/Esp1/Door/Switch", transformationPattern="MAP:ONOFF.map" ]
        Type switch : motion  "Motion"              [ stateTopic="/Esp1/Motion/Switch", transformationPattern="MAP:ONOFF.map" ]
    }

Item:

```csv
Number Esp_Garage_Lightlevel "Garage Light Level [%d]"  <light>  { channel="mqtt:topic:pibroker:Esp1:level" } 
Switch ESP_Easy_Door "Garage Door"  <door>  { channel="mqtt:topic:pibroker:Esp1:contact" }
Switch Esp_Easy_Motion "Garage Motion"  <contact>  { channel="mqtt:topic:pibroker:Esp1:motion" }

And the transformation used for Esp device:

ONOFF.map
```csv
GPIO,13,1=ON
GPIO,13,0=OFF
1=ON
0=OFF

needs to be

friendly_name: 'pir_out_zig_1'

grafik

1 Like

Hello,
nice public holidays and much time to test… and now it works…

After some new teach in and removes the sensor from the conifg, mounting a new antenna and new pairing from different distances between the sensor and the stick…
tata… it work fine for me.
what ever, the problem has gone.

If anyone is interested in the rules, items and setup i will post them later…

Thanks

Here is my Setup / config for the

Thing:

Thing topic ZigBee2Mqtt_pir01 {
	Channels:
		Type number : battery    	"Batterie"       		 [ stateTopic="zigbee2mqtt/pir01", transformationPattern="JSONPATH:$.battery" ]
		Type number : linkquality   "Verbindungsstärke"      [ stateTopic="zigbee2mqtt/pir01", transformationPattern="JSONPATH:$.linkquality" ]
		Type string : last_seen    	"Letztes Update"         [ stateTopic="zigbee2mqtt/pir01", transformationPattern="JSONPATH:$.last_seen" ]
		Type string : occupancy    	"Bewegung"       		 [ stateTopic="zigbee2mqtt/pir01", transformationPattern="JS:true-false-json.js"]
		Type number : temperature   "Temperatur"   		     [ stateTopic="zigbee2mqtt/pir01", transformationPattern="JSONPATH:$.temperature" ]
		Type number : illuminance   "Lichtstärke"	         [ stateTopic="zigbee2mqtt/pir01", transformationPattern="JS:hue-illu.js" ]
	}

Item

Number Pir_bat		    "Batterie [%.0f %%]"	                { channel="mqtt:topic:<broker>:ZigBee2Mqtt_pir01:battery" }
Number Pir_link		    "Verbindungsstärke"	                    { channel="mqtt:topic:<broker>:ZigBee2Mqtt_pir01:linkquality" }
String Pir_update	    "Letztes Update"	                    { channel="mqtt:topic:<broker>:ZigBee2Mqtt_pir01:last_seen" }
String Pir_motion	    "Bewegung"                      	    { channel="mqtt:topic:<broker>:ZigBee2Mqtt_pir01:occupancy" }
Number Pir_temp		    "Temperatur [%.2f °C]"	                { channel="mqtt:topic:<broker>:ZigBee2Mqtt_pir01:temperature" }
Number Pir_illumi	    "Lichtstärke [%.0f lx] "	            { channel="mqtt:topic:<broker>:ZigBee2Mqtt_pir01:illuminance" }

js to covert the Illuminance to lux :

(function(jsonString) {
    var data = JSON.parse(jsonString);
    var illueOut = data.illuminance;
    illueOut = (illueOut-1)/10000;
    illueOut = Math.pow(10,illueOut);
    return illueOut;
    }) (input)

js to convert the true/false of .occupancy in ON/OFF

(function(jsonString) {
    var data = JSON.parse(jsonString);
    var pirState = data.occupancy;
    if (pirState == true) {
        pirState = 'ON';
    } else {
        pirState = 'OFF';
    }
    return pirState;
    }) (input)

at last the rule wich switch shelly device:

var Timer PirMotionTimer = null

rule "Bewegungsmelder1"
when
	Item Pir_motion changed from OFF to ON
then
	if(PirMotionTimer !== null){
        PirMotionTimer.reschedule(now.plusSeconds(60))
		logInfo("RULE", "PIR --> Aussenlicht Reschedule + 60sec")
    	}
		
	if(shelly_sw_1.state == OFF && NightState.state == ON){
		if(PirMotionTimer === null){
			sendCommand(shelly_sw_1, ON)
			logInfo("RULE", "PIR --> Aussenlicht ON")
			PirMotionTimer = createTimer(now.plusMinutes(3)) [|
			sendCommand(shelly_sw_1, OFF)
			logInfo("RULE", "PIR --> Aussenlicht OFF")
			PirMotionTimer = null
		]}
	}

	 
end

Hope that help if somebody else have problems with the Sensor

1 Like

Please click the square box on solution post to mark the topic solved.

Thanks