So I have never used esp anything let alone esphome… For my first attempt, I intend on making a wirelessly controlled key fob for my car (They disabled the 3g modem last year)
So I am just curious if this yaml config looks okay or not… My intention is to have the esp8266 listen to an MQTT server and when it sees a topic change, perform said action…
I have broken apart a fob and soldered wires onto the push buttons. I intend to connect the wires to the esp gpio when I get it and hopefully this program will take care of business.
Note – the signal required for the push button is a logical low.
Apart from that and the missing base config (esp_home: and esp32: or esp8266 section, and the network config which I assume you left out on purpose?) this looks like a good start.
Thanks for taking a look! Kinda wish I could use the editor in esphome without the device but I’ll have it soon.
I’ll fix the indents & you would be correct, I left those out (wifi and chipset info) on purpose - I’m pretty sure esphome fills that in when I first pair the device
Thanks again!
Chris
–correction… you can add a device in esphome for coding without having the device – I didnt even try, only watched videos lol
So after adding it to the dashboard (still without the device) I found a bunch of things that needed tweaking / removing… anyways, here’s the updated code – had lots of indent issues apparently, struggled with the mqtt.publish indentation =P
Also, here’s the test stage of the fob – all the wires are just soldered to the output side of the push buttons and the ground is attached to the negative of the battery
Well, finally got all my pieces… Wired up a dev board and deployed the program. Everything works well and the MQTT messages I had setup were irrelevant. All I needed was the switch / buttons and I send my commands via Home Assistant. This weekend I will switch to a D1 Mini and solder all my connections to a blank PCB board.
If anyone has a recommendation on how I can remove the switches from the yaml config, I’d love to hear about it – Currently I have disabled them in Home Assistant which is fine as well but I feel like its unnecessary coding.
I’m looking to do something very similar but with a household alarm remote. Would it be possible to go into a little more detail about the hardware side of things? Some closeup picts of the wiring would be really helpful if you could get them. I promise I’ll post a writeup when I get my setup working for other to see as well.
Unfortunately, I do not have any pictures from where the fob was opened and where I soldered the wires. However, the process was fairly simple… I know which button performs which action and I used a multimeter to ohm out the connection terminals on the microswitch. Once I knew how the switch itself functioned, I identified the input side and the output side of the switch. In my case, the negative from the battery was on one side of the micro switch. — I only did this for 3 buttons (Lock / Unlock / Start – omitted trunk and panic)
I have 5 wires going into the fob from the esp module:
– 3v / ground / lock / unlock / start
I removed the battery altogether and have the esp module supply power only when I send a command (this keeps anyone from being able to drive the car since I leave the fob hidden inside)
The esp module sends a low output for each wire (since that is what the keyfob looks for)
Once the output is toggled, it completes the circuit on the fob as if I actually pressed the button.
Here is the current code I have setup in espHome for reference
I’m sure I can clean it up some more but I am satisfied… and the only reason for the static address stuff was because I wanted to be able to remotely access the optional built in webpage… It didn’t work since the hotspot wouldn’t let me forward ports =( – oh well, MQTT always works =]
Hey- did you ever get this working? I’m trying to do this with the same keyfob which is used for my F-150. Wondering which pins you used on the buttons when soldering wires to them.
Yeah, it works great. I would change a couple things if I was starting from scratch though.
Wire the trunk opener / closer
Add a wire to the status LED (green flash - remote start worked / red - failed) Then I could repeat the command if it failed
Anyways, to answer you question specifically… I do not know which pins you will require. I used a multimeter to follow the circuits. I checked with the Ohm Meter and also checked for DC voltage under different states (button pressed / released) Multimeters are fairly inexpensive and have a rather small learning curve. I would highly suggest investing in one and taking a little time to get acquainted with it.
ended up getting it working this morning. used your advice with the multimeter and learned how the switch worked. copied your code… didn’t know you had to keep 3.3v to the switches until pressed.