Coder Social home page Coder Social logo

homie-watermeter's Introduction

homie-watermeter

esp8266/mqtt watermeter using homie platform

Objective

Enable read-out of the water meter to get measurement of this meter in OpenHAB using mqtt messages.

Tools used

  • ESP8266 dev board (Wemos D1 mini)
  • Homie-esp8266 framework / platformIO
  • TCRT5000 reflection sensor
  • OpenHAB script for persistence

OpenHAB Setup

items

// receive count from mqtt on intermediate tag; OpenHAB Rule will perform filter/log to update to total
// OR reset the instrument to previous value if it was restarted

Number WaterMeter_TotalReceived  "Water Total Received[%d l]" <water> () {mqtt="<[mosquitto:homie/600194100ff2/watertotal/total:state:default]"}
Number WaterMeter_Total  "Water Total [%d l]"    <water>  (Utilities, Water, F0_MeterCupboard)
Number WaterMeter_Flow   "Water Flow [%.1f l/m]" <water>  (Utilities, Water, F0_MeterCupboard) {mqtt="<[mosquitto:homie/600194100ff2/waterflow/flow:state:default]"}

Number WaterMeter_Uptime "Water Uptime [%d s]"   <water>  (Utilities, Water, F0_MeterCupboard) {mqtt="<[mosquitto:homie/600194100ff2/$stats/uptime:state:default]"}

rules

/* rules to handle the home water counter */

rule "Handle water meter update"
when
        Item WaterMeter_TotalReceived received update
then
        if (WaterMeter_TotalReceived.state < 1000) {
                // set last value to the water meter if it was reset to zero after powerup
                // -- allow for max 1m3 of pulses during startup
                publish("mosquitto","homie/600194100ff2/watertotal/total/set", WaterMeter_Total.state.toString)
        } else {
                postUpdate(WaterMeter_Total, WaterMeter_TotalReceived.state)
        }
end

Tips

Adjust/reset counter by updating the counter device: $mosquitto_pub -t homie/600194100ff2/watertotal/total/set -m 1234567

... script

Schematic

Schematic

Pictures

Water Meter without the sensor: Water Meter

Top view of the sensor board: Board top side

Bottom view of the sensor board: Board back side

Water Meter with the sensor installed: Water Meter with sensor

homie-watermeter's People

Contributors

fvdpol avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.