Skip to content

Free domestic water leak monitoring with Dragino LWL02 LoRaWAN sensors, Helium, Node-RED and Twilio.

License

Notifications You must be signed in to change notification settings

belodetek/red-alert

Repository files navigation

red-alert

🐳 low-code open source water leak monitoring with Helium & LoRaWAN - get SMS alerts when water leaks, where it shouldn't..

try it

Technically, balenaCloud/balenaOS isn't required, but it's free for the first ten devices and makes things so much easier; alternatively, any Linux machine with dockerd and compose tooling installed could be used, but then you'd have to sort out SSL certs, SSH auth, etc.

required software and hardware:

check prerequisites

  • procure up to ten LW02 sensors
  • sign-up to balenaCloud
  • start a free trial (~ $15) with Twilio and generate API keys
  • subscribe to Helium Foundation Console (10 devices and ~ 250 DCs free) and generate your API key
  • in the console, create a new MQTT integration to the free HiveMQ broker image

deploy

(e.g.) Node-RED on a balenaFin, which is a CM3 based SBC

$ set -a

$ fleet=red-alert
$ dt=fincm3

$ git clone https://github.com/belodetek/red-alert.git \
  && cd pushd red-alert

$ balena login

$ balena fleet create $fleet --type $dt

$ helium_org_id=$(curl https://console.helium.com/api/v1/organization \
  -H 'Key: {{ helium-api-key }}' | jq -r .id)

$ balena env add __NODE_RED_BACKUP_EXPORT_JSON__ "$(cat < node-red.json.tmpl | envsubst)"
  --fleet $fleet
  
$ balena env add TWILIO_ACCOUNT_SID '{{ your-account-sid }}'
  --fleet $fleet

$ balena env add TWILIO_AUTH_TOKEN '{{ your-auth-token }}'
  --fleet $fleet

$ balena env add TWILIO_MESSAGING_SERVICE_SID '{{ your-service-sid }}'
  --fleet $fleet

$ balena env add SMS_ALERT_RCPT_TO '{{ your-cell-number }}'
  --fleet $fleet

$ balena push $fleet

$ balena os download $dt \
  --output balena.img \
  --version latest

$ balena os configure balena.img \
  --fleet $fleet \
  --device-type $dt
  
# flash appropriate SBC media (i.e. SD card or eMMC) and plug it all in
$ balena local flash balena.img

# (e.g.) first device only; will also show up in the balenaCloud dashboard 
$ host=$(sudo balena scan --json | jq -r .[0].host)

$ balena device public-url ${host/.local/} --enable

$ uuid=$(balena device ${host/.local/} | grep UUID: | cut -c24-)

# browser window will take you to your Node-RED dashboard
$ open https://${uuid}.balena-devices.com

testing/operating

  • register your sensors with Helium Foundation Console
  • install sensors strategically around water egress areas around your dwelling
  • tag/label you sensor devices and link them with the integration image
  • watch your device logs (Node-RED stdout) to see MQTT messages from HiveMQ (during registration and once every ~ 24h)
  • adjust the code to suit your specifc requirements
  • export and store it in __NODE_RED_BACKUP_EXPORT_JSON__ balenaCloud fleet env. var. as a compact JSON for a stateless configuration

next steps

  • transfer a used Helium miner off your local marketplace to your wallet, so you don't have to pay for Helium DCs in the long run

😬👍

About

Free domestic water leak monitoring with Dragino LWL02 LoRaWAN sensors, Helium, Node-RED and Twilio.

Resources

License

Stars

Watchers

Forks

Packages

No packages published