DIY Projects

Xiaomi Mijia Honeywell Smoke Detector Test with Domoticz, Emergency Notification with PushOver

In the previous article, we saw how to easily integrate Xiaomi Aqara accessories under Domoticz with Node-RED using the Zigbee sniffer of Zigbee2MQTT projects. I propose to finish this series of article with the test of smoke detector Xiaomi Mijia Honeywell. We will go a step further and send a notification to our smartphone if the sensor detects smoke.

 

Before I begin, I want to remind you that for the moment this sensor is only intended for the Chinese domestic market. You can buy it and install it at home, but under no circumstances can this smoke detector be used as the main fire alarm system. It will be able to complement a CE approved equipment.

Unpacking the Xiaomi Mijia Honeywell smoke detector

The Xiaomi Mijia Honeywell Smoke Detector (JTYJ-GD-01LM / BW) is a small white detector. It measures 90mm in diameter and 35mm high. It is fixed with a mounting plate with 2 screws or a sticker (delivered in the box).

The detector operates using a single 3V CR123 lithium battery not supplied.

View all offers

 

Intercept Zigbee messages using Zigbee2mqtt

The inclusion button is in front. This is the monthly self-test button of the sensor. Start the gateway script

cd / opt / zigbee2mqtt
npm start

Wait until you get the Zigbee message: allowing new devices to join then click once on the auto test button. If there is a problem, press repeatedly if the detector goes to sleep before the end of the inclusion.

Rename the smoke detector name (without accent or spaces) by editing the configuration file.

nano /opt/zigbee2mqtt/data/configuration.yaml

Inclusion of the smoke detector with Domoticz using the Zigbee2mqtt sniffer

The Zigbee2mqtt project intercepts Zigbee frames sent by Mijia or Aqara detectors to the official gateway. The gateway is no longer needed to drive or retrieve measurements and reports from home automation accessories. If you discover the project Zigbee2mqtt, here are the previous articles that I advise you to read also

Under Domoticz, start by creating a new virtual device of the switch type. Write down his IDX.

Then go to the switch page and edit the accessory you just created. In the list, choose Smoke Detector.

Transfer MQTT messages to Domoticz using Node-RED

On NodeRED, paste and then modify the following flow to connect to the Topic that returns the status of the smoke detector.

[{"id":"c15799c1.71f028","type":"mqtt out","z":"8cb500b2.1fda4","name":"","topic":"domoticz/in","qos":"2","retain":"","broker":"72f9bb18.b361b4","x":830,"y":120,"wires":[]},{"id":"b2612bab.9418a8","type":"mqtt in","z":"8cb500b2.1fda4","name":"Xiaomi Honeywell smoke sensor","topic":"zigbee2mqtt/XiaomiMijiaHoneywell","qos":"2","broker":"8687cf12.76eee","x":270,"y":100,"wires":[["de200346.f79ea"]]},{"id":"de200346.f79ea","type":"json","z":"8cb500b2.1fda4","name":"","property":"payload","action":"","pretty":false,"x":470,"y":100,"wires":[["43837e4f.8516a"]]},{"id":"43837e4f.8516a","type":"function","z":"8cb500b2.1fda4","name":"Split","func":"msg1={};\n\nif ( msg.payload.smoke ) {\n msg1.payload = {\n \"command\" : \"switchlight\",\n \"idx\" : 6,\n \"switchcmd\" : 'Off'\n }\n} else {\n msg1.payload = {\n \"command\" : \"switchlight\",\n \"idx\" : 6,\n \"switchcmd\" : 'On'\n }\n}\n\nreturn [msg1];","outputs":1,"noerr":0,"x":650,"y":100,"wires":[["c15799c1.71f028","b0b78663.38b198"]],"inputLabels":["json"],"outputLabels":["Etat"]},{"id":"b0b78663.38b198","type":"debug","z":"8cb500b2.1fda4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":830,"y":80,"wires":[]},{"id":"72f9bb18.b361b4","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"8687cf12.76eee","type":"mqtt-broker","z":"","name":"MQTT Local","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Change the function code by specifying the IDX of the Domoticz accessory

msg1={};

if ( msg.payload.smoke ) {
msg1.payload = {
"command" : "switchlight",
"idx" : 6,
"switchcmd" : 'Off'
}
} else {
msg1.payload = {
"command" : "switchlight",
"idx" : 6,
"switchcmd" : 'On'
}
}

return [msg1];

Deploy the flow and click the self-test button. After a few seconds, the detector signals a fire alarm on Domoticz. It’s integrated!

Receive a notification on an iOS or Android smartphone using PushOver in case of alarm

Once integrated into Domoticz, it is very easy to receive an alert on your smartphone as soon as the detector reports smoke. Domoticz provides a very large number of connectors to notification services. I propose to test PushOver. PushOver is a paid application (only once after a free trial period) but it is very reliable and easy to configure.

PushOver has several advantages. First, the notifications are encrypted which helps to ensure the confidentiality of your exchanges. Then PushOver knows how to recognize urgent notifications and adapts its behavior accordingly. It is possible to choose a different sound for emergency notifications and especially PushOver repeats the notification until the user validates the reading. It’s ideal for a fire alarm, PushOver will harass you until you get the notification.

Open a PushOver account and retrieve the USER KEY

Go to the PushOver site and create a free account by clicking Signup. The site is only available in English but the questions remain classic (email, username …)

Install the mobile app and add the device

Install the app for iOS or Android  and connect them with the IDs of your PushOver account. The application immediately asks for the name to be assigned to the device. Give a name and click Add Device.

Return to the PushOver site and refresh the page. After a few seconds, you should see your smartphone or tablet in Your Devices list

Create an application and recover the API key

In order to send notifications from Domoticz, we will need an authentication key to access the PushOver API. At the bottom of the page, click Create an Application / Token API

Creating an application is super simple. Just enter a name of up to 20 characters. As you can see, PushOver allows sending 7500 free messages per month which is already huge.

Finish creating the application by clicking Create Application. back on the main page, click on the name of the application to get the token (Token)

Configuring PushOver on Domoticz

Everything is ready to configure PushOver Domoticz. Open the Domoticz Control Panel and go to the Notification tab and configure like this:

Click Test to verify that everything is working properly

 

 

Set up notification when smoke is detected

All that’s left to do is set up a notification when the Xiaomi Mijia Honeywell Detector detects smoke. Open the switch tab and click on Notification

Select Switch On to trigger notification when smoke is detected by the sensor. To have the PushOver repeat the notification until it has been acknowledged, choose the Urgent priority. This avoids having to go through a Lua script on the Domoticz side. Check also Ignore Interval to send the notification immediately.

By default Domoticz builds the PushOver message by taking the name of the sensor and adding its state which gives here for example

To customize the message, just indicate the desired message in the message field (optional), and that’s what it gives now

Since it is a message with an urgent priority level, it will be repeated until the user acknowledges the notification. Tap the notification to open PushOver and click Acknowledge Notification.

 

 

Voilà, even when you’re not at home, you can easily receive notifications on your iOS or Android smartphone. The method works with all home automation accessories built into Domoticz.

 

 

 

Click to rate this post!
[Total: 0 Average: 0]
Exit mobile version