Hello everyone … I would like to apply a magnetic sensor to detect if the automatic gate (iron) closes or if it remains open (since sometimes I find it open when I return home …grrr) and then let me notify sensor status on the cell … my doubt is: which magnetic contact sensor could I use considering that it will be outside and therefore must be waterproof and manageable by homeassistant?
thank you all!!
thank you so much Tom!! … could you help me explaining exactly how and what you did? I’m a real beginner
Bit more info here:
the power supply is not a problem … recovery from the line that feeds the gate motor … what I can not do is how to use the various tools that I need and how to implement them on hass.io
Well to start with have a read of the getting started and GPIO binary sensor here:
Using a simple YAML config file you can build a wifi sensor using an ESP board. With the (default) discovery enabled you don’t even have to configure anything in Home assistant for the switches or sensors to show up.
Example config file:
esphomeyaml:
name: lane_gate
platform: ESP32
board: nodemcu-32s
wifi:
ssid: 'WAPDI'
password: !secret wifi_pwd
manual_ip:
static_ip: 10.1.1.80
gateway: 10.1.1.1
subnet: 255.255.255.0
mqtt: ### using the api: method you dont even need this mqtt broker bit
broker: '10.1.1.100'
username: !secret mqtt_usr
password: !secret mqtt_pwd
logger:
level: WARN
ota:
password: !secret esp_pwd
deep_sleep:
run_duration: 2min
sleep_duration: 720min
wakeup_pin_mode: INVERT_WAKEUP
wakeup_pin: GPIO12
sensor:
- platform: wifi_signal
name: "Laneway Gate WiFi Signal"
update_interval: 4s
filters:
- sliding_window_moving_average:
window_size: 15
send_every: 15
- platform: adc
pin: GPIO36
name: "Laneway Gate Battery"
attenuation: 6db
unit_of_measurement: "V"
update_interval: 4s
filters:
- multiply: 1.88
- sliding_window_moving_average:
window_size: 15
send_every: 15
binary_sensor:
- platform: status
name: "Laneway Gate Status"
- platform: gpio
pin:
number: GPIO25
name: "Laneway Gate"
device_class: door
filters:
- delayed_on: 100ms
- delayed_off: 10s
- platform: gpio
pin:
number: 12
mode: INPUT_PULLDOWN
name: "Laneway Gate Wake Pin"
ok … I’m not practical to esphome (I have several sonoff with tasmota and some nodeMCU with espeasy) but I do not think it’s a problem … what material do I have to get?
- A Wemos D1 mini ESP2866 board or NodeMCU-32S board (more inputs and better deep sleep but not needed for this project as you have power available and we only need one input)
- A ME-8166 limit switch (ebay)
- A suitable water resistant enclosure, a cable gland (GN12) and outdoor cat5 cable or similar.
What is the power supply to your gate?
I assume you have a programming cable from your tasmota flashing.
OK, perfect! gate supply 220V … yes, to program tasmota I have a FTDI module …
Ok so you’ll need a 220V AC to 5V DC @1A (or 3.3V but these are less common) power supply as well.
ok, so I have to get these things
ESPhome now has API integration with Home Assistant so you don’t actually have to use MQTT anymore.
If you were to use a NodeMCU, you can plug it into your HA server (eg: rPi) via USB and program it directly from a HassIO add-on… Assuming that you are running HassIO… If you are running straight Home Assistant, you won’t have that luxury.
Another good thing about the NodeMCU is that it can be powered by the USB socket so you can simply use a cheap phone charger as the power supply for example. Otherwise, cheap 5v power supplies are easy to come by for hard-wiring into a circuit
I keep forgetting this. So yeah no programming cable required just a USB-A to USB mini cable if running Hassio.
it seems a lot more comfortable even though unfortunately I have no idea how to do it
Are you running HassIO? If so, install the ESPhome add-on, it has a wizard to guide you through flashing the NodeMCU which will make it nice and easy for you
Yes, i have HassIO…do you intend to install from this repository? ( https://esphome.io/guides/getting_started_hassio.html ) …if yes, which of the three add-ons?
Just install the standard version. The others are beta’s
Once installed and you plug the NodeMCU in to the RPi, you may have to restart the add-on to get the device to be detected. I think the wizard might actually tell you this anyway
Hi i am a beginner with esp can you send a link of which module to buy from aliexpress or other .
There are lots of models
If it’s far from your wifi then it’s sometimes handy to get the Wemos D1 mini Pro as it has an external antenna (you do need to move a soldered resistor to enable the external antenna).
Otherwise I generally use these ones because they have mounting holes.
Unfortunately I haven’t yet seen a Pro version with mounting holes, but you just have to figure a way to mount it.