This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Watermeter app

Homey_LampjeHomey_Lampje Member
edited March 2017 in Developers
I have build my own Homey Watermeter app... My app shows the watermeter its reading in m3 liters, the water flow in l/min and the daily usage in liters. As Homey only supports the capability "meter_water" with units m3 my flow and daily water usage reading showup as m3 liters which they are not... see photos for what I mean.

If someone knows a trick to change this please let me know.



Comments

  • TedTolboomTedTolboom Member
    edited March 2017
    @Homey_Lampje Nice! Which sensor are you using?

    You can create your own custom capability for "water_flow" and "water_usage".
    I made some additional custom capabilities for the Z-wave Neo Power plug for current and voltage:
    "capabilities": {
    	"measure_current": {
    		"type": "number",
    		"title": {
    			"en": "Current",
    			"nl": "Stroom"
    		},
    		"units": {
    			"en": "A"
    		},
    		"desc": {
    			"en": "Electric current(A)",
    			"nl": "Elektrische stroom (A)"
    		},
    		"chartType": "stepLine",
    		"decimals": 2,
    		"getable": true,
    		"setable": false
    	},
    	"measure_voltage": {
    		"type": "number",
    		"title": {
    			"en": "Voltage",
    			"nl": "Spanning"
    		},
    		"units": {
    			"en": "V"
    		},
    		"desc": {
    			"en": "Voltage (V)",
    			"nl": "Spanning (V)"
    		},
    		"chartType": "stepLine",
    		"decimals": 0,
    		"getable": true,
    		"setable": false
    	}
    },
    
    And define your own mobile card combining these capabilities on one card:

    And the code in app.json:
    "mobile": {
    	"components": [{
    			"id": "icon",
    			"capabilities": ["onoff"]
    		},
    		{
    			"id": "sensor",
    			"capabilities": ["meter_power", "measure_power", "measure_current", "measure_voltage"],
    			"options": {
    				"icons": {
    					"measure_current": "/drivers/NAS-WR01ZE/assets/measure_current.svg",
    					"measure_voltage": "/drivers/NAS-WR01ZE/assets/measure_voltage.svg",
    					"measure_power": "/drivers/NAS-WR01ZE/assets/measure_power.svg"
    				}
    			}
    		},
    		{
    			"id": "toggle",
    			"capabilities": ["onoff"]
    		}
    	]
    
    In the meantime, these capabilities are standardized by Athom, after creating an issue / Pull Request on: https://github.com/athombv/node-homey-lib

    Should work also for the watermeter.
  • @TedTolboom Thanks.

    My watermeter is a Sensus 620 with a pulse sensor (HRI) attached. For every liter of water used the HRI gives me a pulse, which I feed into a Wemos D1 Mini (arduino). In my adruino sketch I do the pulse counting and water flow computation, the result is sent as a kind of "DSMR P1 telegram" to Homey over WiFi. 

    This morning when I woke up I thought wait a minute... custom capabilities... that should do the trick. Well you confirm this great, thanks for the code snippet as well as the link to GitHub. I will go to work right away :-)

  • @TedTolboom that worked out okay... thanks for your help.


  • Nice!.
    Would recommend to add the device icon to increase device recognition; although most houses don't have more than 1 water meter.

    Will be looking into this solution to add an overall energy meter (watched your other topic) as well as water meter to my Homey (without Energylink)  ;)
  • Homey_LampjeHomey_Lampje Member
    edited March 2017
    ...."the device icon".... uuuuh, where can I find these Homey device icons? I have changed the waterdrop icon into a "real" watermeter icon, looks great I think. I am still seeking for a better looking icon for "Doorstroming" and "Dagtotaal".


  • You will need to create and define the device icons yourself...
    "images": {
           "large": "/drivers/NAS-PD01ZE/assets/images/large.jpg",
    "small": "/drivers/NAS-PD01ZE/assets/images/small.jpg"
    },
    More info: https://developers.athom.com/library/introduction/

    On the icons; are there standard symbols (like SI) you can add to the current icons like I did with the current, voltage in the example above? A flow symbol for the "Doorstroming" and Sigma for "Dagtotaal"?
  • @TedTolboom You are referring to the JSON for the device images in the app store.

    @Homey_Lampje To add the device icon to a custom mobile card you'll need to add
    "mobile": {
                "components": [
                    {
                        "id": "icon"
                    },
    ...
  • RamonBaas said:
    @TedTolboom You are referring to the JSON for the device images in the app store.
    Damn... still too early on a Sunday morning... you're right.
  • Homey_LampjeHomey_Lampje Member
    edited March 2017
    @TedTolboom @RamonBaas both thanks for the clarification... I was wondering where "large.jpg" and "small.jpg" where used for... well that is also clear now.

    Yesterday I played around with the icons... I am satisfied, see below for some screenshot of the app. 








  • Sorry to give this a bump, but did you ever release the app? Or at least published the source files for both ESP8266 and Homey App?

    I have the same setup with HRI pulssensor, would love to use your app.
  • @RNLDNKP I did not... The Homey water app "I made" is a modified version of Ramon Baas his dsmr.p1 Homey app... this means that I at least have to ask Ramon what he thinks of your request. If Ramon is okay I can PM you the files for Homey and Arduino and/or even publish the files "as is" without any support or whatsoever here on the forum.

    @RamonBaas please leave your thoughts...
  • @Homey_Lampje Sure, no problem. As long as I can submit a PR to add support for my Elster PR6.
  • @RamonBaas :-) will do no further development on the water app.... @RNLDNKP sorry.


  • Bummer  :( Looks really nice, you even thought of the 'start value'. Have to figure something out myself then :/
  • @RamonBaas took a closer look at the Elster PR6 datasheet... if this Elster PR6 sensor has an open collector output it should be able to make use of my Arduino sketch... and in that case the Homey Water App will work also for the Elster PR6 without adaptations.

    Suggestion... I provide you (Ramon) with the Water app + ESP8266 sketch you figure out if it works with your Elster PR6 and if it does... please make Ronald @RNLDNKP happy :-)

    Kind regards,
    Peter
  • @Homey_Lampje I use a Arduino nano myself (I prefer to use wired interfaces over wireless). But in the end it is all based on simple pulses.

    Why not just publish your code on GitHub with the explicit mention that it is unsupported (and don't add an issues page)? Then maybe at some point I can fork it.
  • @RamonBaas I did not publish it on GitHub because it is more or less your code (Homey Dutch Smart Meter app)... If you are fine with publishing my Homey Watermeter App on GitHub I can do that. You are fine with me publishing the app on GitHub?
  • Homey_LampjeHomey_Lampje Member
    edited October 2017
    @RamonBaas @RNLDNKP Water App is available on GitHub (no support is given, use at own risk etc etc.).

    https://github.com/PeterEIER/nl.water.hri

    https://github.com/PeterEIER/nl.water.hri.esp8266
  • The hardware... an ESP8266 and open-collector interface (using a 10k pull-up resistor to 3.3VDC). 


  • Man this is awesome! This was so easy to put together and implement. Many thanks you both :) 

    I used an ESP8266 (NodeMCU). For now it's on a breadboard with some jumpers wires and 10K resistor. 
    Even added two leds to indicate a Puls (from HRI) and Data (to Homey). The Data-led also blinks after a reboot telling me it's trying to connect to my Wifi. 

    Whoever owns a Homewizard/Energylink/HRI combo and wants to get rid of it, this is it. Use this (with your HRI) for your water meter and you can use a YouLess for your energy.

  • @rnldnkp

    can you make a picture and a short discription how you managed it. Do i need to load a script in the 8266?

    Thanks in advance

  • @connect the pictures posted by Homey_Lampje show exactly what you need, how to connect and tell what to do. Look at the chip, it's an ESP8266 ;)

    If you do not know how to use an ESP8266 (or Arduino-a-like) I suggest you look in to that first. Will save you (and us) a hell of a job.

    Next you would figure out what a .ino file is, which you might have noticed in the links provided.
  •  Thank you for the explanation.   I have just a little bit Experian's whit the ESP8266 via Domoticz  You mentioned that you did use the ESP8266 (NodeMCU). Whit 2  leds for the pulsing and communication Homey so you have a different unit than Homey_Lampje. I like always when something is visual monitoring so therefore my question about a picture how you did it whit the leds. I will study everything and give it a try the ESP8266 is not so expensive Let you know when I succeeded. Thanks for helping the forum is super.   Greetings Ruud

  • Started working on a SDK2 compatible version...
  • Homey_LampjeHomey_Lampje Member
    edited March 2018
    SDK2 compatible version is now available on GitHub ready for a testdrive...

    Cosmetic updates, trigger flowcards for water meter m3 value / water flow change available.


    https://github.com/PeterEIER/nl.tools.waterverbruik

  • Thanks for sharing, although I had way to much issues with the (okt 2017) Arduino code. Too many reboots for a public (read: App Store) release anyhow. Might had to do with my setup, wasn't that stable in short :)

    So I decided to create a whole new piece of code which uses the HomeyDuino app/SDK. This also spares some precious memory for yet another app.

    Runs for about 2 months now I guess, without any issues. 

    I will cleanup my code a bit, document my flows and share it on my GitHub soon.
    A shame there's no store compatibility for HomeyDuino 'Apps' ;)
  • The Arduino code you are referring too is running 100% stable for over 6 months in my house... a good power supply sometimes helps...
  • RNLDNKPRNLDNKP Member
    edited March 2018
    Sorry to tell , but it was reproducible without even a separate power supply. It just crashed the nodemcu/ESP8266 when there are to many pulses.

    Did even try to fix the errors I traced which made it stable for like a week. Then sometimes the telnet session got interrupted or WiFi got messed up. Homey couldn’t connect... (and it’s not the WiFi)

    But no worries, as said it might have been based on my setup and some code changes. Have tons of arduino based boards, bits and parts lying around so that’s not the problem ;)

    I encourage anyone to try your app and arduino code, I do believe it can work just fine!

    Currently I do not have to rely on a telegram message or telnet session with homey and there’s two way traffic. I liked this concept so much I decided to not try and fix the (altered) code I already greatfully used thanks to you guys :)

    You can combine functions related to each other in one arduino app without rewriting a Athom app. This goes beyond a water meter.

    Keep the water flowing!
  • For anyone looking for an alternative solution: I have the youless ls120 (79 euro) configured to read my smart meter (electricity and gas) and the watermeter. Check the forum here for more info https://forum.athom.com/discussion/2779
Sign In or Register to comment.