$5 DIY Wireless MQTT Smart Home Window Sensors

Тәжірибелік нұсқаулар және стиль

Bare Reed Switches: amzn.to/2qJ7Wcg
ESP-01 Microcontrollers: amzn.to/2HJ8xTo
CR2032 Batteries: amzn.to/2JWVgY1
Resistors: amzn.to/2J67k8c
Soldering Iron: amzn.to/2JUP3Mm
USB to TTL Adapter: amzn.to/2Hak9BW
3d Printer: amzn.to/2vqMpuz
Bucky Ball Magnets: amzn.to/2vqMBdh
*As an Amazon Associate I earn a % of qualifying purchases at no cost to you.*
Arduino code on github: github.com/thehookup/MQTT_Win...
STL Files:
Main Case: github.com/thehookup/MQTT_Win...
Case Cover: github.com/thehookup/MQTT_Win...
Magnet Holder: github.com/thehookup/MQTT_Win...
Support my channel:
Patreon: / thehookup
Tesla Refferal Code: www.tesla.com/referral/robert...
Music by BenSound.com

Пікірлер: 276

  • @harrison298
    @harrison2985 жыл бұрын

    I just discovered your channel when researching the SONOFF basic, and I love it. Your videos actually make these projects feel achievable for mere mortals like myself. Thanks!

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Glad to hear it, if you need help with a project just leave a comment and I'll see it.

  • @DriftwoodME
    @DriftwoodME4 жыл бұрын

    I’m got a Wyze bridge hooked up to my pi, then I use the custom integration to bring the Wyze sense into HA. With this I can get their motion sensors for $6 each, and their door and window sensors for $5. And their batteries last a year. Mine have been working great so far and update instantly in HA

  • @cornstarch28
    @cornstarch286 жыл бұрын

    Great write up and lots of detail. Thanks for the great ideas!

  • @ericolson9695
    @ericolson96954 жыл бұрын

    I think this project is brilliant: outside-of-the-box thinking! Very clever.

  • @kennethbell4681
    @kennethbell46814 жыл бұрын

    Thank you for making this! I was looking for a cheap window sensor and it looks like I just found one!

  • @squalazzo
    @squalazzo6 жыл бұрын

    oh, great, an other brand new channel with very interesting tutorials! Thanks :D

  • @MrGramcs
    @MrGramcs6 жыл бұрын

    Great videos please keep them coming, but I've got to say I love my Xiaomi sensors & switches running in Home Assistant but great to see an alternative.

  • @romwil
    @romwil8 ай бұрын

    It’s a great solution for something that should never be moved or opened. A great way to also make a lock with included alarm if you don’t correctly disable it by moving the magnet with the sensor. Very neat project to build on due to the power disabled normal state. Or have an always ready to go ‘wipe it all’ kill switch handy to purge drives.

  • @russzaccari7761
    @russzaccari77612 жыл бұрын

    @the hook up I sure wish you'd do a remake on this with a USB C or USB Micro jack for powering. I found this video looking for MQTT sensors to put in refrig & freezer doors. Since I'm doing a powered device with an outlet behind it, I don't really want to replace batteries ever :) Thanks for the video!

  • @TecSanento
    @TecSanento3 жыл бұрын

    You could use the normally closed leed part of the reed switch to determine if the esp should shutdown or not

  • @gokul5693
    @gokul56936 жыл бұрын

    Dude this is cool stuff ....Keep it up...well described Tutorial...Thanks for sharing..

  • @yawarsaeed6499
    @yawarsaeed64995 жыл бұрын

    Thanks for the prompt response. What I meant was that is it possible to get the sensor status notification when there is no internet access or connectivity. Waiting for your reply.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Only if you have a local mqtt broker like a raspberry pi with mosquito and home assistant.

  • @johnjacobjinglehimerschmid3555
    @johnjacobjinglehimerschmid35555 жыл бұрын

    Sweet this looks easy to do .....

  • @johnfrankforther8162
    @johnfrankforther81625 жыл бұрын

    Looks like a great article. What about how to set up MQTT software to communicate with the boards?

  • @Micahberger1
    @Micahberger13 жыл бұрын

    I really appriciate your explaination. Great project.

  • @guatagel2454
    @guatagel24545 жыл бұрын

    Simple. Thank you!

  • @mkrice2
    @mkrice26 жыл бұрын

    Great video. Just what I wanted. You made it look easy. No I have to go to work!!!!

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    make sure you check out the updated version: kzread.info/dash/bejne/ZJ-AvJl9nLOfe7g.html

  • @simon77809
    @simon778095 жыл бұрын

    I've been watching your videos on node red, thanks by the way, and whilst I agree this is an interesting project, I would suggest you look at the CC2351 devices and Zigbee2mqtt software, so far I have bought aqara sensors Windows latch, temp/humidity and a double pole switch. All work brilliantly with MQTT, Home assistant and node red. And NO aqara xiaomi hub required, I also control my idea tradfris with this too no messing with upgrading them or linking to hue.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Yep, it's a pretty good option these days. I believe this video predates zigbee2mqtt by 6 months or so.

  • @PhG1961
    @PhG19616 жыл бұрын

    Very cool video ! Thnxs for sharing !

  • @MrBobWareham
    @MrBobWareham5 жыл бұрын

    Would love to build one but want to do my front door and that would mean at least two times a day so if I changed the battery to a rechargeable battery would it last longer for a front door? Thanks for the video and project Bob-in the UK

  • @ddee2501
    @ddee25014 жыл бұрын

    As an electrician, i always suggest clients put in more wiring during building stage !!

  • @randomodbuild

    @randomodbuild

    4 жыл бұрын

    Or lots of conduit

  • @nicholasrefalo7744
    @nicholasrefalo77445 жыл бұрын

    Excellent solution Rob I've replicated this in my lab and it works great. Is there a way to adjust the code to stop the chip returning to the default state of closed? I want to use this on some windows which stay open for an hour or two and with the state returning back to close within 50seconds I don't know if my window is still open at the end of the day. I know this will drain the battery faster but I'm okay with that.

  • @Zeric1
    @Zeric15 жыл бұрын

    Cool idea of just using the reed switch to turn on the device. As others have pointed out battery life could be a concern on windows that are left open. I think the bigger thing for people to consider is the value of any security system if the intent is to catch a potential burgler, although it may be deterrent, especially cameras. The reality is burglaries only last at most 10 minutes, not enough time for a central monitoring company to verify with the owner that it's not a false alarm, call the authorities, and for the authorities to respond on site. My house was burglarized during the great recession, it was very obvious that they were only inside 5 minutes at the most, certainly not enough time for any alarm to do much. At the time I had two medium sized dogs, and an alarm sign prominently posted outside...neither, dogs, nor the fact I had an alarm system made any difference (the alarm system wasn't functional, but they didn't know that). Some rooms they didn't go into at all. I don't have any valuable jewelry or significant cash to speak of. They did take a cheap netbook and $40 sitting on the dresser. I was just glad they didn't injure my dogs. I now have hardwired security cameras that cover the full exterior of my house. I think that is a better deterrent. If one's intent is just to be reminded that a door or window has been left open, then sensors work well.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Also a loud siren is good for making sure they don't stick around for long.

  • @gileansolomonsz6931
    @gileansolomonsz69313 жыл бұрын

    Hi Mate, awesome video and great to be on the hook up. Totally new to the entire home automation and only got hooked onto it during lock down so bare with me. I followed this video ordered the parts and got them last week. have made the window sensor and it works as expected and I installed a mqtt snooper app and i can read the open close messages. My issue is how do i now add it to my home assistant like you had on your video where it monitors all the windows

  • @hbosch5223

    @hbosch5223

    3 жыл бұрын

    Go to the HA forum and you should be able to find your answer with step by step mqtt setup.

  • @myounges
    @myounges5 жыл бұрын

    Nice video! Another solution are those RF Reed switches on AliExpress and use a sonoff RF bridge to listen for the rf signals and forward them via mqtt to nodered or HA. I used this setup batteries last year's on doors i open and close every day. And the cost is similar. The sonoff bridge was 8 euros i think. I use espurna firmware on the rf bridge. Hope it helps

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Yeah, DrZzs has a good video on the RF bridge with tasmota too. I ordered one to try it out but it was DoA and I haven't gotten another one yet.

  • @myounges

    @myounges

    5 жыл бұрын

    Using this RF bridge this gives you lots of things you can interact with. Smoke detectors, leak sensors, rf relays, garage doors, pir, alarm sirens, etc. I personally like espurna over tasmota just because it has a nicer gui but the functionalities are similar.

  • @jayare7750
    @jayare77505 жыл бұрын

    Is there a way (being powered by a wall adapter) to make a door sensor that can send open triggers, closed triggers and get current status of the reed switch with an ESP-01?

  • @bamc3835
    @bamc38353 жыл бұрын

    what if i don't want to do a diy window sensor? can you please make a video about different security system window sensors that won't easily be tripped by somebody who is just a regular guy (for example, somebody can just peel off the simplisafe door and window sensor and come back later and reglue it back on like it didn't happen)...pls feature both wired and wireless versions...also would you have a video on a good setup for whole house security system setup for a new build - really need that right now...thanks and love your channel; just wish i am more of a techy diy type

  • @stupossibleify
    @stupossibleify3 жыл бұрын

    I was about to ask about how you got the ESP8266 to deep sleep and then... GENIUS!

  • @berczidavid2813
    @berczidavid28133 жыл бұрын

    Best youtuber/teacher in the world!!!

  • @testchannel1834
    @testchannel18344 жыл бұрын

    Hi can you make a video with this hardware for a mailbox door open closed notifications system with 3 cr2032 in parallel

  • @starshipduck
    @starshipduck5 жыл бұрын

    Hi nice video! So I’m trying to follow your code but I’m not sure what is going on in the reconnect loop and why you set boot to true on the beginning as well as why you have certain if statements checking if boot equals true when it will be true in the beginning from the get. It would be good if you could add comments on why you are doing it this way. Also why is the while loop checking if client is NOT connected “!client.connected()”

  • @pjrt_tv
    @pjrt_tv4 жыл бұрын

    yeah, this kind of sensors make more sense in a normally-closed window environment (like Florida). But I'm in NY, and opening windows throughout the year is necessary. :(

  • @mrq3969
    @mrq39694 жыл бұрын

    I do all the above steps perfectly. Wifi connected. But what about node-red configuration? please help me. How can the home assistant add it?

  • @TheBauwssss
    @TheBauwssss5 жыл бұрын

    I would love to buy one but I think i'll modify it to use two or 3 AAA cells, since I open my windows a lot. I have not done the math but that should give it a LOT more opens.

  • @joemasterson8860

    @joemasterson8860

    4 жыл бұрын

    Did you end up doing this?

  • @rafac13
    @rafac135 жыл бұрын

    Great video!

  • @kabturek
    @kabturek6 жыл бұрын

    You should use a static ip address for your esp - it should lower the time to connect to 2s or less

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    SornDP suggested that below. That's in my weekend plans.

  • @ahmedalshamsi1723

    @ahmedalshamsi1723

    4 жыл бұрын

    @@TheHookUp I am facing a problem with knowing what to choose on node-red can you help me with making a tutorial and not depending on other channels vids this is a suggestion that will help you increase the quality of your channel.

  • @ddee2501

    @ddee2501

    4 жыл бұрын

    @@ahmedalshamsi1723 MQTT IN node connected to DEBUG node. Then configure MQTT IN node to your topic in code (PICK_UNIQUE_WINDOW_TOPIC)

  • @ahmedalshamsi1723

    @ahmedalshamsi1723

    4 жыл бұрын

    D DEE hey thanks for the reply

  • @ahmedalshamsi1723

    @ahmedalshamsi1723

    4 жыл бұрын

    @D DEE what about flashing the firmware first to the esp8266 0-1 and then flashing the sketch. Cause whenever i try to compile a sketch it does not work, even flashing the firmware to the esp8266. I bought ftdi, usb to ttl and usb to esp8266, i worked first with @The Hook Up way using the ftdi but did not work. Then used usb to esp8266 wired the pins from the back of the usb to allow it to compile a sketch to the esp but did not work so as the usb to ttl. And know i bought an arduino but waiting for the jumper wires to hook em up. IN BRIEF HOW SHOULD I CONNECT THE ESP8266 0-1, THEN IF THE CONNECTION WORKED TO FLASH THE ESP FIRMWARE USING THE FLASHER AND FINALLY WILL IT WORK TO COMPILE A SKETCH.

  • @Freestila
    @Freestila4 жыл бұрын

    Use a sonoff rf bridge and standard rf window sensors. Sensors are around 5$ but use AA /AAA batteries and will work way longer. Also they have real open / close messages and sometimes anti tamper contact or battery low message

  • @JimBell20

    @JimBell20

    4 жыл бұрын

    Ditto. I have 5 rf windows sensors with the sonoff rf bridge. Works great. Dr ZZs has a video on using these sensors with the bridge and where to get them cheap.

  • @koenzele9579
    @koenzele95794 жыл бұрын

    I would like to see an update of this video with ESP NOW, very easy and less energy consuming.

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    The issue with ESP NOW is you also need a always on ESP8266 as the receiver (hub). I've played around with it but ended up sticking with the initial design. About a month ago I opened up all the windows to make sure they were still kicking, all messages came through as expected.

  • @garethsmith7628
    @garethsmith76284 жыл бұрын

    reed switches don't like switching much current at all, usually they are used in conjunction with a snubber circuit.

  • @martinsmith5419
    @martinsmith54194 жыл бұрын

    I am relatively new into smart home tech, could this be modified to be used with a battery-powered doorbell as the switch instead? Thanks for your help!

  • @boviac
    @boviac5 жыл бұрын

    Love your detail and DIY sharing attitude! However, now WYSE Sense Door/window sensors 4 for $20.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Yep, they're pretty cool. Proprietary protocol, but still cool.

  • @demps7765
    @demps77656 жыл бұрын

    What are the chances of getting a dozen of those window sensor cases/cover/magnet holders?

  • @deez-nutskroll7223
    @deez-nutskroll72232 жыл бұрын

    I love these and have them in all my window’s but I’m not sure how to get it in home assistant. I did get it to notify me when a window is open with node red. But I know there’s a way of seeing them in Lovelace. Could you help me. Thanks

  • @bm830810
    @bm8308104 жыл бұрын

    1- use a cheap boost converter (under 1$) to boost the voltage and get much more out of the battery 2- use ESP-Now instead of wifi and make a simple custom esp-now to mqtt bridge for all your modules, you can reduce transmission time from 4s to around 0.1s, also the system would be much more secure now your batteries would last forever

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    Both really good suggestions. The purpose of this project was to make something as simple as possible, so I didn't want to add a boost converter and double the price and complexity of the board. I also wanted them to work independently of a hub which is why I decided against ESP-Now (although I did experiment with it and I do have a working version that utilizes it).

  • @StripesOO7
    @StripesOO73 жыл бұрын

    Imagine opening your windows less than 20 times in 6 years 🤯

  • @whatevah666
    @whatevah6665 жыл бұрын

    Hmm, the battery limitations is a bummer, any cheap/sane way of hardwiring it to a powersupply of some kind? I'm about to remodel the house sso putting stuff into the walls does not bother the the least, perhaps something over PoE would work in this case? I have a few of those switches.

  • @Wrenchmonkey1

    @Wrenchmonkey1

    5 жыл бұрын

    Just run low voltage wiring, and run it off a DC transformer. New construction is easy to wire up for stuff like this. Existing homes are a bit more difficult, hence the need for wireless...

  • @klincecum
    @klincecum6 жыл бұрын

    It would make it a little bigger, but if you add two relays, you could have it completely unpowered, latch the power on relay, send the messages you want, and then have the 2nd relay break the power connection and turn it completely off again. No deep sleep required. May not be for this particular project but maybe give someone some ideas. Thx for the video, it inspired some other projects.

  • @Wrenchmonkey1

    @Wrenchmonkey1

    5 жыл бұрын

    The current a relay would draw would likely be more than the sleep function draws. Bottom line is, it's probably not the best option for windows that are opened frequently.

  • @justinsarmento8809
    @justinsarmento88094 жыл бұрын

    Does anyone think that 4 AA's would be to much for it? I am looking at putting them on doors and would like for it to live longer then 20 openings.

  • @joemasterson8860
    @joemasterson88604 жыл бұрын

    How long do your batteries last? Thinking of putting this setup on my garage freezer to alert me when it doesn't close all the way.

  • @Stony5438
    @Stony54386 жыл бұрын

    interesting idea. Could you do a project showing how to hook your projects up hardwired? Or at least to a hardwired power source?

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    I use NodeMCUs for all of my hardwired stuff, but yes, one of the next videos will be using a hardwired microcontroller.

  • @willhutcheon4144

    @willhutcheon4144

    5 жыл бұрын

    The hardwiring isn't that bad. Making it look good an concealing the wires - that is the trick. Some people have old (disabled)) security systems and those wires running to normal contacts. You could convert those (leave the normal contact if it is working) and "remotely" locate at the other end of the wiring, giving clean, easy access to power/wiring. In this scenario, 1 NodeMCU or D1 Mini or ESP32 could likely monitor all of your windows/doors as desired. Now that would be awesome! -- Another idea is to use a "cell phone powerbank" get one that looks good, and just wire it nearby. It would last a long time, and easily change standard AA batteries (or recharge the bank). It all depends on esthetics/look and feel. it might be a good way to "test" and start by installing contacts, then worry about concealment after 1 month and deciding it's working well for you. Just a thought.

  • @danielmosquera3512
    @danielmosquera35124 жыл бұрын

    Hi, i have a question... will the device create an entity automatically in hassio? i'm using mosquitto broker and in node-red i see the "close" and "open" message but i do not know how to integrate it to hassio lovelace as a window im trying this in my file sensors.yaml - platform: mqtt name: "window1" state_topic: "test/window1" but nothing. could you help me? thanks

  • @oblongx
    @oblongx6 жыл бұрын

    very cool design

  • @TecSanento
    @TecSanento3 жыл бұрын

    You could use the mac Adress for the unique Adress

  • @JH_Tech49
    @JH_Tech495 жыл бұрын

    nice project and nice video, but it would be better if more instructions on how to integrate it in Home assistant were provided. I am still a newbie :)

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    If you use the updated code from this video: kzread.info/dash/bejne/ZJ-AvJl9nLOfe7g.html You will just add a sensor for each window like this: sensor: - platform: mqtt name: "Dining Room Window" state_topic: "windowStatus/diningRoom"

  • @RossCanpolat
    @RossCanpolat3 жыл бұрын

    Is there a way to detect when the battery is low?

  • @dannytech4709
    @dannytech47094 жыл бұрын

    Hi any update on this project ? Can this be accomplished with Esp home?

  • @aaaafaaaaf
    @aaaafaaaaf6 жыл бұрын

    Do you have the Arduino connection parameters for the esp1. thanks.

  • @SornDP
    @SornDP6 жыл бұрын

    Very cool, I will be trying this for myself. I believe part of the 4 sec response time could be shortened by using static IPs rather than DHCP assigned ones. Is is possible to test that?

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    Gonna try that out this weekend.

  • @shaunwhiteley3544

    @shaunwhiteley3544

    6 жыл бұрын

    The Hook Up, hi, did you try this? Any time improvement? I wanted to go all static ip for all my nodes but my router has a hard limit of 30 static addresses. Have you tried the Hassio dhcp addon? I need to check if that has a limit or other limitations? I’m saving this tutorial for when I manage to fix my 3D printer, I’ve messed all the settings up flashing the firmware, doh! Cheers

  • @lmaoroflcopter

    @lmaoroflcopter

    5 жыл бұрын

    @@shaunwhiteley3544 your router shouldn't limit anything. Instead of using static DHCP leases, just configure your DHCP pool to be smaller than the full subnet and allocate IPs yourself in the esp01 code.

  • @JohnVanderbeck
    @JohnVanderbeck2 жыл бұрын

    I know this is an old video but I'd love to some someone like you dig into making DIY devices for Thread. I've been doing a lot of digging and slowly learning but looking at building something like these window sensors that work with Homekit using Thread.

  • @TheHookUp

    @TheHookUp

    2 жыл бұрын

    Thread is going to be replaced by, or rather is going to become Matter. At this point there's no reason to make a purely thread device. I actually just ordered a matter dev board and will be doing a video on it.

  • @JohnVanderbeck

    @JohnVanderbeck

    2 жыл бұрын

    @@TheHookUp My understanding is Matter is an application layer that will use Thread as a preferred transport protocol which is why I said Thread but yes Matter is the end goal here :)

  • @TheHookUp

    @TheHookUp

    2 жыл бұрын

    @@JohnVanderbeck Your understanding is correct :)

  • @msmadaram
    @msmadaram5 жыл бұрын

    have you ever work on android broker such as moquette or something like that ?

  • @mumbles1justin
    @mumbles1justin5 жыл бұрын

    I like the the idea and may make a few myself for use on cabinets. But aren’t all your windows susceptible to deauth attacks?

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Probably not. Deauth only works on currently connected devices, but they would be vulnerable to ssid spoofing.

  • @adambaker5854
    @adambaker58545 жыл бұрын

    Rob, thanks again for all your awesome work. Two questions: 1. The Amazon link for the buckyball magnets goes to 2.5mm magnets, but the holes in the magnet holder's .stl file sure looks to be near 5mm. What size magnets is the .stl file designed for? 2. Have you ever thought about integrating a simple database into your Node Red flow, so that rather than have a "default" state, every time the sensor's state changes, it pushes the most recent state to a database, and THAT's the value that is displayed in a dashboard? That way, you know whether your window is actually open or closed... Thanks again!

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    The problem is the device never knows when it is closed. It wakes when it goes from closed to opened, sends a message, then goes into deep sleep. Closing the window cuts all power to the device so it can't send a closed message.

  • @adambaker5854

    @adambaker5854

    5 жыл бұрын

    Thanks for your answer...that makes sense. How about the buckyball size?

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    @@adambaker5854 ​ You are correct about that, mine are 5mm. For some reason I assumed the 2.5mm was a radius, but it appears that is the diameter. This is the correct size: amzn.to/2UG8u4K

  • @DB-nl9xw
    @DB-nl9xw5 жыл бұрын

    Please review zigwee sensor or wifi door sensor

  • @hbosch5223
    @hbosch52233 жыл бұрын

    Is there a way to incorporate a delay in the reed switch action ? I want to create a wifi button from this, but I don't want to press the button and hold it while it boots and sends a message. Would this be some mosfet thing ? I've been using WyzeSense for a button with HA, but these sensors all full stop unreliable. I have 5 dead ones already. The amount of labor I've spent with debugging the WyzeSense problem could have paid for a hardwire of my house. Thanks

  • @TecSanento
    @TecSanento3 жыл бұрын

    Does it post "closed" when power drops out?

  • @ItianNerona
    @ItianNerona4 жыл бұрын

    I really enjoyed this video. I am trying to create something out of an ESP-01. Is there a way to contact you?

  • @user-zr7kz4vs7c
    @user-zr7kz4vs7c3 жыл бұрын

    Any cheap android tablet that you recommend for running Home assistant dashboard kiosk mode?

  • @danhalliwell5397
    @danhalliwell53974 жыл бұрын

    HI, I have a Kerui Wireless Alarm System. I have all the door sensors and alarm panel setup but would love it to be intergrated via the Home Assistant. Does anybody know how I could do this at all. I am new to the Raspberry Pi but loving it. Any help would be much appreciated. Many thanks

  • @hbosch5223

    @hbosch5223

    3 жыл бұрын

    If you have the Kerui I see on amazon, there is no real way to do this. It is a completely closed RF system without an integration point. I used wyzesense contact and motion sensors with HA, but reliability has been terrible. That is why I am looking at these or just getting the house hardwired.

  • @JohnnieHougaardNielsen
    @JohnnieHougaardNielsen5 жыл бұрын

    Wouldn't the three second delay mean that the alarm would not sound if the window is closed again quickly, cutting off power to the ESP-01? While that time is probably not realistic for someone to pass through the window before slamming it again, it could be feasible to throw some object inside the house, like some nasty gas, surveillance device, or whatever undesirable thing. I'm thinking that transmitting a 433Mhz signal (like from a wireless doorbell) could have a shorter reaction time than connecting to Wifi. It shouldn't add a lot of volume or cost to the window sensor. Another thing is that a somewhat smart miscreant could bring along a magnet to interfere with the sensor. This could be made harder by adding a second normally-open reed switch just outside the range of the installed magnets.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Yep, these things fall under the "good enough" catagory for me, not "perfect". They have some downfalls and there are situations where they won't work (a wifi blocker or deauther would be the easiest route), but introducing additional complexity to the circuit seems like a waste just to cover those edge cases.

  • @jeevakkuwar
    @jeevakkuwar3 жыл бұрын

    Any way I can receive similar notification with Amazon Alexa? I am not using Home Assistant and would like such sensors to work with alexa

  • @FranciscoJGomez-CHSM
    @FranciscoJGomez-CHSM4 жыл бұрын

    Few months ago I asked If you have a channel in microbiology, my son is estading , I think you are in that area.

  • @JamesMossR33
    @JamesMossR335 жыл бұрын

    Sadly it appears that the four ESP-01s I bought must be the power hungry type. When I hook up to 3.3v it works perfectly in about 2 seconds, but when I use a new CR2032 straight out of the packet the lights come on then dim or go out, and no message is sent. Checking with a multimeter the cell voltage drops to ~1.4v when the circuit is made. I've nipped the LEDs off a couple of boards but no difference.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    That's a bummer. The case would need to be modified but I wonder how an A123 battery would do in this situation.

  • @JamesMossR33

    @JamesMossR33

    5 жыл бұрын

    @@TheHookUp Thanks for the steer I'll look into them, and thanks for the videos on these sensors. As I'm new to smart home stuff your videos have been gold.

  • @glen4cindy
    @glen4cindy3 ай бұрын

    I know this is a pretty old video but I'm having trouble getting the ESP device programmed. I've failed several times. I'm guessing I may have the wrong board selected. Can you help?

  • @rottison
    @rottison6 жыл бұрын

    hi just got all the parts to make my first 10 units I was concerned about how small the magnets are. Do you use just one in each of the 3 holes? and to fasten them in I got a tube of super glue to put just a small amount in the hole then drop the ball in

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    Yep, just one in each. you can put them next to the reed switch and hear them doing their thing. You'll hear a faint "click" when it disengages the circuit. Good luck! make sure you post a reply on how your build went.

  • @Conservator.

    @Conservator.

    6 жыл бұрын

    The Hook Up Still no reply from Dale L. Makes one wonder, might he accidentally have glued his fingers to the window?

  • @generonnebaum1989
    @generonnebaum19894 жыл бұрын

    Nice Video, I learned much. I hooked this up and started the debug program in Node-Red. I noticed though when I run the script code that it says "open" when I apply power to it on node-red. Then after approximately 23 seconds, it says "closed". I use mosquitto broker. The mosquitto says that it exceeded timeout and disconnected when I look at it even when I still have power on it. Is there a problem with the code. I can't seem to keep the ESP8266 alive. I have tryed two different ESP8266 modules and I am using a standalone power supply for 3.3V.

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    That’s what the program does. That is working as intended, this is not meant for windows that you will leave open.

  • @Xalies

    @Xalies

    4 жыл бұрын

    if you still want one that stays open you need to keep the connection alive... heres one I have here pastebin.com/t5jiEwTS it only sends the open message on boot and sends "0" to another topic on loop and a closed when you disconnect

  • @NextLevelCode
    @NextLevelCode4 жыл бұрын

    You should use a tiny boot converter to get the full life from the batteries :)

  • @TecSanento

    @TecSanento

    3 жыл бұрын

    They take up even more energy

  • @linuxboi2869
    @linuxboi28693 жыл бұрын

    Onboard until I saw the open windows 20 times. I open my windows that many times in a day sometimes. Still have an upvote though dude!

  • @TheHookUp

    @TheHookUp

    3 жыл бұрын

    Yeah, not good for your use case.

  • @linuxboi2869

    @linuxboi2869

    3 жыл бұрын

    @@TheHookUp be good to see how long a CR2450 would last in comparison.

  • @TheHookUp

    @TheHookUp

    3 жыл бұрын

    I think the next logical step is an A123

  • @linuxboi2869

    @linuxboi2869

    3 жыл бұрын

    @@TheHookUp yeah that’s around 1600 mAh, would last a long time!

  • @madzur
    @madzur5 жыл бұрын

    Hello there and props for the very cool idea. I tried to follow your instructions, however it seems something is not right. I can get the Arduino IDE to program my ESP-01 with the supplied sketch, I even uncommented the few lines in your "static IP" sketch, however I don't see the ESP come online in my router's web interface and I also don't see any responses when connected to the ESP using a serial interface through Termite. Any tips on how to debug what is going on here, please?

  • @madzur

    @madzur

    5 жыл бұрын

    hey @thehookup, any tips, please? I tried different ESP01 chips (I have 3) and none of them seems to work. When I connect and disconnect them from the serial adapter some garbled text shows up in Termine, otherwise not even a single character. I’m pretty sure it's something simple, and being a noob, I can't figure it out..

  • @Wrenchmonkey1

    @Wrenchmonkey1

    5 жыл бұрын

    @@madzur Triple check your SSID and password. If your SSID has spaces or special characters, try changing that?

  • @dweebyone
    @dweebyone5 жыл бұрын

    Hi, This is great info, I have order the components to have a go myself. Only problem with Arduino cant find library ESP8266WiFi.h

  • @Ed19601

    @Ed19601

    5 жыл бұрын

    Thats incuded in the esp8266 board install

  • @yawarsaeed6499
    @yawarsaeed64995 жыл бұрын

    Awesome Project. Sir , can you confirm , do I still need to set up local mqtt broker on Raspberry pi to use this sensor. Please reply. Thanks

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Doesn't need to be local, you could use cloud mqtt if you wanted to.

  • @Zeric1

    @Zeric1

    5 жыл бұрын

    running a local MQTT server is more reliable and you have full control of who sees your data. If you were setting up MQTT devices for the first time, you could start with cloud mqtt for proof of concept, but would definitely move over to a local server. I started off directly with a local mosquito mqtt broker on a RPi a couple of years ago, it wasn't hard to setup...there are lots of "how to" sites and videos online.

  • @hennieviljoen4335
    @hennieviljoen43354 жыл бұрын

    Hi The Hook up where is the home assistant setup for this project?

  • @hackup3841

    @hackup3841

    3 жыл бұрын

    I would also like to know about the integration in home assistant. I subscribed Mosquitto mqtt broker to the topic of the sensor. But now I need to include it as sensor. I would like to integrate it as binary_sensor though. Anyone any ideas how to achieve that? In complex heating control with schedy in HA I see the window sensor switching from closed to open and back to closed from time to time. I just want it to show open and not send any more message on the mqtt topic. Is that possible?

  • @aliayan1995
    @aliayan19955 жыл бұрын

    you can add very small solar panel and rechargeable battery

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    I'd love to do this, but it introduces a bunch of other circuitry (need a voltage regulator and a charging circuit).

  • @danielmoshi6214
    @danielmoshi62145 жыл бұрын

    Open a window 20 times in 6 years? Must be a crack house!

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Florida. Only open the widows if you want hot wet air streaming into your house.

  • @ashoktvm
    @ashoktvm3 жыл бұрын

    For me it dont go to closed with few seconds even after the esp01 is off but get closed after 22 seconds even if the esp01 is still on. How to rectify this

  • @bitterrotten

    @bitterrotten

    3 жыл бұрын

    That 22 second delay is probably caused by your home assistant setup. I know my Raspberry Pi install with SD card is pretty lax with timings. I've read that moving it to SSD will speed things up. Your second problem with the window being marked as closed while it's still open, that's the way he's coded it. It only sends the open status once. He's using it for the notification that the window was opened rather than as a status indication. You could try playing with the ESP.deepSleep(0) value to make it keep sending an open status but then you'll get some weird toggling issues when your home assistant sends it's default closed value. There's a way to do this smoothly with an automation but I'm not good enough at HA to guide you.

  • @KazimsChannel
    @KazimsChannel4 жыл бұрын

    Still don't get how can it send close message? Reed relay disconnects power to ESP....

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    Last will and testament (lwt) is stored on the MQTT broker and basically says “if you don’t hear from me again, tell my family I love them”, except it just says “close” instead.

  • @yurid7418
    @yurid74185 жыл бұрын

    for wireless sensors should be used cheapest and low power solutions based on STM32 MCUs. For standard wireless alarm system should take less than two seconds to send alarm event. Otherwise the sensor can be destroyed by intruder person. Also system must monitor battery state that means to send message with battery state. Any way good start and system step by step can be improved.

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Using an STM32 kinda misses the point. The whole reason I made this was to be able to use them with WiFi without needing a hub. If you used an STM32 you'd need to use some other module like RF or wifi (in which case you'd be using both the ESP01 and the STM32). Check out my follow up video to this one, I was able to get the transmission time down to around 2 seconds using a static IP: kzread.info/dash/bejne/ZJ-AvJl9nLOfe7g.html

  • @yurid7418

    @yurid7418

    5 жыл бұрын

    @@TheHookUp Agree with you that for STM32 + nRF / CC11xx / CC25xx / OTHER_RADIO require some gateway to connect sensor over Wi-Fi . I found some gateway solutions based on ESP8266 like: github.com/derkzomer/nrf24l01-esp8266/blob/master/post.ino or github.com/1technophile/OpenMQTTGateway It could improve power consumption, extend range in case of use 868MHz / 915MHz . In near feature I planning to connect my Irrigating system over the similar gateway solution to MQTT broker located in Raspberry. It will be nice to collaborate and share and publish source code.

  • @rklauco
    @rklauco4 жыл бұрын

    Set static IP for the ESP - will start MUCH faster ;)

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    I've got a follow up video to this where I set a static IP.

  • @StePhanMckillen
    @StePhanMckillen6 жыл бұрын

    Nice

  • @davidwalker575
    @davidwalker5754 жыл бұрын

    Hey, love your channel. I'm just getting started and trying to follow along. I get the following message when I both up the ESP-01 and check the Mosquito log on HA: 1. New connection from 192.168.1.153 on port 1883. 2. 1596619053: New client connected from 192.168.1.153 as KITCHEN_WINDOW (p2, c2, k15, u'mqttuser'). 3. 1596619075: Client KITCHEN_WINDOW has exceeded timeout, disconnecting. Any idea why it's timing out?

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    because the code turns the wifi radio off after a successful transmission

  • @GlennTrefethen
    @GlennTrefethen6 жыл бұрын

    how did you remove the header pins from the esp-01. it does not fit the case with them.

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    Check out 4:03 in the video. You can push the pins through with a hot soldering iron.

  • @GlennTrefethen

    @GlennTrefethen

    6 жыл бұрын

    and i watched this 4-5 times, and just missed that. tnks

  • @FranciscoJGomez-CHSM
    @FranciscoJGomez-CHSM4 жыл бұрын

    Could you work with deep sleep to optimize de battery.

  • @TheHookUp

    @TheHookUp

    4 жыл бұрын

    This unit already uses deep sleep

  • @FranciscoJGomez-CHSM

    @FranciscoJGomez-CHSM

    4 жыл бұрын

    Thanks

  • @thetinytrader1564
    @thetinytrader15645 жыл бұрын

    I am having around 50 connected devices. Can you suggest a good economical router for my house ?

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    I love my google wifi, I have 60-70 devices at any given time and google wifi never skips a beat: amzn.to/2SnnWgr

  • @Leonvolt28

    @Leonvolt28

    4 жыл бұрын

    Little late reply. But I would suggest to buy an Asus router. You can easily extend it with Asus Aimesh. Plus you can integrate asuswrt with home assistant for presence detection.

  • @wholivelikethis
    @wholivelikethis4 жыл бұрын

    this is some triple OG gangster shit

  • @kylehase
    @kylehase4 жыл бұрын

    Given that the default state is off, you wouldn't know if a chip failed or battery died without periodically testing each one.

  • @andy1979s
    @andy1979s6 жыл бұрын

    Followed your tutorial. im 90% there. Hassio sees the sensor, displays closed while magnet is attache and open when magnet is away. The only think i cant get to work is the push notification (html5 push notification working with other stuff) not sure what im doing wrong or not doing. Any help appreciated.

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    Are you trying to do an iOS push or an HTML5 push?

  • @andy1979s

    @andy1979s

    6 жыл бұрын

    got it working in the end... woohoo!

  • @andy1979s

    @andy1979s

    6 жыл бұрын

    Doing it on android. But it works now... bit I have another question if you don't mind. I adapted your original design. And am powering the sensor with an 18650 battery. I left your code as it was. How does the battery voltage alert works. ? Does the sensor logs the voltage in mqtt every time it connects? I would like to add that to my push notifications.

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    You can modify it to do that. Just change the if statement where it measures the voltage and have it always return true.

  • @andy1979s

    @andy1979s

    6 жыл бұрын

    Cool will try it out. Here is my current notification in automation.yaml - - alias: Send me a message trigger: platform: state entity_id: sensor.patio_door to: 'open' action: service: notify.notification_test_s8 data_template: title: "Patio Door Open" message: "Patio Door Open {{ states.sensor.patio_door }}" How to add the voltage info once I have it in mqtt?

  • @rottison
    @rottison6 жыл бұрын

    you should sell the cases if possible could be a nice little side hobby to make beer money. I know I would buy 10 of them. Could these little guys work on doors to? anywho nice videos

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    I think there are bunch of people that sell 3d printed products for pretty darn cheap. Check ebay for 3d printing services, I think these would run about $15 for 10.

  • @chrisgo4668
    @chrisgo46686 жыл бұрын

    Whats about windows that are opened regularly and stay open for hours? How does this affect the battery life?

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    Staying open would put moderately more drain on the battery... It goes into deep sleep after sending the original message so we're talking about microcurrent draw. The biggest issue is that it will inaccurately report the window status. A major goal of this project was to keep them as easy to make as possible. There are certainly ways to allow it to do open/closed operation, but they would require a larger circuit.

  • @chrisgo4668

    @chrisgo4668

    6 жыл бұрын

    Ah, it goes to deep sleep after sending out the open message. Thanks! So if I use a battery pack with some aa-cells instead of a coincell, I could get it running for years.

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    yep.

  • @jaredkindred

    @jaredkindred

    6 жыл бұрын

    If you open a window often just keep a spare magnet near by and place it on the sensor when you have the window open for long periods of time. Don't forget to remove the magnet prior to closing the window again.

  • @chrisgo4668

    @chrisgo4668

    6 жыл бұрын

    Thats a cool idea! Maybe putting one of those fancy "remove before flight" things on the magnet, so everybody recognizes it.

  • @teodorbirca
    @teodorbirca5 жыл бұрын

    what is the enabled pin on ESP-01? what would be in a Wemos D1? can you post a clearer picture or schematic please? thanks

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    Wemos D1 doesn't have an enable pin, it's just hardwired on the development board, you don't need to do anything special.

  • @teodorbirca

    @teodorbirca

    5 жыл бұрын

    @@TheHookUp thanks for the quick replay, so its possible to use it with your implementation? If so between wich pins i should add the 10k resistance? Thanks

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    You don't need it at all.

  • @teodorbirca

    @teodorbirca

    5 жыл бұрын

    @@TheHookUp ok, sorry then without a 10k resistor to what pins on wemos the door sensor should be hooked up? If i hook one sensor wire to ground and the other one to the ground power supply , when window is closed the circuit will be on when closed and off when window open, this is what i don't get , sorry for bothering with so many questions :)

  • @TheHookUp

    @TheHookUp

    5 жыл бұрын

    oh, sounds like you bought the wrong kind of reed switch. You'll need a normally closed switch, that is open circuit when it is next to a magnet.

  • @YusriSalleh
    @YusriSalleh6 жыл бұрын

    Why not use 433mhz window sensor and use 433mhz to mqtt esp8266?

  • @TheHookUp

    @TheHookUp

    6 жыл бұрын

    Others have suggested that. I think it's a good option. For my use case (where the windows never open) these were a cheaper option, and I like building stuff :)

  • @YusriSalleh

    @YusriSalleh

    6 жыл бұрын

    The Hook Up your method is more secure ...

  • @iohin
    @iohin3 жыл бұрын

    How does Amazon dash button do it? It’s WiFi too

  • @TheHookUp

    @TheHookUp

    3 жыл бұрын

    It's quite a clever beast. It actually never connected to wifi, it just sent some broadcast initialization packets to the router that would then get processed by echo devices on the same network. By avoiding the full WiFi handshake it saves a TON of battery.

  • @iohin

    @iohin

    3 жыл бұрын

    I don’t think having an echo on the local network was a requirement. I think you are talking about the ARP packets that hackers/DIY-ers used to listen to the button presses. You might be able to replicate the ARP packet approach. ARP packet is sent when any device connects to wifi. So you don’t have to send anything to mqtt. Just fall asleep immediately after connecting to SSID and have a script listening to ARM packets with the known MAC address of your esp-01. They claimed 250 button presses of off one AA mpetroff.net/2016/07/new-amazon-dash-button-teardown-jk29lp/

Келесі