Homey
  • Homey Automations
  • Aggregated state
    • Person presence
      • Geofency and webhooks
    • Home state
    • Room and floor presence v2
    • Room and floor presence v1
    • Time table
    • Dark or bright
    • TV
    • Ventilation
      • CO2
      • Humidity bathrooms
  • Lighting
    • Scenes
    • Scene activations
  • Rooms
    • Childrens room
    • Guest room
    • Bathrooms
  • Advanced API usage
    • Getting a bearer token
  • Battery
    • Battery tracking
  • Custom integrations
    • Influxdb and Grafana
    • Flexit ventilation
    • Water metering
    • Telia data plan
    • Trondheim folkebibliotek
    • SBanken
    • Badetemperatur
    • Is it rainy? (yr.no)
  • Music
    • Music
  • Voice
    • Setup
    • Overview
Powered by GitBook
On this page
  • Choosing the correct water meter
  • Reading the pulse

Was this helpful?

  1. Custom integrations

Water metering

PreviousFlexit ventilationNextTelia data plan

Last updated 5 years ago

Was this helpful?

Works in progress! I'm not done with migrating this setup to Homey yet!

This article describes the setup of digitally measuring water usage, using a tessel.io microcontroller.

Choosing the correct water meter

You are not allowed to install a water meter yourself. In dialog with the waterworks, ro replace or install a water meter you need to ask for a water meter that can support digital readings.

In Trondheim, Norway, delivers the water meters allowed to be installed.

In dialoge with Øwre-Johnsen as, I ended up installing . In addition I ordered and installed the . This one you can install your self.

Reading the pulse

The Falcon PR6 contains a battery and gives a digital impulse every liter user detected. Connect the black wire to GND and the yellow to one of the numbered PINs.

Here is a class to read the pulse indicating one liter used.

const  
  EventEmitter = require('events'),
  tessel = require('tessel')

const pin = tessel.port.A.pin[4]

class PulseReader extends EventEmitter {  
  constructor() {
    super()
    this.previous = false
    setInterval(() => {
      this.read()
    }, 50) // Read impulse every 50 ms
  }

  // Give a short blue LED blink to signal that an pulse is detected.
  blink() {
    blue.on()
    setTimeout(function () {
      blue.off()
    }, 100);
  }

  read() {
    pin.read((error, value) => {
      if (error) {
        console.error("Error reading analog input: " + error)
        return
      }
      let val = (value === 0)

      // Emit a value event every time a digital pulse is detected
      // Will discard all subsequent readins from the same pulse
      if (val && val !== this.previous) {
        this.emit('value', true)
        this.blink()
      }
      this.previous = val
    })
  }
}

module.exports = PulseReader

It can be used like this:

let d = new Database()  
let p = new PulseReader()

p.on('value', (value) => {  
  d.post(1)
})

I chose to use a microcontroller, because it has both analog and digital gpio ports that is very easy to interact with using javascript.

And when/if you order a Tessel 2, remember to also order a set of that fits.

tessel.io
jumper wires
Øwre-Johnsen as
Elster V200 (KVM-T)
Falcon PR6 pulse module