• Stars
    star
    312
  • Rank 134,133 (Top 3 %)
  • Language
    C++
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WiFi device to announce the presence of a car for garage door automation

MQTTCarPresense

This project utilizes a WeMos D1 mini Pro, u.FL to SMA antenna whip, and an external antenna in a 3D-printed enclosure to indicate presense when powered on and attached to MQTT.

MQTTCarPresense

The included Arduino code is setup to work with Home Assistant MQTT Discovery to automatically create a binary_sensor device which will indicate the connection status of the device. The device should be powered from your car's ignition so it's only on when the car is running. When the device powers on, it will attempt to connect to the defined MQTT broker, publishes a discovery message, and configures a Last Will and Testament. When the device is powered off (or you drive out of WiFi range), the Last Will and Testament is sent by your broker to update subscribed automation system(s).

The included Home Assistant blueprint automation example utilizes this information to open or close a connected garage door. Just copy the file url into the blueprint import menu and create an automation using the blueprint!

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Workflow - User perspective

  • Car is in your garage and the garage door is closed
  • You get in the car and turn it on, the garage door opens
  • You drive away, the garage door closes a minute later
  • When you arrive back home, the garage door opens as you approach
  • When you turn off your car, the garage door closes about a minute later

Detailed workflow

  • Car is powered off, garage door is closed
  • Car turns on, device publishes connection message to MQTT
  • Home automation platform sees that the garage door is closed and the device is connected, then sends command to open garage
  • You drive away when ready
  • Device eventually drives out of range, dropping connection with the broker
  • MQTT broker sends disconnection message configured as the LWT
  • Home automation platform sees the garage door is open and the device has disconnected, then sends command to close garage
  • You go on about your day, then return home.
  • Device connects to WiFi, then MQTT and publishes connection message
  • Home automation platform sees that the garage door is closed and the device is connected, then sends command to open garage
  • You park your car and turn it off, dropping connection with the broker
  • MQTT broker sends disconnection message configured as the LWT
  • Home automation platform sees the garage door is open and the device has disconnected, then sends command to close garage

Bill of Materials

  • WeMos D1 mini Pro
  • u.FL to SMA antenna whip
  • External 2.4GHz WiFi antenna
  • M3x8mm socket head cap screw (or similar)
  • M3x4x6 threaded insert (or similar)

Arduino programming

The first order of business will be to setup the Arduino IDE to flash the provided Arduino sketch to the ESP8266. Download the IDE for your platform and follow these instructions to add support for the ESP8266 platform.

Next you will need to add the PubSubClient library for MQTT. Follow this guide for the general process and add the 'PubSubClient' from the Library Manager.

At the top of the Arduino sketch are several fields you must modify to fit your environment (WiFi details, MQTT broker IP, node name, etc). Once those fields have been set you can upload to your microcontroller and monitor sensor status in Home Assistant.

WARNING:

If you will be deploying more than one of these devices you must change the node names to be unique. Failure to do so will result in a cascading series of MQTT connections/disconnections as your devices compete for access to your broker.

WeMos D1 Mini Pro Antenna

In order to utilize an external antenna on the WeMos D1 Mini Pro, you will need to move a 0 ohm 0603 SMT resistor. See this blog post along with an accompanying video on how to make that happen. A hot-air station will make this easier, but I was able to do this with a normal pencil iron.

Tasmota Firmware Variant

If you are more familiar to Tasmota flashing and usage rather than Arduino Programming and building, this is another variant that you could use. It will replace the Arduino Programming section above, but follows the guidelines of just about everything else. The blueprint that is attached to this project named MQTT_Tasmota_CarPresence.yaml can be used as an alternate along with flashing the Di-Mini with Tasmota to accomplish the same thing as the original.

This Tasmota Variant is set-up to work with Home Assistant Tasmota Integration to automatically create a switch which will indicate the connection status of the Car Presence Device. It should show up as a switch with a name that matches the FriendlyName set-up in the Tasmota Web Console.

Follow these steps to flash the D1 Mini if using Tasmota:

  • Flash the D1 Mini to the latest Tasmota version.
  • Set up your WIFI, MQTT, Hostname, Friendly name, and all the normal stuff. Details on the Tasmota homepage.
  • Set the Device module to type generic(18).
  • Under configure module,
    • set GPIO2 as LEDi 1
    • set GPIO4 as Button 1
    • set GPIO5 as Relay 1
  • On the console, paste this to set-up the mcu functions as required for proper operation (Check Tasmota website for details on what these are):
    • Backlog SO19 0; SO56 1; SO63 1; SO65 1; WifiConfig 5
  • Go to Configure Other and be sure to set a Web Admin Password in case it goes into AP mode when you are away from Home.
  • Set-up the blueprint MQTT_Tasmota_CarPresence.yaml similar to the instructions for the other blueprint above.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Buy me a coffee

Buy me a coffee

This project is powered by coffee. I might get a little weird about it at times, but it's not much of a stretch to suggest that coffee both powers and consumes a fair portion of my mental energy. Hook me up if you think HASP is cool. Thanks!

More Repositories

1

HASwitchPlate

LCD touchscreen for Home Automation
C++
732
star
2

DDD-Printable-Wall-Control-System

DDD Printable Wall Control System, 3d printable organization solutions for Wall Control pegboards
343
star
3

RoastLearner

Machine learning audio classification engine for Artisan
Batchfile
20
star
4

SmartThings

Scripts and tools for SmartThings
Groovy
17
star
5

NeverNotNumlock

NUMLOCK IS THE DUMBEST KEY AND I HATE IT AND NOW I HAVE DONE SOMETHING ABOUT IT
C++
13
star
6

Get-PrusaFwDevEnv

A script which will download all the required elements to modify and compile the Prusa Mk2 firmware on Windows
PowerShell
13
star
7

IoTWM-ESP8266

Getting started with Arduino and the ESP8266 for IoT development
Arduino
11
star
8

BoseQCMicMute

Control Windows microphone mute with the "action" button on Bose QuietComfort headphones
AutoHotkey
11
star
9

BigTreeTech-SKR-PRO-TFT35-Enclosure

3D printable enclosure for the BigTreeTech SKR Pro v1.2 controller and TFT35 v3.0 touchscreen LCD
8
star
10

Generate-HASP-Fonts

Tools to generate Nextion .ZI fonts used by the HASwitchPlate project
HTML
7
star
11

Fire-HD-10-Tablet-VESA-Mount

3D Printable Fire HD 10 Tablet VESA Mount
6
star
12

RoyalTS

Scripts and tools for Royal TS
PowerShell
4
star
13

ac_infinity_bluetooth

Resources for BLW communication with AC Infinity controller units 67/69/70
Java
4
star
14

ESP8266_MQTTPowerButtonControl

ESP8266 MQTT Power Button control
Arduino
3
star
15

Tormek_T-4_Rotating_Base

3D printable rotating base for the Tormek T-4 Sharpening System
2
star
16

VESA-Mount-for-DRO-Arm

100mm x 100mm VESA mount for common DRO mounting arms
1
star
17

OSHWBreakouts

Open Source Hardware Breakout PCBs
1
star
18

Ring_Video_Doorbell_Magnet_Mount

Magnetic mount for the Ring Video Doorbell
1
star
19

OpenTouchScale

Arduino
1
star