TUTORIAL: ESP8266 Motion Sensor for HomeKit

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • ** Make sure you have HAP-NodeJS installed on your Pi and have the Arduino IDE set up for ESP on your computer. **
    REQUIRED - HAP-NodeJS installation: • TUTORIAL: HAP-NodeJS (...
    REQUIRED - Install Arduino IDE for ESP8266: • TUTORIAL: Setup ESP826...
    Start HAP-NodeJS automatically: goo.gl/sQmZeu
    My GitHub: goo.gl/qkWJwx
    PARTS NEEDED:
    ESP8266 (USA): amzn.to/2yy9n3P
    ESP8266 (Intl): geni.us/kHJW
    PIR Sensor (USA): amzn.to/2yy2dg0
    PIR Sensor (Intl): geni.us/DDaeL8
    Any Raspberry Pi running Debian Stretch works, recommended starter kit below:
    Raspberry Pi 3+ kit (USA): amzn.to/2LshSUV (20% discount: JGCNZGP8)
    Raspberry Pi 3+ kit (Intl): geni.us/38hMRf
    **Support QuickPi by using this as your Amazon Bookmark**
    ** USA: amzn.to/2y6Ghr8 **
    ** INTL: geni.us/1Y7inkJ **

ความคิดเห็น • 103

  • @Philipp1887HSV
    @Philipp1887HSV 6 ปีที่แล้ว +3

    Hey @QuickPi . A video about an integration of a non-addressable RGB Strip in HomeKit would be awesome :)

  • @jameshughes8481
    @jameshughes8481 4 ปีที่แล้ว

    Is there a way to determine is an Arduino client/accessory is even engaging with homebridge properly. My client is failing to connect (MQTT), let alone send/receive. Homebridge is running well and I have other non-Apple accessories working with their respective plug-ins just fine. Low level, raw homebridge logs?

  • @muhammadyousufbilal7836
    @muhammadyousufbilal7836 7 ปีที่แล้ว +7

    Can you make a video on controlling a light using esp8266 and a relay using mqtt and homebridge or openhab?

    • @firatbey9828
      @firatbey9828 5 ปีที่แล้ว

      Just use this one,, works like a charm : github.com/Tommrodrigues/homebridge-nodemcu-relay

  • @slymick
    @slymick 7 ปีที่แล้ว +1

    I've only just completed almost the same project for myself, I had an issue with the PIR 5v and the 3.3v esp, I ended up not using the 5v pin and instead wired 3.3v esp to the PIR 'H' pin, has worked perfectly for a few weeks now.

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +Mick Sly awesome!

    • @slymick
      @slymick 7 ปีที่แล้ว +1

      I should also say that your tuts especially on Homekit/ESP/Sonoff/Rpi are among the easiest to follow and have gotten me well on the way to having a much smarter house!
      My next tasks are to create a ESP door lock and automatic blinds, because of the mix of code and custom hardware I think a tut would be difficult to create, as a thought what would be great to watch is something that details how the _accessory.js file interacts with both Homekit and MQTT (when I created mine I really stumbled through it) and replacing specfic strings can change the type of device shown in HomeKit. if that make sense?

  • @evoluman
    @evoluman 6 ปีที่แล้ว +1

    how can you add a second esp8266 with another PIR?

  • @TipsTricksMore
    @TipsTricksMore 7 ปีที่แล้ว +1

    Hi QuickPi,
    I always watch your videos and ordered a few esp`s now. But how do I implement more than one sketch on the esp? For example: I would like to run an dht11 and an Pir on the same esp? Is that possible?
    Best regards
    Leo

    • @martinjacobsen7323
      @martinjacobsen7323 7 ปีที่แล้ว

      YES!
      Please do a video on how to do this with a DS18b20 or something like it!

  • @MrJose9270
    @MrJose9270 5 ปีที่แล้ว

    HI, Great tutorial. Mu esp8266ex does nnot show the right mesages in the serial monitor. Even though the firmware seems to work, all I can see are strange characters in the monitor. Nothing that can be read.

  • @wesleyrosa9144
    @wesleyrosa9144 6 ปีที่แล้ว

    I did it, everything went well. Now I have a question, is there a setup in homekit to make the lamp stay on for 10 minutes after detecting a move? The way it is is not functional because the light goes on and off.

  • @mistrykm4u
    @mistrykm4u 7 ปีที่แล้ว

    Great Work!!!
    But my question is...
    this Automation manage in only iOS11?
    I think iOS10 not able to manage this type automation for motion sensor

  • @harrybalm1738
    @harrybalm1738 6 ปีที่แล้ว

    Great tutorial as usual could the pir sensor be replaced with a mq-2 smoke sensor to make a smoke detector using this setup.

  • @marciohogenelst
    @marciohogenelst 4 ปีที่แล้ว

    Hello, very good. Please, do you have information how can I connect the raspberry with the WF121 ? maybe one forum could help me very much, thank and have a nice day

  • @adityakumar-rw2cx
    @adityakumar-rw2cx 7 ปีที่แล้ว

    Can i connect multiple esp8266 devices and find out which sensor got triggered? I tried with one sensors and works alright. But i need to have this for 3 or more. Please guide me

  • @vincentsaint-loup307
    @vincentsaint-loup307 4 ปีที่แล้ว

    Great video, thank you!! When I sudo node BridgedCore.js I successful get the «HAP-NodeJS starting...», although I never have the line that says «Parsing accessory:», what did I do wrong?

  • @andriiburka9118
    @andriiburka9118 7 ปีที่แล้ว

    Hi QuickPi, i also want to add this to my Tasmota Sonoff ESP. Is it possible?

  • @MrJose9270
    @MrJose9270 5 ปีที่แล้ว

    Hi, my sesor gets trigered with no motion, it seems to me that every time it review MQTT connection it send a + message

  • @MrCBRXX1100
    @MrCBRXX1100 6 ปีที่แล้ว

    What should I add, if I have MQTT server password and username enabled? I think on the Arduino sketch.

  • @marcogreco3070
    @marcogreco3070 7 ปีที่แล้ว

    Can you explain the proces with a atom
    Tank
    I hope that you answer
    I Want to ask you a tutorial to integrate a Wall switch whit homekit
    Thank you very mutch

  • @undercovergeek384
    @undercovergeek384 6 ปีที่แล้ว +1

    Has anyone had success with this using a WEMOS D1 Mini? I've tried it using 5v, 3.3v different pins and every time it only works for 3-5mins then stops working. Any help would be appreciated!

    • @harrybalm1738
      @harrybalm1738 5 ปีที่แล้ว

      Hi did you ever find a solution I seem to be getting the same problem.

  • @davidvanicek3123
    @davidvanicek3123 7 ปีที่แล้ว

    Hello, I have already done your LIght tutorial and it's working great, thx! But today I have set up motion sensor and I have only iPhone and Mac so I cannot use Automation option in my HomeKit app. Do you know how enable this option without buying iPad or Apple TV? Setting up on Raspberry or something? THX

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +tedy no unfortunately not, you need an iPad or Apple TV for the automations to work. You could create a python script that monitors the motion sensor’s MQTT messages and automates the lights by running the python script

  • @jranjan4685
    @jranjan4685 6 ปีที่แล้ว

    how to control led strip with esp8266 and homekit

  • @wesleyrosa9144
    @wesleyrosa9144 6 ปีที่แล้ว +1

    More videos, pleaaaaaase!!!!!!!!!!!!!

  • @kleberzeitounian
    @kleberzeitounian 6 ปีที่แล้ว

    Preciso de ajuda como crio outros arquivos de acessórios, e como integro outros sensores,.

  • @tomermatmon
    @tomermatmon 7 ปีที่แล้ว

    Can you make a video and explain about the security pros and cons of make these HomeKit devices yourself?
    I would like to try it, but I have concerns over the security of my iCloud and home network. Thanks 🙏

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +Tomer Matmon these HomeKit devices are just like regular HomeKit devices. They bind their pairing to one device. They are isolated to your home network and your iCloud. I use all onboard programs and services in my videos to avoid cloud reliability. It’s pretty secure as HomeKit also uses a lot of encryption. iCloud doesn’t get affected at all from a security standpoint due to the fact Apple isolates these devices from the rest of your account. They are limited in terms of permissions on your iPhone/iPad/iCloud account. You should be safe using these and they are unhackable unless your home network itself is insecure.

    • @tomermatmon
      @tomermatmon 7 ปีที่แล้ว

      Thanks for explaining this! could you do a video on AC (on/off, timer and temperature management) and electric boiler (on/off and timers) HomeKit devices?

  • @wesleyrosa9144
    @wesleyrosa9144 7 ปีที่แล้ว

    GPIO5 = D1 port on nodemcu?

  • @vijaydembla
    @vijaydembla 7 ปีที่แล้ว

    Another great video from you, Could you please advise if we can add more modules like door sensor to esp8266 and add accessory in the accessory folder?

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +vijaydembla yes you can add anything you want to the accessories folder

    • @vijaydembla
      @vijaydembla 7 ปีที่แล้ว

      QuickPi could you please share the esp8266 scripts for multiple modules. Thanks

  • @babyface3105
    @babyface3105 7 ปีที่แล้ว

    Thanks again for all of your tutorials,
    Is it in your plans a door sensor ESP8622 or Fire Sensor ?
    Cordially

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +Face Baby yes I am planning one

    • @babyface1240
      @babyface1240 7 ปีที่แล้ว

      QuickPi Thanks

  • @fieberification
    @fieberification 7 ปีที่แล้ว +1

    Great tutorial thanks !

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +fieberification no problem

  • @Skyler9604
    @Skyler9604 6 ปีที่แล้ว

    How do you wire the esp8266 into the arduinio so that you can actually upload the code from your computer?

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Esp8266 is a type of arduino

  • @vijaydembla
    @vijaydembla 6 ปีที่แล้ว

    Hi Quickpi, Most of the things in my home are now set up after following your videos. You have done an amazing job and i would love to see more from you.
    I followed this one, however the motion sensor is following a pattern of on and off regardless of any motion. Is it something i did wrong?
    I would request you to look for adding more modules to one Esp like door sensor, motion sensor and relay switch etc.
    Thanks again

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Which PIR sensor are you using? Some PIR sensors do this if they do not have a proper 5V input

    • @vijaydembla
      @vijaydembla 6 ปีที่แล้ว

      Hi quickpi, Thanks for your quick response, i'll double check the power input, but the model is same as shown in your video, i ordered exactly those when i wanted those.
      Also, any idea about adding multiple modules to single ESP, does it work?

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      It technically should. However, it’ll be hard to detect with PIR sensor is triggered if you connect multiple sensors to the same ESP

  • @Maxmudjon
    @Maxmudjon 7 ปีที่แล้ว +1

    good job

  • @jayare7750
    @jayare7750 5 ปีที่แล้ว

    Do all ESPs need a Raspberry Pi (or equivalent) running homebridge in order to connect to Homekit?

    • @QuickPie
      @QuickPie  5 ปีที่แล้ว +1

      One raspberry pi is enough for all the ESPs

    • @jayare7750
      @jayare7750 5 ปีที่แล้ว

      @@QuickPie I saw a video where the Homekit API is running natively on an ESP-01 without the need for a homebridge. watch?v=b5VU_UWzeNI
      Actually, it was just posted a few days ago. Not a very entertaining video, but I was able to get it to work on my ESP-01.

    • @QuickPie
      @QuickPie  5 ปีที่แล้ว +1

      Am working on a video regarding this

  • @fernandoschnaidt210
    @fernandoschnaidt210 6 ปีที่แล้ว

    Hi, after config, you must leave the RPi or just use the wifi and the PIR module?

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Both devices need to be active in order for the system to work.

  • @fulviopulimanti8333
    @fulviopulimanti8333 6 ปีที่แล้ว

    Hi, I was thinking if it were possible to connect a HC-SR501 directly on a sonoff using a tasmota firmware. Great Job man, my home is now a futuristic one. Regards

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Yes it is possible, but will have to look into the code

    • @fulviopulimanti8333
      @fulviopulimanti8333 6 ปีที่แล้ว

      Sounds good, let me know if you need help or others suggestions. Thank you man for your beautiful work!

  • @RoboTerm
    @RoboTerm 5 ปีที่แล้ว

    How can I add a second ESP to the MQTT broker?

    • @QuickPie
      @QuickPie  5 ปีที่แล้ว

      Change the name of the device. You can add as many devises as you want

  • @wesleyrosa9144
    @wesleyrosa9144 6 ปีที่แล้ว

    Is it possible to do using the same sonoff that has the tasmota?

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      I am working on this. On the list

  • @quinnmiller1997
    @quinnmiller1997 7 ปีที่แล้ว +1

    I'm getting a Attempting MQTT connection...failed, rc=-2 try again in 5 seconds error, have any idea why this is going on? Have fresh installed HAP-NodeJS from your other video, and this fresh as well

    • @anuragvasanwala
      @anuragvasanwala 7 ปีที่แล้ว +1

      Same with me. Unable to find any solution.

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว +2

      +Anurag Vasanwala check your raspberry pi MQTT server IP. Also check if you installed mosquitto

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว +2

      +Anurag Vasanwala the script should have auto-installed, but check again.
      sudo mosquitto -d

    • @anuragvasanwala
      @anuragvasanwala 7 ปีที่แล้ว

      Thanks for the quick response :)
      I tried so many times but the problem persists.
      MQTT is also installed. I followed this tutorial (learn.adafruit.com/diy-esp8266-home-security-with-lua-and-mqtt/configuring-mqtt-on-the-raspberry-pi) to install MQTT.
      I tried to follow tutorial with latest Raspbian OS "STRETCH" and also with old "Jessie" but with no luck.

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +Anurag Vasanwala check your topics for MQTT

  • @wesleyrosa9144
    @wesleyrosa9144 7 ปีที่แล้ว

    It worked, though, my Nodemcu fried after some time in operation. Do I need to use a resistor? What could have happened?
    kbimg.dell.com/library/KB/DELL_ORGANIZATIONAL_GROUPS/DELL_GLOBAL/REC/FY2017/Powersurge.PNG

  • @reeontv5486
    @reeontv5486 6 ปีที่แล้ว

    Thank you for all of your good Tutorial's @QuickPi
    Can someone help me?
    Problem:
    The ESP8266 send "Message Published: True"
    but in my Home App from IOS 11 the Motion Sensor is all the Time triggerd
    if i disconect the ESP8266 with the Motion Sensor the Motion Sensor is still triggerd

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      check your motion sensor, try using different jumper cables or use a different pin altogether. I have seen this issue on a few different occurances with numerous ESP models

    • @reeontv5486
      @reeontv5486 6 ปีที่แล้ว

      Thanks for your Answer. I got a WEMOS D1 mini with a HC-SR501 and i use on JP1 the D1 (GPI05 - in the software pirPin 14) and von JP2 +3,3V + JP1 GND
      wiki.wemos.cc/_media/products:d1:mini_new_v2_2_0.pdf
      I try:
      1. New Install of the rasberry pi with your guides
      2. i tested with a new HC-SR501 and new jumper calbes
      3. Change the pirPin to 13
      I try to use +5V for the HC-SR501 and that didnt change anything.
      BTW: Your Picture from the wiring for the HC-SR501 is wrong. Pin 1 (on the Side with the Jumper) this is the Ground.
      How can i install this plugin ?

    • @reeontv5486
      @reeontv5486 6 ปีที่แล้ว

      New Testing:
      1. Server reboot without "sudo sh /start"
      2. HomeKit App lose connetion to my GPIO Pin Motion Sensor and my Wlan Motion Sensor
      3. sudo sh /start (without the ESP8266 - not connecet with the USB cable)
      4. In my HomeKit App both Motion Sensor are in the resting stage and the GPIO Sensor worked well
      5. Connect and new flashed from the ESP8266 without connected Motion Sensor
      6. After "Message Published: True" the Wlan Motion Sensor triggered without the Motion Sensor on it
      7. After Unplug ESP8266 the Wlan Motion Sensor in my HomeKit App is triggered always until i reboot the rasberry pi
      btw: your srcipt is maybe wrong - i needed to install the MQTT with "sudo apt-get install mosquitto" manual

    • @reeontv5486
      @reeontv5486 6 ปีที่แล้ว

      @QuickPi Happy new year - can you help me ?

  • @taxi2echo4
    @taxi2echo4 6 ปีที่แล้ว

    Hi QuickPi! Thanks for all you help so far, I've gotten further than ever with HAP Node all because of you.
    I'm hitting a wall though, on my ESP your code runs fine but when reviewing it in the serial monitor, I get assigned an IP but the ESP won't connect to the MQTT broker, posting the following message every 5 seconds.
    Attempting MQTT connection...failed, rc=-2 try again in 5 seconds
    After a bit of Googling it appears my MQTT broker is not runner or not connecting properly with HAP Node.
    I'm so close, please help.

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว +1

      Follow this to manually install mosquitto:
      iotbytes.wordpress.com/mosquitto-mqtt-broker-on-raspberry-pi/
      This should solve your issues.

    • @taxi2echo4
      @taxi2echo4 6 ปีที่แล้ว

      Awesome! That's got the ESP talking.
      New problem, the serial monitor only publishes TRUE.
      I cycle the ESP, it boots, connects, reports TRUE for 13 lines.
      Reports False, followed by 6 zeros(0), then reports one(1) and finally repeating TRUE.
      I'm in the process of testing different pins and different PIR sensors but any advice would be throughly appreciated. *Also a similar series of events happens with lowPower set to true.

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว +1

      I’ve had this issue. The solution has been wiring the PIR differently. Most of the Chinese PIR expect 5V input.
      Here’s what I used to fix the issue: randomnerdtutorials.com/modifying-cheap-pir-motion-sensor-to-work-at-3-3v/

    • @taxi2echo4
      @taxi2echo4 6 ปีที่แล้ว

      Right.
      Magnitude of errors on my part. Cheap breadboard power is cheap, no where near the voltage on the selector, that's number one.
      Number two is one I did not see coming. I am using the Wemos board with built in usb to serial and a nice header set. When connected to a PC I guess there is some kind of handshake which changes the function of the board. Once connected some digital pins were generating a voltage, (guess which pin I had selected!) this was causing the TRUE reading, it would never see a lower voltage. Plugged into USB power outlet and bingo! working just as your video says it would.
      Thanks again QuickPi, you've helped immensely. Keep the HomeKit videos coming.

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Awesome glad to hear that, enjoy the new setup :)

  • @Philipp1887HSV
    @Philipp1887HSV 6 ปีที่แล้ว +1

    im using a D1 mini, but after uploading, the esp is just sending nonsense like this: ⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮bK⸮f⸮⸮,⸮dh⸮⸮⸮⸮⸮⸮⸮dh/+⸮p`j⸮⸮⸮⸮⸮⸮`K⸮d⸮+
    this is continuing.
    in the homekit app, the sensor is showed triggering every few seconds in the same interval.
    Can somebody tell me wtf is going on ?!

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Check your console speed. Also check your wiring.

    • @Philipp1887HSV
      @Philipp1887HSV 6 ปีที่แล้ว

      console speed was too low... thanks.. didnt thaought about that...
      i checked the wiring. everything should be connected right.
      this is now the output of the monitor:
      Ready
      IP address: 192.168.2.113
      0
      1
      Attempting MQTT connection...connected
      Message Published: TRUE
      Message Published: TRUE
      Message Published: TRUE
      Message Published: FALSE
      0
      0
      0
      0
      1
      Message Published: TRUE
      Message Published: TRUE
      Message Published: TRUE
      Message Published: FALSE
      0
      and so on...

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      Change the sensitivity of your PIR sensor

    • @Philipp1887HSV
      @Philipp1887HSV 6 ปีที่แล้ว

      unfortunately i cant find an area for a setting where it works properly. its always triggering, even if the sensor is in a box. i can either highest or lowest sensitivity is making no difference. only the time the sensor stays triggered if noticeable.
      already went through your code, but couldnt find any complications.

    • @Philipp1887HSV
      @Philipp1887HSV 6 ปีที่แล้ว

      also i testet with 3 different sensors

  • @muhammadishak8636
    @muhammadishak8636 7 ปีที่แล้ว

    do it with openhab2

  • @marcogreco3070
    @marcogreco3070 7 ปีที่แล้ว

    Thank

  • @azizbayouni5691
    @azizbayouni5691 7 ปีที่แล้ว

    THANKS for the tutorial.. I just don't know how to connect the ESP8266 with my PC..

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      which ESP8266 do you have? It depends on which one you have

    • @azizbayouni5691
      @azizbayouni5691 7 ปีที่แล้ว

      ESP-07 ESP8266.. same one you are using in this tutorial..

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +Aziz Bayouni do you have a serial device?

  • @marcogreco3070
    @marcogreco3070 7 ปีที่แล้ว

    Hi, what ip address in MQTT_server IP ????
    Thank

    • @QuickPie
      @QuickPie  7 ปีที่แล้ว

      +Marco Greco the IP address of your raspberry pi

  • @devadadeepak4196
    @devadadeepak4196 6 ปีที่แล้ว

    Can you make video using windows

    • @QuickPie
      @QuickPie  6 ปีที่แล้ว

      It should relatively be the same process on windows as well.

  • @wesleyrosa9144
    @wesleyrosa9144 6 ปีที่แล้ว

    More videos...

  • @HomeKid
    @HomeKid 4 ปีที่แล้ว

    My version is working directly with HomeKit without homebridge😊 check it out: github.com/HomeKidd