Next step is,. I want to see in my Hass.io states window if the door is open or closed.
The device is sending a pulse when the magnet passes the Reed sensor, so not a really on/off.
So on the first signal, you can assume that its open, after the second signal you can assume that it’s closed.
How to translate that to a visual item in Hass.io ? (it is not controllable from HA)
A better solution would be to take IFTTT out of the equation, but no idea how to do that
I’ve been looking at that Instructable for a while now and of course it’s on the list, lol
I think I would flash with ESPEASY and use MQTT to send the on/off triggers to HA.
This would eliminate IFTTT.
A sensor needs to be set up in HA to receive the MQTT command, here’s an example
If you can make IFTTT work, then you should have no problem creating your own devices. (I hate IFTTT- a Rube-Goldberg solution if there ever was one).
I have some ESP8266-01 devices around the house with temperature sensors, with either a DHT22 or DS18b20 (which is more accurate). They all publish their state over MQTT periodically or when triggered by a command message. I don’t see any reason that an open/close state couldn’t be done just as easy.
If you don’t understand any of what I said above, then this is the perfect project for you to get proficient with the ESP series of controllers, MQTT and programming using the Arduino IDE. And it will open a huge source of device ideas for you.
The price is incredibly cheap. The ESP8266-01 modules are about a dollar each. In fact the most expensive part of the project is the power supply. For beginners, I would use the NodeMCU module because you can develop and test your code with just a USB connection, then later port it to the ESP8266-01 when you have more confidence.
Every step is advanced until we learn a little more. Just break it down into it’s parts. I would start by getting MQTT to work in HA. Once you have the configuration setup for MQTT in HA & a sensor defined, download a tool like MQTT FX so you can publish & subscribe to topics.
When you have that working you can change your ESP8266 device to start publishing. Again you can use MQTT FX to see the transactions that it’s publishing. If you are lucky and type them the same in both places you’ll see values being updated in HA. If not make sure you spell them the same in both places, double check the slashes, lol
.
Thanks for the replies, I will dive in the deep and try to learn as much as possible.
every advice where to start is appreciated.
Eager to learn but such little time to do it in
A year ago I had never heard of Node-Red, MQTT or Home Assistant. Now I know enough to be dangerous, because I still don’t really know what I am doing.
Really, if you want to do this just for the experience of learning, buy a couple of NodeMCU kits to get started. One of these boards and the free Arduino IDE is all you need to start.
If you really want to dive in, buy any of the “arduino starter kits” on Amazon. You’ll get a breadboard, jumper wires, a few resistors and leds, plus a few sensors. While the title may say “Arduino”, and the Arduino Uno board is the “standard” (also cheap and worth buying one), all the parts will work on the nodeMCU.
Why am I recommending you start with the NodeMCU instead of the Uno? Simple, since you are interested in MQTT, you need WiFi. The Uno doesn’t have WiFi hardware but the NodeMCU does.
Once you start, you will be surprised how quickly things just start making sense. Oh, a tip: Keep a notebook. It sounds old-fashioned, but I can’t count the number of times I referred back to an early experiment to remember “oh, that’s how I did it…”. But I’m old and I already forgot what I was writing about.