Skip to content

alekseyn1/WaterSensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home Assistant MQTT Battery Operated Wireless Water Sensor

Inspired by the work of

I was looking around for a while for a sensor that would be

  • battery operated
  • wireless
  • small
  • with battery life from one year
  • would use MQTT

and found nothing.

I had to come up with something on my own.

Out of the box solutions like Xiaomi sensors were not acceptable since they use an additional hub that I did not know would work on the local level or not (my aim is to keep all smart home traffic within the LAN). Other solutions would either be non-smart with great battery life of be smart with a very short battery life (a couple of months).

Then I ran into Rob's (The Hookup) window sensor - https://www.youtube.com/watch?v=BoYVr2UwWWg I immediately tried his setup but instead of the reed switch I was hoping to use water to complete the cirquit. No luck. Water is not a good conductor in this case. So I had to look elsewhere. But I took his code for ESP-01 and modified it slightly ("on/off" instead of "open/close" although this modificatin might not be required).

I found a few circuits that could work for my purpose but I do not have enouth electronics knowledge to check if they are functional.

Source - https://www.instructables.com/id/Simple-Water-Sensor/

Then I ran into Peter Jennings' work on his water sensor - http://benlo.com/esp8266/esp8266WaterAlarm.html. The switch he used was an answer - https://www.pololu.com/product/2808.

I contacted Peter and he confirmed that in a standby mode the switch was not consuming much at all (official spec says 0.01 micro Amperes).

Here is how you hook up ESP-01 to FTDI:

Then flash it using the ESP-01_Water_Sensor.ino file

Here is the final connection diagram:

ESP-01 code and Home Assistant samples are in the files of this repository.

Here is the video with the final look of the sensor. https://www.youtube.com/watch?v=JGjHACm81ME

Watch the video

So, the end result works like this: once water is closing the sensor probes (basically two wires sticking out), the switch turns on ESP-01 and ESP-01 boots up and sends an MQTT message with 'on' to a topic and then goes into a deep sleep. The whole process takes about 3 seconds in my case. All other actions are triggered in Home Assistant using automations and scripts.

In my setup, Home Assistant will then send a command to the dry contact switch (modified Sonoff) to close the Electric Manipulator Shut Off Valve gizmo that I purchased on Amazon. I retrofitted a polarity switch and power input jack.

Here is the video with the valve setup. https://www.youtube.com/watch?v=RAxCV2L04LM

Watch the video

About

MQTT water sensor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages