Page 1 of 1

All in One NPN Watermeter and P1 Smartmeter

Posted: 19 Aug 2018, 13:53
by sincze
A friend of mine created this nice little board.
1
1
ESP_AIO.jpg (182.25 KiB) Viewed 15123 times

It deals with a (NPN) pulse counter for watermeter and deals with the P1 port of my Smartmeter. The advantage is.. It is now wirelessly accessible. :D


The board was designed to use MySensors, but as this is an ESPEasy forum... I wanted to give it a try.

Main idea is to setup a ser2net server to pass the P1 data on to Domoticz for calculation.

And setup a pulse counter to read my watermeter.

It has the following rules.
Workings:
It just counts every pulse from the watermeter and stores that value in a dummy counter. Every minute the dummy counter data is send to Domoticz. In this way you have flow (amount of liters / minute) as well in domoticz.

Code: Select all

//------------ INITIAL RELEASE
On System#Boot do     							// When the ESP boots, do
   TaskValueSet 4,1,0							// TaskValueSet TASKnr,VARnr,Value, Reset the Liters counter to 0
   TimerSet,1,60      								// Set Timer 1 for the next event in 60 seconds
EndOn
 
On Watermeter#Count do						// When Pulse is detected
	if [Watermeter#Count] > 0
		TaskValueSet 4,1,[Watermeter#Count]		// Set the Pulse to the Liters dummy sensor
	endif
EndOn

on Rules#Timer=1 do  								// When Timer 1 expires, do
	if [Liters#Liters] > 0							// Only send value if amount of Liters > 0 else 'keep the change ;-)'
		SendToHTTP 192.168.2.89,8080,/json.htm?type=command&param=udevice&idx=<youridx>&nvalue=0&svalue=[Liters#Liters]
		TaskValueSet 4,1,0						// TaskValueSet TASKnr,VARnr,Value, Reset submitted Liters counter to 0
	endif
	TimerSet,1,60      							// Set Timer 1 for the next event in 60 seconds
endon
I've setup a pdf with the instructions. But seem unable to add it to this post. If people are interested I can share it.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 20 Aug 2018, 18:37
by MaikelK
Yes, highly interested!

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 20 Aug 2018, 19:14
by sincze
MaikelK wrote: 20 Aug 2018, 18:37 Yes, highly interested!
No problem
Can you send me a PM with your mail. :D
I'll attach it to the email as it seems I am unable upload the document as .pdf unfortunately.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 20 Aug 2018, 19:54
by Jazzle
Nice, interested too!

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 20 Aug 2018, 20:07
by sincze
Jazzle wrote: 20 Aug 2018, 19:54 Nice, interested too!
No problem
Can you send me a PM with your mail. :D
I'll attach it to the email as it seems I am unable upload the document as .pdf unfortunately.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 21 Aug 2018, 08:12
by TD-er
If you like, I can also add it to the wiki as an example project.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 21 Aug 2018, 08:18
by Jazzle
sincze wrote: 20 Aug 2018, 20:07
Jazzle wrote: 20 Aug 2018, 19:54 Nice, interested too!
No problem
Can you send me a PM with your mail. :D
I'll attach it to the email as it seems I am unable upload the document as .pdf unfortunately.
Sorry, did send a pm directly after my post. Now i see it is still in my outbox

my mail address is dijkstra underscore jasper at outlook dot com

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 21 Aug 2018, 11:53
by MaikelK
My Pm is also hanging in the outbox.
If you could send it to maikel underscore Kooij at hotmail dot com that would be nice!

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 15 Sep 2018, 23:48
by andreo
Please send me a copy of your pdf, send you a PM

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 16 Sep 2018, 07:34
by grovkillen
andreo wrote: 15 Sep 2018, 23:48 My PM is also hanging in the outbox.
Please send me a copy of your pdf to oerlemans dot andre AT gmail dot com
They will "hang" there until the recipient has open it. Not logical I know but that's phpBB for ya :)

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 03 Nov 2019, 19:34
by ObiToo
Hi, is it still working well ?
Can you help me with a pdf ?

Kind regards
Hans

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 18 Dec 2019, 15:07
by MarcelM
I use the a NPN sensor with a 8266 Wemos mini d1 to read my watermeter.
The sensor is placed in the watermeterlid.
Sensor see: https://benselectronics.nl/inductieve-p ... ensor-npn/
It works great withe ESPmega.

The NPN sensor needs 6 volts, so i use a 6 volts supply for both 8266 and NPN sensor.
The data signal is devided by 2 by two resistors 10K (data signal must not exceed 3V).
Every minute the pulses are read on GPIO by the ESP task "Generic - Pulse counter"
Each pulse represents one liter.

I need resident counter representing the watermeter counter.
The pulse counter increments the meter counter.

My question: is it possible in ESP mega to have a user variable which survives an ESP reboot?

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 18 Dec 2019, 16:44
by TD-er
As long as the unit remains powered, then you could store the value in a dummy, but also the other plugin output values should survive a reboot.
These are stored in RTC memory, and restored at boot, but this memory does need power.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 19 Dec 2019, 00:20
by MarcelM
What do you mean with "the other plugin output values" ?

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 19 Dec 2019, 14:26
by TD-er
MarcelM wrote: 19 Dec 2019, 00:20 What do you mean with "the other plugin output values" ?
A task does output up-to 4 values.
Often these are sensor values like temp/hum etc.
So every value you can set in a task as output value is also stored in RTC memory.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 19 Dec 2019, 18:10
by MarcelM
Oke I understand, RTC memory values can survive deep sleep.
Is there also a memory for users which survives a reboot, like the config parms.

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 19 Dec 2019, 21:39
by TD-er
MarcelM wrote: 19 Dec 2019, 18:10 Oke I understand, RTC memory values can survive deep sleep.
Is there also a memory for users which survives a reboot, like the config parms.
Nope, not yet.
I do have plans to support FRAM and/or EEPROM for this, but that's a future new feature :)

Re: All in One NPN Watermeter and P1 Smartmeter

Posted: 20 Dec 2019, 16:50
by MarcelM
:idea: That would be nice.