Hi all, firstly I really hope that this is posted in the right category. I've recently become acquainted with Arduino, and still have very limited knowledge, but I'll try my best to explain my project and the issue I'm facing. I'm assuming that the answer will be very obvious to most
I'm become obsessed with smart home gadgets lately, where I'm using Smartthings to control many devices in my home (I already have an ESP-01S powered iRobot, which works great!). I have an iSmartgate garage door opener, when together with my phone as a presence sensor via Smartthings, works great for automatically opening the garage door when I come home. The only thing is that it opens the garage door every time I arrive home, when in reality, I only want it to open the garage door automatically when driving home, and not walking home...
So I got inspired by this project (linked below), with an idea to use an ultrasonic sensor to detect if the car is in the garage. This would then send a request to webhooks/ifttt to turn on or off a virtual switch in Smartthings, where this switch is part of an automation I have set up.
I have copied the exact component and Arduino code as a starting point, just modifying the code to suit my project. For example, I've changed the webpage to display either 'yes' or 'no' for whether the car is present or not. So it should all be quite simple.
When testing at the computer, I can flash the code to the NodeMCU, and the system works straight away, I can see the requests being sent to webhooks every 2 minutes, my virtual switch updates, so everything looks great. I've let it run for a couple of hours whilst still connected to the computers usb connection, and it seems to work fine.
Now here's where the issues arise (and probably my newbie stupidness). My end goal is to power this via a wall socket on the ceiling of the garage. Once I use a 5v phone charger connected to the NodeMCU's micro USB port, the system will only run once (send one request to webhooks), and that's it. Therefore doesn't send new requests to webhooks, and therefore not update my virtual switch. If I then go back and plug it in at the computer, it works as it should, sending regular requests to webhooks etc.
So what an I missing here? Any help would be greatly appreciated. I'm get the code uploaded as I'm sure it could be streamlined by the pros