From 61f7843e40f9cf1f97594169c9688f5c19455539 Mon Sep 17 00:00:00 2001 From: Jon Date: Sun, 26 Jul 2020 22:14:06 +0900 Subject: [PATCH] [Breaking Change] Change HCSR501 MQTT key to 'presence' (#710) * Change HCSR501 MQTT key to 'presence' --- docs/integrate/home_assistant.md | 2 +- docs/use/sensors.md | 2 +- main/ZsensorHCSR501.ino | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/integrate/home_assistant.md b/docs/integrate/home_assistant.md index 420d357..a68bdfa 100644 --- a/docs/integrate/home_assistant.md +++ b/docs/integrate/home_assistant.md @@ -71,7 +71,7 @@ binary_sensor: name: "Bewegung_Schlafzimmer" #device_class: motion state_topic: "home/OpenMQTTGateway1/HCSR501toMQTT" - value_template: '{{ value_json["hcsr501"] }}' + value_template: '{{ value_json["presence"] }}' payload_on: "true" payload_off: "false" ``` diff --git a/docs/use/sensors.md b/docs/use/sensors.md index 68a01f5..09ddab1 100644 --- a/docs/use/sensors.md +++ b/docs/use/sensors.md @@ -47,7 +47,7 @@ If you don't want to resend values that haven't changed you can set DS1820_ALWAY ### HCSR501 A boolean value of the PIR sensors state is sent when a state change occurs. The length of time that the PIR stays in a triggered state depends on the PIR hardware and is not changed by OpenMQTTGateway. -`home/OpenMQTTGateway/HCSR501toMQTT {"hcsr501":"false"}` +`home/OpenMQTTGateway/HCSR501toMQTT {"presence":"false"}` You can have another PIN mirror the value of the PIR sensor output by adding the following to config_HCSR501.h This can be useful if you would like to connect an LED to turn on when motion is detected. diff --git a/main/ZsensorHCSR501.ino b/main/ZsensorHCSR501.ino index 4416e69..c7381ae 100644 --- a/main/ZsensorHCSR501.ino +++ b/main/ZsensorHCSR501.ino @@ -52,13 +52,13 @@ void MeasureHCSR501() { if (PresenceValue == HIGH) { if (pirState == LOW) { //turned on - HCSR501data.set("hcsr501", "true"); + HCSR501data.set("presence", "true"); pirState = HIGH; } } else { if (pirState == HIGH) { // turned off - HCSR501data.set("hcsr501", "false"); + HCSR501data.set("presence", "false"); pirState = LOW; } }