Small binary sensor

Searching the forum and getting all kinds of results except the one I need.

I just need a very small binary sensor. A switch that is NO (Normally Open) and can be closed and gives a signal in home assistant. Of course lots of “expensive” products are available like fibaro universal sensor or just a shelly switch and not use the relay. But these all have 2 things in common: expensive and big.

Is there any cheap ESP8266 available just doing this? I can’t find sensor - input - version, only outputs: Controlling a lamp from tasmota or home assistant to switch on and off a relay. I just need the other way around…

Thanks!

The sarcastic answer is that all you need is an esp unit and two wires that you touch together manually. Or even just one wire that your carefully touch to the right pins.

What exactly are you trying to do and having trouble with? Which type of sensor to buy for your application? How to wire it?

Look at ESPHome. Dead easy to set up, supports a nice simple setup like you want:

Thanks,

@MatthewFlamm What unit? I have a few but find it hard to find out “what” to do.
@Troon Yes, dead easy?, but your link is not for me… What device can I use? How and what pins to use?

FWIW, I an not using an RPI… run on a VM. And the “binary input” is needed for e.g. a doorbell, motion sensor (radar), switch somewhere to activate a scene, etc… I would love to have e.g. a VERY simple PCB like below, but then with a NO (Normally Open) input…

image
(BTW, it took me HOURS to get above working with tasmota thus I an searching for something SIMPLE :slight_smile:

How fast do you need it to react?
Does it have to be battery powered?
What networks do you have (Zwave, Zigbee, Wifi, RF)?

@tom_l
How fast do you need it to react? Direct
Does it have to be battery powered? No
What networks do you have (Zwave, Zigbee, Wifi, RF)? I have all, but prefer wifi or ethernet cabled. -> as said, zwave is expensive and zigbee is also not cheap…

It does not have to be wireless (ethernet is ok)

I think what you’d prefer is a pre packaged option at the cost of diy. I think you need to choose. I’m confused as your picture is clearly a diy unit that would require something like esphome to program, yet you state it is too complex.

If you are willing to figure out esphome, there are these kind of boards you can use to make it an easy screw terminal connection. I don’t know of any that specifically fit an esp board, but this one can be cut in half to fit.

Did you look at that PCB ? The 3 screw terminal, most left is NO, middle is com, right is NC ?

Did you look at frenk’s doorbell ?

1 Like

Yes, i understand that 3-pins is the OUTput of it, That works, but I need INput… and I think there is something in Frenck’s video on pin-2 as input?

So INput can be between GND and GPIO-2?

Yes. That is in frenk’s description. Yaml for esphome is provide too.

Even that doorbell is more complex than @sender is asking for. The relay module is not needed at all: provided you can flash ESPHome onto an ESP8266 device (Wemos D1 Mini is my favourite), it’s just a question of wiring your switch to pull a pin to ground.

Choose the right one and you don’t need any other components: GPIO0 (D3 on the Wemos) is pulled high internally so connect it to ground via the switch and there’s your signal.

The picture of the PCB was posted by sender, which made me think of frenk’s doorbell

My picture was an example. I just want a very simple option…

If I would buy that AZDelivery D1 Mini NodeMcu Parent is it easy to flash with tasmota or do I need to spend hours finding correct pinlayouts, firmware, settings etc. :slight_smile:

You flash it with ESPHome, which has pin definitions that match the board markings. Plenty of other places to get the D1 Mini, that was just an example. Here’s another.

Basically, you write a tiny bit of YAML which ESPHome turns into a specific firmware for the job. Very powerful, resulting in a super-simple interface to HA.

Ok, so small babystep further…

the ESP is now ok in hass sending mqtt via tasmota. Actually it works well.

But now is the biggest BUT. To use the GPIO2 with GND to send a “command” to home assistant I have used a relay to convert the 230V output of a radar sensor to the GPIO2 input. And there it goes wrong…

When powering up all modules see picture, the radar sensor initially immedetaley send out a trip and this triggers the relay and thus… puts GPIO2 to GND and that… yes make the device in flash mode I believe. So by first releasing the relay contact to GPIO2 and then powering up, connecting back I have my functionality…

How can I overcome that? any tips?

I am getting to start to understand why there is not a “cheap brand” with small devices and a “simple” protocol.

Connecting GPIO0 to GND makes a ESP go into flash mode. GPIO2 does not do that.
For normal program execution GPIO0 and GPIO2 need to be pulled up to Vcc (3.3V) and GPIO15 needs to be pulled to GND, each with a resistor in the range 2K to 10K resistor.

image

Please don’t kill yourself or burn your house down.

Haha, no this is just for test, not permanent. Then it will be better. And 230v will not kill me :slight_smile:

Ok, I give up. I am beaten by the GPIO-puzzle. Why is it so freaking hard to have a “simple-cheap-but-working” without, soldering, breaking resistors on prints, “pulling vcc” up with resistors, flashing with tasmota (hell to get it working) and why isn’t there not just a small “like this relay board” working devices easy to operate, easy to understand?

You have chosen the wrong ESP board for the application. The ESP8266-01 has a very limited number of GPIO pins and pulling most of them low at boot will cause issues. Use a Wemos D1 mini board and you will have more GPIO to choose from. GPIO that don’t cause the boot to fail if pulled low when powering up. There is a handy reference table here showing you which are the best pins to use and why:

Also 230V can kill you quite easily. Do not be so flippant. Be extremely careful. One hand behind your back when working with 230V makes it less likely for an accidental shock current to travel past your heart, which can cause fibrillation and death.