I have one cable on GPIO25, which is physical pin labeled “25” on this board as far as I understand, and the other on GND (pin mode is then set to “pullup”).
With the below YAML I expected to see “ON” “OFF” events when bringing the Reed sensor near a magnet. But I’m not seeing anything in the logs. I do see the wifi_signal sensor value, uptime as well, so logs are working, it’s just the reed sensor which does not want to work.
If anyone has an idea what I’m doing wrong, let me know. I suspect my cabling or my pin is wrong, but I can’t see it at the moment.
Thanks, I did just that, and it works, I get readings. So it’s the sensor itself. But I just bought it, this seems strange. I’ll get a multimeter and test it.
You know what they make reed switches with, right? Its just a little bity and sometimes glass housing with 2 metal ends inside. They break easy and if those 2 ends are installed just a little too far apart, the magnet wont pull them together and close the circuit.
Sometimes the wires that go into the reed plastic housing, they can break or come desoldered. It may be worth taking a peek inside the case. There isnt much to these sensors.
Some do that, its an option. Some of us like to create and take pride in what we do. We dont all want the same cheap crap that everyone and anyone can buy on Amazon and install it in 30 seconds.
It’s an MK 471B, it’s a solid plastic case, I can look inside but then it will definitely be broken… I think the sensor is pushed inside already attached to the cable and they pour liquid plastic to close it, so the only way would be to yank the cables. I’ll do that once I have my replacement sensor working.
Valid point, but I only have wifi in the basement, there are no other z-wave / zigbee device nearby to extend the mesh to the gas meter. And I would like the sensor to be a little autonomous, so that if HA is down, upgrading, local network issue, the sensor continues to take measurement and uploads them later to HA.
Secondly, the gas meter has a wheel, on one side there is (supposedly) a magnet, which then should pass by the reed sensor every couple of seconds, counting one pulse every 0,01 m3. I imagine i will have to do some tuning to get that working: what happens if the wheel stops turning with the magnet exactly next to the sensor, leaving the sensor as “ON” for an extended amount of time? etc.
I feel it’s more reliable to have an ESP32 – but I do agree it’s probably overkill, I could have settled for something simpler.
Finally, I like the versatility of ESP devices. If I get a heat pump some day (I hope), I can reconvert the ESP32 into something else instead of throwing it away.
Valid points, the wifi ones exist but are way overpriced. And I too have my fair share of overkill esp32’s with less valid arguments. Cant help to still see some humor in a dual core, 4MB flash powered reed sensor though
But I would be interested in a generic recommendation though: in general, what would you recommend for a single sensor, with ability to store values for up to an hour if local network is down, some wireless connectivity (Z-Wave or Wi-Fi for example)?
I fully agree an ESP with 30+ PINs is completely overkill here, but what are the other options out there?
I’m no expert on this, but the first obvious step down would be a ESP8266 based device such as the Wemos D1 mini. But to be honest, I wouldn’t blink an eye to keep using the esp32 if you have it already. You’ll probably find some other uses for it too later on, such as adding bluetooth proxy capability to it, or make a P1 monitor out of it too. It is now future proof.
You dont need a special sensor. This is exactly the type of problem that automations are for. There are conditions you can use that are specifically for the state of wifi connection. So, if wifi.connected = false then you store values in a global variable. Once wifi.connected is True(On) then update the the HA databaae for whatever sensor value youve been storing then reset your global to 0 and report sensor values to HA like normal.
Personally, I think if your not using BT then esp32’s are overkill for most projects. Out of the 50 something esp projects i have around the house, my goto board of choice is the esp8266 d1 mini. Its beyond capable of monitoring sensors or doing run of the mill I/O tasks you typically use for home automation. Its got enough gpios to be useful but not 30+ where 70% of them are wasted.
If you plan on doing more esp projects, i would just stock up on a few variations of d1 mini style and NodeMCU style and use whichever is appropriate for each project and the space you have available to install a project.
The reed sensor is a counter basically, so what I do is I store the daily values locally using - platform: total_daily_energy.
It’s for a gas meter. The gas consumption starts and stops a lot, so it’s difficult to have anything smooth on the real time consumption, hence I think the daily consumption is what I’ll focus on. The real time will be mostly for troubleshooting I think, to check the pulses are correctly measured.
It was one of those flat magnet you can stick on your fridge. On the fridge it felt very strong, but it actually wasn’t strong enough to trigger the reed sensor somehow.
I use a toy with a magnet almost by chance and it immediately started working.
Hi prajuriz,
did you get your project running in the end?
Mind sharing your code?
Would be great as I just started thinking about something to read my gasmeter.
Thank you!