espeasy sonoff pulse counter Metern

Post Reply
giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

espeasy sonoff pulse counter Metern

Post by giulio » Tue Aug 28, 2018 2:09 pm

Hello,
I'm sorry for my english
(I am Italian and I use google translator)

I have connected to a Sonoff basic (firmware espeasy) a pulse counter for water consumption at Gpio14 and with Json I read the total number of pulses in Metern as an indicator
Image
https://drive.google.com/file/d/1NJPrv5 ... RFCVO/view

per questo ho modificato il file reqsdm.php
Image
https://drive.google.com/file/d/1NVMnqY ... _PtFI/view

.. now I would like to read the value every 5 minutes and get a chart equal production, consumption etc.

I read many posts but I can not.

the value of the pulses read with Json, however, goes to 0 when the Sonoff goes off or reboots .... can this problem be solved?

thanks to who helps me

jeanmarc
Posts: 1858
Joined: Thu Aug 29, 2013 7:16 am

Re: aiuto pulse counter Metern

Post by jeanmarc » Tue Aug 28, 2018 3:17 pm

Hi,
i guess it's wiser to use the sample principle i do with my arduino. Get the consumption value during the 5" sample and increment a total counter. (That's what pooler.php does)
You just have to get then set to null the counter of the Sonoff device, is that possible ?

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: aiuto pulse counter Metern

Post by giulio » Tue Aug 28, 2018 4:24 pm

Thanks for the reply
I must say that I am very inexperienced and I do things by reading the various guides.
I have a monitoring system, production, consumption etc. with a raspberry pi3 + b, (123solar and Metern), (made by a friend that I can no longer contact)
I need to be helped step by step, because the file pooler.php I do not even know where it is.

to your question:
You just have to get the set of the Sonoff device, is that possible?
I can not answer because I do not know what I should look at

the configuration page of the device on the sonoff is this:
https://drive.google.com/file/d/1yPsOLA ... xrHac/view

thanks for any help

jeanmarc
Posts: 1858
Joined: Thu Aug 29, 2013 7:16 am

Re: aiuto pulse counter Metern

Post by jeanmarc » Tue Aug 28, 2018 5:00 pm

I don't know much about espeasy. Does the "Count" variable count the pulses during each request ?

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: aiuto pulse counter Metern

Post by giulio » Tue Aug 28, 2018 10:23 pm

The "Count" variable counts the pulses, but goes to 0 when the pulses are interrupted....so it could be lt/h or m3/h etc.

while the "Total" variable always increases the value

jeanmarc
Posts: 1858
Joined: Thu Aug 29, 2013 7:16 am

Re: aiuto pulse counter Metern

Post by jeanmarc » Wed Aug 29, 2018 6:37 am

Well, that's a weird behavior to me.. Check a bit first if you can reset the counter, that'd be a proper solution.

If not, there is a dirty trick: get the difference between two samples, if positive add an incremental virtual meter. If it's negative (after a surge) don't add anything.

ps : pooler.php is available in downloads/comapps (poolmeters)

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: espeasy sonoff pulse counter Metern

Post by giulio » Wed Aug 29, 2018 1:40 pm

I'm sorry, what do you intend to reset counter?

the variable Count indicates the frequeza of the pulses when there are, while it goes to 0 when the impulses end ... it seems correct.

the Total variable increases in total number of impulses ... seems to me correct

now with this data I can have an equal graph, like production, consumption etc.

or do you need more data?

jeanmarc
Posts: 1858
Joined: Thu Aug 29, 2013 7:16 am

Re: espeasy sonoff pulse counter Metern

Post by jeanmarc » Wed Aug 29, 2018 3:21 pm

I find strange a counter that goes to null alfter a surge :) It would be neat if you can get the value during a time then count again from 0..

I can help to make the "dirty trick" script. Can you provide me the return of your command ? (Json)

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: espeasy sonoff pulse counter Metern

Post by giulio » Wed Aug 29, 2018 6:39 pm

do you mean the Json command used in reqsdm.php?

reqsdm.php
} elseif ($argv[1] == 'count') {
$url = 'http://192.168.1.140/json?tasknr=1';
$pagina = file_get_contents($url);
$json_output = json_decode($pagina, true);
$outstr = $json_output['Count'];
$outstr = "139($outstr*F)";
} elseif ($argv[1] == 'total') {
$url = 'http://192.168.1.140/json?tasknr=1';
$pagina = file_get_contents($url);
$json_output = json_decode($pagina, true);
$outstr = $json_output['Total'];
$outstr = "140($outstr*F)";


I give an example to understand:

In Metern when I do not have power consumption the live value goes to 0 (Dashboard live pooling), while the value Main 5min pooling increases ... or am I wrong?
the same happens for production etc.

now it is not possible to do the same with the variable "count" and "Total"?

jeanmarc
Posts: 1858
Joined: Thu Aug 29, 2013 7:16 am

Re: espeasy sonoff pulse counter Metern

Post by jeanmarc » Thu Aug 30, 2018 8:14 am

Hi,
Sorry i don't have much time, could you play with this req_espeasy.php script :

I don't understand your question, live value and 5" sample request are different.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests