Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaomi Mijia (HonneyWell) smoke detector #152

Closed
rtenklooster opened this issue Aug 30, 2017 · 117 comments
Closed

Xiaomi Mijia (HonneyWell) smoke detector #152

rtenklooster opened this issue Aug 30, 2017 · 117 comments

Comments

@rtenklooster
Copy link

rtenklooster commented Aug 30, 2017

Hi,
Just received my RaspBee today and started playing around.
I've upgraded to the latest beta in order to get my xiaomi switches and motion detectors running.

My smoke detectors are able to connect en they show up like this:
rookmelder

With debugging enabled this event comes by when pushing the test button.
20:39:01:991 APS-DATA.indication srcAddr: 0x00158d00014d315c, dstAddrMode: 2, profile: 0x0104, cluster: 0x0500, lqi: 199, rssi: -66 20:39:02:218 APS-DATA.request id: 13, addrmode: 0x02, addr: 0x0000, profile: 0x0000, cluster: 0x0031, ep: 0x00 queue: 0 len: 2 20:39:02:292 APS-DATA.confirm id: 13, status: 0x00 SUCCESS
And:
20:39:05:011 APS-DATA.indication srcAddr: 0x00158d00014d315c, dstAddrMode: 2, profile: 0x0104, cluster: 0x0500, lqi: 199, rssi: -66 20:39:05:100 APS-DATA.request id: 40, addrmode: 0x02, addr: 0x16c2, profile: 0x0000, cluster: 0x0031, ep: 0x00 queue: 0 len: 2 20:39:05:189 APS-DATA.confirm id: 40, status: 0x00 SUCCESS
What should I do next to get my smoke detector supported?

@manup
Copy link
Member

manup commented Aug 30, 2017

The cluster 0x0500 indicated that this sensor is a IAS Zone, I figure therefore it's easy to support it. However question is how should the sensor be represented by the API?

Either ZHAPresence or better ZHAOpenClose or maybe a new type like ZHAAlarm?

@rtenklooster
Copy link
Author

ZHAAlarm seems the most appropriate type. There is a Gas sensor as well, and a water leakage sensor. They all could use the ZHAAlarm type I think.

@snozzlebert
Copy link

Presence of smoke/gas/water, so ZHAPresence?

@ebaauw
Copy link
Collaborator

ebaauw commented Aug 30, 2017

However question is how should the sensor be represented by the API?

Tough one. I'm not too thrilled at the prospect of supporting another half a dozen of ZHA sensor types (and corresponding CLIP sensors). On the other hand, I would want a hint through the API what kind of sensor this is. So at least, I'd want different state attributes for presence of people, smoke, gas, water. My suggestion: if there's different ZigBee device types (not that Xiaomi would care for these), use different sensor resource types; if they're all just an IAS Zone device, use a single sensor resource type.

@rtenklooster
Copy link
Author

Do you guys know if, once this detector is supported, it would be possible to control the siren from deconz?

Thought it would be really cool to use my 8 smoke detectors as sirens for my alarm... ;) (when not at home of course.. else I would scare the shit out of me in the middle of the night...)

@ebaauw
Copy link
Collaborator

ebaauw commented Sep 1, 2017

else I would scare the shit out of me in the middle of the night

LOL. We could implement a state.scaringtheshitoutofme attribute for that.

On a more serious note, does it implement cluster IAS WD (0x0502) or provide another means to turn on (and, hopefully, off) the siren over ZigBee?

@rtenklooster
Copy link
Author

rtenklooster commented Sep 2, 2017

does it implement cluster IAS WD (0x0502) or provide another means to turn on (and, hopefully, off) the siren over ZigBee?

It might be my lack of knowledge regarding Deconz, but I don't see any endpoints besides 01.
smoke

I hope those endpoints will show up when the detector is being supported? Or else; how can I do some more testing / debugging?

Using the MI gateway you are able to enable and reset the alarm. This should mean using Deconz it should be theoretically possible to do this as well.

Those sensors also allow testing / identifying. You can send a command witch makes the smoke detector test itself sounds a short beep, and reports it's status.

Furthermore they report their battery status.

@ebaauw I suddenly realized the Xiaomi Switches and Motion sensors are not reporting their battery levels. I know they report the battery state. How can we solve this?

@ebaauw
Copy link
Collaborator

ebaauw commented Sep 2, 2017

I hope those endpoints will show up when the detector is being supported? Or else; how can I do some more testing / debugging?

An endpoint is like a logical device. Is has an ID (0x01) a profile (in this example ZHA or Home Automation) and a device type (0xffff).
An endpoint might provide multiple clusters. A cluster has a direction indicated by the colour (blue for in or server clusters; grey for out or client clusters), and a type (0x0000 for the Basic) cluster.
A server cluster maintains state attributes, which might be read and/or written from clients, or reported to clients, and it accepts commands. (Note: this is not the correct ZigBee terminology, but it helps me in understanding). The Cluster Info panel in the deCONZ GUI shows the standard commands and attributes for known clusters (this is actually configurable in the ZCLDB file, by default /usr/share/deCONZ/zcl/general.xml).

The problem with battery-operated nodes is that they sleep most of the time, causing queries from the gateway to discover their endpoints and clusters to fail. It would seem that this sensor hasn't been fully read by deCONZ, as only the Basic cluster is shown. You might want to try and open the network and press the test button (hoping this will wakeup the smoke sensor). For a motion sensor, you would wave, for a switch, you would press a button, for door sensors, you would move the magnet. If this doesn't result in more clusters being discovered, try deleting the node (select it and press DEL) and repairing it (while pressing the test button to keep it awake throughout the discovery).

Furthermore they report their battery status.

This is typically done thought the Power Configuration cluster 0x0001. Then again, nothing about the Xiaomi sensors is standard.

I suddenly realized the Xiaomi Switches and Motion sensors are not reporting their battery levels.

That's because we haven't found any evidence of the sensors reporting their battery level. We have seen some non-standard messages that we haven't figured out yet (see #138 (comment)).

I know they report the battery state. How can we solve this?

Unless Xiaomi have open-sourced their gateway: Sniff the ZigBee communication between the Mi gateway and the sensors, reverse engineer the Mi gateway behaviour, and implement something similar in deCONZ.

@rtenklooster
Copy link
Author

@ebaauw Thanks for your explanation.
I have found some guy who appears to have reverse engineered some Xiaomi sensors.
For example the Xiaomi Motion sensor:

fingerprint profileId: "0104", deviceId: "0104", inClusters: "0000, 0003, FFFF, 0019", outClusters: "0000, 0004, 0003, 0006, 0008, 0005, 0019", manufacturer: "LUMI", model: "lumi.sensor_motion", deviceJoinName: "Xiaomi Motion"

This line shows the used (in and out? ) clusters, is this the needed info? His code seems well documented, so proberly some info could be used. I don't know exactly where to add the clusters for this sensor in the XML file though.

https://github.com/a4refillpad/Xiaomi/blob/master/devicetypes/a4refillpad/xiaomi-motion-sensor.src/xiaomi-motion-sensor.groovy

@ebaauw
Copy link
Collaborator

ebaauw commented Sep 2, 2017

This line shows the used (in and out? ) clusters, is this the needed info? His code seems well documented, so proberly some info could be used.

This would be the needed info, but it doesn't look like any of the Xiaomi devices I've seen. My guess would be he copied these from another sensor. Or he has a very different (hardware/firmware) version.

Looking at the code it looks like he extracts the battery value from the 0x0000 message indeed.

I don't know exactly where to add the clusters for this sensor in the XML file though.

Most are in there already. The XML file is used to build the Cluster Info panel; any clusters missing from the XML file will display in the GUI as unknown. As far as I know, if the clusters don't show in the GUI, the device doesn't have them and there's no way in deCONZ to add them (with the exception of correcting incomplete reads during pairing).

@rtenklooster
Copy link
Author

Unless Xiaomi have open-sourced their gateway: Sniff the ZigBee communication between the Mi gateway and the sensors, reverse engineer the Mi gateway behaviour, and implement something similar in deCONZ.

Ok. that's what I did.
foto

I sacrificed one of my Xiaomi push buttons and flashed it into a packet sniffer. I sniffed the transport key so I'm able to sniff and see all packages :)

I've tested my push button:
push

Pretty nice I think!

@manup
Copy link
Member

manup commented Sep 3, 2017

Nice, which sniffer is that?

@rtenklooster
Copy link
Author

The hardware is a Xiaomi push button ( All Xiaomi devices have onboard ftdi pads)
Inspired by this guy:
http://faire-ca-soi-meme.fr/hack/2017/04/24/hack-xiaomi-mi-smarthome-decouverte-de-clef/

Ubiqua: https://www.ubilogix.com/
1000 Packages per capture free for 21 days.
Allows on the fly decoding and gives a pretty good inside view I think.

Now lets checkout the smoke detector in order to get them supported :)

@manup
Copy link
Member

manup commented Sep 3, 2017

Looks really good :)

If possible capture as many use cases and setup traffic as possible and safe the log files, maybe Wireshark can open them as well.

@rtenklooster
Copy link
Author

Yes, I can export to PCAP? (somethink like that, I believed Wireshark uses that format

@ebaauw
Copy link
Collaborator

ebaauw commented Sep 3, 2017

Cool! What did you use to flash the button? And where did you get sniffer firmware? I take it the round black board is the late button? And the green board? Is a regular USB to serial converter or something more?

@rtenklooster
Copy link
Author

Ok, What I did:

  • Started Capturing.
  • Joined the smoke detector to gateway
  • Set the sensitivity to "Place with no smoke"
  • Set the sensitivity to "Place with little smoke"
  • Set the sensitivity to "Place with smoke"
  • Set the sensitivity to "Place with no smoke"
  • Pressed the test button (alarm sounds + Mi home app gives push message)
  • Pressed the test button again
  • Pulled the battery
  • Placed the battery

smoke

The image above shows the package capture ID from when I did the tests.
I exported the capute to native ubiqua format, to wireshark and new wireshark.

Xiaomi Mijia Honeywell smoke detector.zip

I tested to import the capture. The downsite of opening those in wireshark is, the data is encrypted. So I guess the best thing would be if I'd shared the capture, and my decription key so you could view them in Ubiqua?

For example the test using the button gives this info:
alarm
I think you developers could not wish for more information do you?

@ebaauw
Copy link
Collaborator

ebaauw commented Sep 3, 2017

Inspired by this guy

Unfortunately the Excel file he captured his sniffing conclusion in doesn't show us anything new. No battery info ;-(

@rtenklooster
Copy link
Author

Cool! What did you use to flash the button? And where did you get sniffer firmware? I take it the round black board is the late button? And the green board? Is a regular USB to serial converter or something more?

The black board is the inside of the push button.
I soldered wires onto the FTDI header.
I connected those wires to my serial -> FTDI converter
Pulled down D0 in order to get the Xiaomi Push button into programming mode.
Flashed NXP sniffer sketch (JennickSniffer) included in the NXP sdk.
Started capturing

His Excel sheet is pretty useless indeed.
I will connect one of my motion sensors now and see what info comes around.

@rtenklooster
Copy link
Author

It's up to you guys to let me know how the data should be delivered.
Exporting the raw data could be done.
Exporting only relevant frames with some explanation is possible like:
After adding the motion sensor, the sensor sends this announcement:
https://pastebin.com/VSTh1dab
Or just screenshots or something like that.

For your info, I currently have:

  • Xiaomi Mijia Smoke detector
  • Xiaomi smart socket
  • Xiaomi push butten gen. 1
  • Xiaomi potion sensor gen. 1
  • Xiaomi Mijia door / windows sensor (ordered, will arrive soon)

For those devices I can supply extensive debugging if wanted.

@manup
Copy link
Member

manup commented Sep 3, 2017

Unfortunately the Excel file he captured his sniffing conclusion in doesn't show us anything new. No battery info ;-(

I think the battery info is in the 0xff01 report send to basic cluster after an hour or so. I see this for the door/window contact sensor.

It's up to you guys to let me know how the data should be delivered.
Exporting the raw data could be done.
Exporting only relevant frames with some explanation is possible like:
After adding the motion sensor, the sensor sends this announcement:
https://pastebin.com/VSTh1dab
Or just screenshots or something like that.

The most interesting frames are the APS layer ones, like ZCL reports and commands which the gateway sends to the devices.

For your info, I currently have:

Xiaomi Mijia Smoke detector
Xiaomi smart socket
Xiaomi push butten gen. 1
Xiaomi potion sensor gen. 1
Xiaomi Mijia door / windows sensor (ordered, will arrive soon)
For those devices I can supply extensive debugging if wanted.

Xiaomi push butten gen. 1 and Xiaomi Mijia door / windows sensor are already supported.

@rtenklooster
Copy link
Author

About the round switch.
Yes, it's supported. However I did fount the following. It appears to be reporting double / triple / quad clicks. See this attached picture:
button_events

@rtenklooster
Copy link
Author

Ok. to get back on topic. I've sampled frames of all events I am aware off.
I've documented them and pasted them on pastebin.
I hope this information will provide enough information to get the smoke sensors supported :-) That's the aim of this issue.

https://pastebin.com/59rUTJKv

@ebaauw
Copy link
Collaborator

ebaauw commented Sep 3, 2017

About the round switch.

Cool. I only have the Aqara switch (round button, square-ish outside), which doesn't send Press, only Release. I'll double-check on the 0x8000 attribute. Is it also on cluster 0x0006 (see APS header)? And a Report Attributes command (see ZCL header)? And is the Manufacturer Specific flag set? If so which Manufacturer Code is used?

@rtenklooster
Copy link
Author

Ok cool, found the battery reporting as well. Will open a new issue regarding this push button.

@rtenklooster
Copy link
Author

@lajo-osd
Copy link

lajo-osd commented Oct 9, 2017

I just got this smoke detector today. Does it work with deCONZ in any way right now?
Also, what do I need to press on the detector to pair it? :)

@rtenklooster
Copy link
Author

To pair you should open the network and push the button three times.

And no, the smoke detectors are not supported yet. The smart plugs and round buttons multiple press events and battery data haven’t been added yet.

@valentingc
Copy link

@RezzZ yes, but I think setting the sensitivity of a smoke detector is a essential thing - especially since both the original gateway and zigbee2mqtt support this setting.
There would also be a the self-test that can be triggered - but this may not be as important as the sensitivity.

@allanpersson
Copy link

@RezzZ this smokesensor allows to set how sensitive they are when used with xiaomi gateway/app. Fx in the kitchen you can trigger different than livingroom 🙏

Also they should be in the GUI

@andriej
Copy link

andriej commented Mar 30, 2020

@RezzZ if you would kindly take a look at the issue posts above... there's everything, dump of sniffed options, options themselves - this sensor has more than just dumb 'on/off' state and you can't manage it after joining to zigbee deconz network.

@Ageo
Copy link

Ageo commented May 16, 2020

Appear in Jeedom not into Phoscon App.

@Ageo
Copy link

Ageo commented May 25, 2020

Suggestion for developers: Could you add the Honeywell smoke detector as a light for example? Like the Ikea USB extender. For the moment, I'm not able to delete the smoke detector thought the App.

@andriej
Copy link

andriej commented May 25, 2020

You can use it via API, i.e. in HA.

@Mimiix Mimiix closed this as completed Jun 5, 2020
@andriej
Copy link

andriej commented Jun 5, 2020

I don't want to sound rude, but how come issue has just been closed without any comment?

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 5, 2020

I made a mistake here. Miss clicked on alt tabbing. Sorry!

@Mimiix Mimiix reopened this Jun 5, 2020
@baneb5
Copy link

baneb5 commented Jun 15, 2020

Please add an option to set sensitivity and controll the siren like zigbee2mqtt did. Thanks!

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 15, 2020

@baneb5 I could give it a look, but can't promise anything. Please raise a seperate issue for that so we can flag appropriately and track. We're mixing a bit too much here. Thanks!

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 15, 2020

@baneb5 Is this something you want in phoscon? Then please open a issue in that repository: https://github.com/dresden-elektronik/phoscon-app-beta

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 15, 2020

@Mimiix That probably needs to be taken care of from here. Lemme check it first.

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 15, 2020

@baneb5 please raise a seperate issue for your request as per @Mimiix 's suggestions.
@andriej please do the same. We can move it to phoscon beta repo if required.

Guys, please note that we require infomation from your end as this isn't working out otherwise!

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 15, 2020

I really want to know what the issues are.

@sveip
Copy link

sveip commented Jun 15, 2020

I dont have one, but the missing features are setting the sensitivity of the detector, and also starting the siren (I think this is some sort of test mode)

Here is some info on how it behaves in z1mqtt:
https://github.com/foz333/Xiaomi/blob/master/devicetypes/bspranger/xiaomi-mijia-honeywell-fire-detector.src/xiaomi-mijia-honeywell-fire-detector.groovy
https://github.com/Koenkk/zigbee2mqtt.io/blob/develop/docs/devices/JTYJ-GD-01LM_BW.md#sensitivity

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 15, 2020

@sveip Is this a request for Phoscon or Deconz? Either way , open a feature request for this in its appropriate place.

I want to close this issue as nobody really knows in what is up with this nomore 😂

@sveip
Copy link

sveip commented Jun 15, 2020 via email

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 15, 2020

Your not rude :) Don't worry i'll be fine.

A issue since 2017 with over 108 comments is really hard to track for me whats needed 😄

@SwoopX Can you provide a list of screens what we need?

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 15, 2020

The one like at the beginning. Should show more clusters now.

@baneb5
Copy link

baneb5 commented Jun 15, 2020

I apologize if I did something wrong, but I've red whole thread, and whole thread is about the issue that I have, which is that we can not controll xiaomi smoke detector the way zigbee2mqtt can (not to mention original xiaomi gateway). It seemed logical to me to bump this thread instead of making new one, because all tecnical info is already here..

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 15, 2020

@baneb5 all good and valid. Just go ahead and raise a seperate issue for that so we have that one clear for us. No big deal.

Btw, the ability to test the sensor is already given via REST API it I read the links correctly. However, exactly the required technical details are missing since the very first screenshot depicts an incomplete join.

@alahdal
Copy link

alahdal commented Jun 16, 2020

It is interesting to find this topic active this much again.

@SwoopX , How can I test the sensor via REST API? I could not find a way.

If I understood the request right, we also need to trigger the siren via REST API. For example, if the sensor in ROOM A is triggered, I want to trigger other sensors as well. Any ways, please let us have the link of the new thread to track the progress.

Thank you for the support.

@tsat-psv
Copy link

tsat-psv commented Jun 16, 2020

@rtenklooster, do you still have that gear to sniff the packets? Would it be possible for you to connect one of the smoke detectors to the official Xiaomi Home Gateway, and issue a "set sensitivity" from it? And maybe also a "test siren" (terms taken out of my head, so might not match their UI.) If there are any other commands available from the Hub/app, please also those.

@SwoopX
Copy link
Collaborator

SwoopX commented Jun 16, 2020

Guys, please. Can you just do what I've asked for? It's just 2 things: a seperate issue for each request, 1-2 screenshots and some debug output. No real need to sniff the traffic although that would be brilliant.

Once I have that info, it's just a matter of 5 mins as far as I can tell. Closing this one now.

@Mimiix
Copy link
Collaborator

Mimiix commented Jun 16, 2020

As per request of @SwoopX I'll close this issue.

@Mimiix Mimiix closed this as completed Jun 16, 2020
@werner2000x
Copy link

werner2000x commented Nov 13, 2023

Can i use iobroker to read the smoke detektor with the conbee III ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests