<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Die VZ Zählerstände sind in Millisekunden- der Konverter vmtl. Sekunden? <div class=""><br class=""></div><div class="">Viele Grüße, Andreas</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 8. Apr 2021, at 09:00, <a href="mailto:Heine.Thomas@online.de" class="">Heine.Thomas@online.de</a> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
<div class="">
Hallo Thomas,<br class="">
<br class="">
Wenn ich es so abfrage:<br class="">
<a class="moz-txt-link-freetext" href="http://192.168.178.51/data/xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx.json">http://192.168.178.51/data/xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx.json</a><br class="">
kommt folgendes:<br class="">
<br class="">
<pre class="data">{"version":"0.3","data":{"tuples":[[1617777764306,0,1]],"uuid":"xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx","from":1617777464308,"to":1617777764306,"min":[1617777764306,0],"max":[1617777764306,0],"average":0,"consumption":0,"rows":2}}</pre>
consumption bleibt 0 (ist das nicht der Aktualverbrauch?)<br class="">
<br class="">
Ich hab ja keinen Impuls-Kanal, sondern einen Zählerstand-Kanal.<br class="">
In Frontend wird der Gesamtverbrauch ja auch richtig angezeigt
(aufgerundet 136m³):<br class="">
<br class="">
<span id="cid:part1.053637A1.064BEA67@online.de"><ajjlibndepcjlagi.png></span><br class="">
<br class="">
Den Gesamtverbrauch (müsste ja der Zählerstand sein) würde ich gerne
anzeigen.<br class="">
Oder habe ich hier irgendwas nicht richtig kapiert, oder
Grundlegende Denkfehler?<br class="">
<br class="">
Der Counter-Stand des ESP kann doch auch als Zählerstand mit dem
entsprechenden Offset und Initialverbrauch als "Zähler" dienen,
oder?<br class="">
<br class="">
<span id="cid:part2.C4529F81.DE723253@online.de"><lppmegjjoipaghpl.png></span><br class="">
<br class="">
<br class="">
<br class="">
Was stimmt bei den Zeitstempeln nicht? Wenn ich sie im
Unix-Time-Converter eingebe, passen sie.<br class="">
<br class="">
Gruß Thomas<br class="">
<br class="">
<br class="">
<div class="moz-cite-prefix">Am 08.04.2021 um 08:40 schrieb Thomas
Höpfner:<br class="">
</div>
<blockquote type="cite" cite="mid:kcis.E96F4CE7F9EC43BAB1F37674F3DFCA70@rohrpostix" class="">
<meta name="Generator" content="Kopano WebApp v3.5.14.2539+111.1" class="">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
<title class="">RE: [vz-users] Abfrage Zählerstand aus Wasserzähler</title>
<!-- begin sanitized html --><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class="">Hallo
Thomas,</div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-size: 12pt; font-family: tahoma, arial, helvetica,
sans-serif;" class=""><br class="">
</span></div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-size: 12pt; font-family: tahoma, arial, helvetica,
sans-serif;" class="">die Zeitstempel stimmen nicht. Wie PHP hier
reagiert verstehe ich auch nicht.</span></div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-size: 12pt; font-family: tahoma, arial, helvetica,
sans-serif;" class="">options=raw kanst du weglassen. Hier bekommst du
nur eine Liste mit allen Impulsen. Interesand ist aber nur die
Anzahl, die steht dann auch als consumtion in der Antwort.</span></div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-size: 12pt; font-family: tahoma, arial, helvetica,
sans-serif;" class="">Ich sehe im Moment keine Möglichkeit den
aktuellen Zählerstand eines Iipulszählers aus vz auszulesen.</span></div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-size: 12pt; font-family: tahoma, arial, helvetica,
sans-serif;" class=""><br class="">
</span></div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><span style="font-size: 12pt; font-family: tahoma, arial, helvetica,
sans-serif;" class="">Thomas </span></div><div style="padding: 0px; margin: 0px; min-height: 12pt; font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;" class=""><br class="">
</div>
<blockquote style="border-left: 2px solid #325FBA; padding-left:
5px; margin: 0px 5px;" class=""><span style="font-family:
tahoma,arial,helvetica,sans-serif; font-size: 10pt;" class="">-----Ursprüngliche
Nachricht-----<br class="">
<span class=""><strong class="">Von:</strong>
<a class="moz-txt-link-abbreviated" href="mailto:Heine.Thomas@online.de">Heine.Thomas@online.de</a> <a class="moz-txt-link-rfc2396E" href="mailto:Heine.Thomas@online.de"><Heine.Thomas@online.de></a></span><br class="">
<span class=""><strong class="">Gesendet:</strong> Donnerstag 8 April 2021 08:24</span><br class="">
<span class=""><strong class="">An:</strong>
<a class="moz-txt-link-abbreviated" href="mailto:volkszaehler-users@demo.volkszaehler.org">volkszaehler-users@demo.volkszaehler.org</a></span><br class="">
<span class=""><strong class="">Betreff:</strong> Re: [vz-users] Abfrage
Zählerstand aus Wasserzähler</span><br class="">
<br class="">
</span>
<div class="bodyclass">Hallo Andreas,<br class="">
<br class="">
es liegen seid 2.4. Daten vor (inzwischen 1450 Liter)<br class="">
Initialverbrauch 134264 Liter<br class="">
Der Zählerstand sollten also inzwischen rechnerisch 135714
Liter sein.<br class="">
<br class="">
Hier die Debug-Abfrage:<br class="">
<br class="">
<a href="http://192.168.178.51/data/xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx.json?from=-1&options=raw&debug=1" title="http://192.168.178.51/data/xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx.json?from=-1&options=raw&debug=1
Klicken Sie auf den Link, um die URL in einem neuen Fenster
zu öffnen." rel="noreferrer noopener" target="_blank" moz-do-not-send="true" class="">http://192.168.178.51/data/xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx.json?from=-1&options=raw&debug=1</a><br class="">
<br class="">
und das Ergebnis:<br class="">
<br class="">
<pre class="data">{
"version": "0.3",
"data": {
"tuples": [
[
1617862067814,<span class="red-ui-debug-msg-payload"><span class="red-ui-debug-msg-element red-ui-debug-msg-top-level"><span class="red-ui-debug-msg-row"><span class="red-ui-debug-msg-object-value"><span class="red-ui-debug-msg-type-number red-ui-debug-msg-type-number-toggle">1617864302904</span></span></span></span></span>
145,
1
]
],
"uuid": "xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx",
"from": 1617861767833,
"to": 1617862067814,
"average": 0,
"consumption": 0,
"rows": 2
},
"debug": {
"database": "pdo_mysql",
"time": 0.19783,
"uptime": 1177360290,
"load": [
3.78,
4.25,
4.21
],
"commit-hash": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"php-version": "7.3.19-1~deb10u1",
"messages": [],
"sql": {
"totalTime": 0.02234506607055664,
"worstTime": 0.0026459693908691406,
"queries": [
{
"sql": "SELECT \n MAX(timestamp) \nFROM \n data \nWHERE \n channel_id = 44 \n AND timestamp < 1617873106000",
"execTime": 0.0026459693908691406
},
{
"sql": "SELECT \n MAX(timestamp) \nFROM \n data \nWHERE \n channel_id = 44 \n AND timestamp < 1617862067814",
"execTime": 0.0012600421905517578
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 6 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.0021820068359375
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 5 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.0018649101257324219
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 4 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.002110004425048828
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 3 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.0017001628875732422
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 2 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.001873016357421875
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 1 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.0018138885498046875
},
{
"sql": "SELECT \n UNIX_TIMESTAMP(\n FROM_UNIXTIME(\n MIN(timestamp) \/ 1000, \n \"%Y-%m-%d %H:%i:00\"\n )\n ) * 1000 \nFROM \n aggregate \nWHERE \n channel_id = 44 \n AND type = '1' \n AND timestamp >= UNIX_TIMESTAMP(\n DATE_ADD(\n FROM_UNIXTIME(\n 1617861767833 \/ 1000, \"%Y-%m-%d %H:%i:00\"\n ), \n INTERVAL 1 minute\n )\n ) * 1000",
"execTime": 0.001316070556640625
},
{
"sql": "SELECT \n UNIX_TIMESTAMP(\n DATE_ADD(\n FROM_UNIXTIME(\n MAX(timestamp) \/ 1000, \n \"%Y-%m-%d %H:%i:00\"\n ), \n INTERVAL 1 minute\n )\n ) * 1000 \nFROM \n aggregate \nWHERE \n channel_id = 44 \n AND type = '1' \n AND timestamp < 1617862067814",
"execTime": 0.0012249946594238281
},
{
"sql": "SELECT \n aggregate.type \nFROM \n aggregate \n INNER JOIN entities ON aggregate.channel_id = <a href="http://entities.id" class="">entities.id</a> \nWHERE \n uuid = 'xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxx' \n and aggregate.type = 0 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nLIMIT \n 1",
"execTime": 0.0016429424285888672
},
{
"sql": "SELECT \n COUNT(1) \nFROM \n data \nWHERE \n channel_id = 44 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814",
"execTime": 0.001310110092163086
},
{
"sql": "SELECT \n timestamp, \n value, \n 1 AS count \nFROM \n data \nWHERE \n channel_id = 44 \n AND timestamp >= 1617861767833 \n AND timestamp <= 1617862067814 \nORDER BY \n timestamp ASC",
"execTime": 0.0014009475708007812
}
]
}
}
}</pre>
<br class="">
<br class="">
Hilft das weiter?<br class="">
<br class="">
Gruß<br class="">
Thomas<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<div class="moz-cite-prefix">Am 08.04.2021 um 08:10 schrieb
Andreas Goetz:<br class="">
</div>
<blockquote cite="mid:A1BC3B90-AE35-4DFC-9135-9BBF09FBE334@gmail.com" class="">
<div dir="ltr" class="">Häng mal bitte ein &debug=1 dran, dann
sollten wir sehen welches SQL ausgeführt wird. Vielleicht
gibt das einen Hinweis.</div>
<div dir="ltr" class=""><br class="">
</div>
<div dir="ltr" class="">Viele Grüße, Andreas</div>
<div dir="ltr" class=""><br class="">
</div>
<div dir="ltr" class="">PS.: seit wann erfasst Du die Daten?</div>
<div dir="ltr" class=""><br class="">
<blockquote class="">Am 08.04.2021 um 07:59 schrieb <a href="mailto:Heine.thomas@online.de" title="mailto:Heine.thomas@online.de
Klicken Sie auf den Link, um die URL in einem neuen
Fenster zu öffnen." rel="noreferrer noopener" target="_blank" moz-do-not-send="true" class="">Heine.thomas@online.de</a>:<br class="">
<br class="">
</blockquote>
</div>
<blockquote class="">
<div dir="ltr" class=""> Hallo,<br class="">
<br class="">
ich habe inzwischen meinen Wasserzähler mit einem
Reed-Kontakt ausgestattet und lese ihn per Tasmota
ESP8266 über einen Counter (10l-Schritte) aus.<br class="">
der Counterwert wird also alle 10l um 1 erhöht.<br class="">
Im VZ-Logger habe ich einen Kanal mit "Wasser
Zählerstände" angelegt.<br class="">
Das klappt soweit auch alles. Ich sehe einen Verbrauch,
und auch den Gesamt-Zählerstand nach dem ich einen
Initialen Zählerstand eingetragen habe.<br class="">
<br class="">
<div class=""><adillmbjlmnoplia.png></div>
<br class="">
<br class="">
<br class="">
Per HTTP-Request kann ich auch bestimmte Zeit-Bereiche
super abfragen.<br class="">
<br class="">
Jetzt würde ich gerne aber an meiner Haus-Visualisierung
den aktuellen Zählerstand anzeigen.<br class="">
<br class="">
<br class="">
So wollte ich ihn abfragen:<br class="">
<br class="">
<a href="http://192.168.178.51/data/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx.json?from=-1&options=raw" title="http://192.168.178.51/data/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx.json?from=-1&options=raw
Klicken Sie auf den Link, um die URL in einem neuen
Fenster zu öffnen." rel="noreferrer noopener" target="_blank" moz-do-not-send="true" class="">http://192.168.178.51/data/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx.json?from=-1&options=raw</a><br class="">
<br class="">
das json sieht jedoch dann so aus:<br class="">
<pre class="data">{"version":"0.3","data":{"tuples":[[1617860867741,144,1]],"uuid":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx","from":1617860567724,"to":1617860867741,"average":0,"consumption":0,"rows":2}}</pre>
<br class="">
bzw. so:<br class="">
<div class=""><lcnmkochlddnejkg.png></div>
<br class="">
der Zählerstand müsste derzeit irgendwo bei 136xxx Liter
sein...<br class="">
<br class="">
Was mache ich bei der Abfrage zum Zählerstand falsch?<br class="">
<br class="">
Danke vorab für eure Hilfe<br class="">
<br class="">
Gruß<br class="">
Thomas<br class="">
</div>
</blockquote>
</blockquote>
<br class="">
</div>
</blockquote>
<!-- end sanitized html -->
</blockquote>
<br class="">
</div>
</div></blockquote></div><br class=""></div></body></html>