Skip to content
This repository has been archived by the owner on Dec 8, 2019. It is now read-only.

PIR Enhancements #42

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bruh_mqtt_multisensor_github/bruh_mqtt_multisensor_github.ino
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ const int bluePin = D3;



/**************************** SENSOR CONFIGURATION *****************************************/
#define PIR_ON_STRING "motion detected"
#define PIR_OFF_STRING "standby"



/**************************** SENSOR DEFINITIONS *******************************************/
float ldrValue;
int LDR;
Expand Down Expand Up @@ -453,13 +459,13 @@ void loop() {
pirValue = digitalRead(PIRPIN); //read state of the

if (pirValue == LOW && pirStatus != 1) {
motionStatus = "standby";
motionStatus = PIR_OFF_STRING;
sendState();
pirStatus = 1;
}

else if (pirValue == HIGH && pirStatus != 2) {
motionStatus = "motion detected";
motionStatus = PIR_ON_STRING;
sendState();
pirStatus = 2;
}
Expand Down
15 changes: 10 additions & 5 deletions example_home_assistant_configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ sensor:
unit_of_measurement: "LUX"
value_template: '{{ value_json.ldr }}'

- platform: mqtt
state_topic: "bruh/sensornode1"
name: "SN1 PIR"
value_template: '{{ value_json.motion }}'

- platform: mqtt
state_topic: "bruh/sensornode1"
name: "SN1 Temperature"
Expand All @@ -50,6 +45,16 @@ sensor:
value_template: '{{ value_json.heatIndex | round(1) }}'


binary_sensor:
- platform: mqtt
state_topic: "bruh/sensornode1"
name: "SN1 PIR"
value_template: '{{ value_json.motion }}'
payload_on: "motion_detected"
payload_off: "standby"
device_class: motion


group:
sensor_node_1_card:
name: Sensor Node 1
Expand Down