BRUH DIY Multisensor


I had missed a " delay(100); " from the //PIR CODE but it uploaded and compiled ok…

I also edited *** SENSOR DEFINITIONS *** to

int pirValue1;
int pirStatus1;
String motionStatus1;

int pirValue2;
int pirStatus2;
String motionStatus2;

then changed the //PIRCODE to the below to property differentiate between the two PIRs…

   //PIR1 CODE
    pirValue1 = digitalRead(PIR1PIN); //read state of the

    if (pirValue1 == LOW && pirStatus1 != 1) {
      motionStatus1 = "standby";
      pirStatus1 = 1;

    else if (pirValue1 == HIGH && pirStatus1 != 2) {
      motionStatus1 = "motion detected";
      pirStatus1 = 2;


    //PIR2 CODE
    pirValue2 = digitalRead(PIR2PIN); //read state of the

    if (pirValue2 == LOW && pirStatus2 != 1) {
      motionStatus2 = "standby";
      pirStatus2 = 1;

    else if (pirValue2 == HIGH && pirStatus2 != 2) {
      motionStatus2 = "motion detected";
      pirStatus2 = 2;


Doesn’t seem to work though, only the PIR1 Motion 1 seems is working, PIR2 doesn’t change state at all. I’ve double checked all the config.yaml and all looks good… if I remove all the numbers from the //PIR code to keep them at pirValue/pirStatus then both sensors in HASS just keep continually cycling between standby and motion detected.

I think I’ll look into ESPEasy - this is giving me a headache!! Thanks for the help though!


@Sthope Think I finally got it working… changed the defined pins to 5 and 6 rather than 4 and 5 and it seems to be working now… Is there something special about PIN 4 that would stop it working?


Hello @boxgrove, glad you got it working. For debugging you can use the Arduino IDE console from there you can see if the message is being published by the ESP or if it is a yaml configuration fault.
I don’t know why PIN 4 isn’t working, the only problem I had was when I connected multiple sensors especially 5v and powered the ESP thought the PC some sensors wouldn’t work or they wouldn’t work properly


I have put this multisensor in homebridge (homekit) to use with Siri. The PIR Motion Sensor never show up in the homekit. Is there anyone use homekit and can add in all the 6 multisensor?


you need this:

  - platform: mqtt
    state_topic: "bruh/sensornode1"
    name: "Kitchen motion sensor"
    payload_on: 'motion detected'
    payload_off: 'standby'
    value_template: '{{ value_json.motion }}'
    device_class: motion

The only problem that I have is that I’m not getting “motion” notifications in homekit no matter if I enable them.

I would appreciate any help…


Thank you so much. I will try this evening. First I want to be able to see this motion sensor in homebridge first.

The rest 5 sensors work fine and display everything correctly. Only motion sensor never be seen by homebridge.


yeah, its because you’re missing device_class: motion


Another question from what I remember. I have put Mr.Bruh sensor as a sensor not binary_sensor, Do I have to change to binary_sensor as well or just create one more or just add the device_class in the sensor I already have?


just remove your regular sensor and change it to binary_sensor, then add device_class…


Thank you very much Mr.badstraw


Ok I got it working…!! I just had to reset HA a couple of times.

Anyone got it working with the bme680 air quality sensor?


I got every sensor work except the motion sensor from Mr.Bruh, I will try as you have mentioned this evening. Other motion sensors also avaiable in homebridge but not the motion sensor from Mr.Bruh.


Asking again about Mr.Bruh multisensor. After adding the pir sensor as binary_sensor

In front end show the state as clear (when no motion) all the time. entity_id show off all them time.


Make sure you have it connected to the correct PIN that you defined in your sketch.


Correct pin as earlier I use as sensor, show on frontend corretly with correct state standby or motion_detected.

I would like to get this motion sensor into homebridge, so the recommend on above posted told me to change from sensor to binary_sensor which show on frontend. The result show on frontend is “clear” / from entity id show result "off"
Even though I have wave my hand to let motion detect, nothing happen, no result change at all. Only state “clear”


It’s possible the PIR is defective then.


i use this but my sensor will no turn off do you have another automation to turn it off ??

  - platform: mqtt
    state_topic: "bruh/sensornode1"
    name: "Kitchen motion sensor"
    payload_on: 'motion detected'
    payload_off: 'standby'
    value_template: '{{ value_json.motion }}'
    device_class: motion


That’s not an automation, it’s just how you set it up for HomeKit. I suggest you to check your configuration for another piece of code that might be causing issues.


This automation works great!


I have try exactly like what you post. On frontend show clear and nothing change.
But the entity id of binary_sensor.kitchen_motion_sensor show off. There is no turn on/off