[Breaking Change] Change HCSR501 MQTT key to 'presence' (#710)
* Change HCSR501 MQTT key to 'presence'
This commit is contained in:
3 files changed
+4
-4
No files matched your search
@@ -71,7 +71,7 @@ binary_sensor:
|
|||||||
name: "Bewegung_Schlafzimmer"
|
name: "Bewegung_Schlafzimmer"
|
||||||
#device_class: motion
|
#device_class: motion
|
||||||
state_topic: "home/OpenMQTTGateway1/HCSR501toMQTT"
|
state_topic: "home/OpenMQTTGateway1/HCSR501toMQTT"
|
||||||
value_template: '{{ value_json["hcsr501"] }}'
|
value_template: '{{ value_json["presence"] }}'
|
||||||
payload_on: "true"
|
payload_on: "true"
|
||||||
payload_off: "false"
|
payload_off: "false"
|
||||||
```
|
```
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ If you don't want to resend values that haven't changed you can set DS1820_ALWAY
|
|||||||
### HCSR501
|
### 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.
|
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
|
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.
|
This can be useful if you would like to connect an LED to turn on when motion is detected.
|
||||||
|
|||||||
@@ -52,13 +52,13 @@ void MeasureHCSR501() {
|
|||||||
if (PresenceValue == HIGH) {
|
if (PresenceValue == HIGH) {
|
||||||
if (pirState == LOW) {
|
if (pirState == LOW) {
|
||||||
//turned on
|
//turned on
|
||||||
HCSR501data.set("hcsr501", "true");
|
HCSR501data.set("presence", "true");
|
||||||
pirState = HIGH;
|
pirState = HIGH;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pirState == HIGH) {
|
if (pirState == HIGH) {
|
||||||
// turned off
|
// turned off
|
||||||
HCSR501data.set("hcsr501", "false");
|
HCSR501data.set("presence", "false");
|
||||||
pirState = LOW;
|
pirState = LOW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user