<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div>
Hallo zusammen,
</div>
<div>
</div>
<div>
ich habe ein Problem, dass vzlogger nicht in die Datenbank schreiben kann.
</div>
<div>
</div>
<div>
Ich habe einen Stromzähler mit S0 Ausgang an /dev/ttyAMA0 hängen.
</div>
<div>
</div>
<div>
Dieser ist wie folgt in /etc/vzlogger.conf configuriert:
</div>
<div>
</div>
<div style="padding-left: 40px;">
// ===============
</div>
<div style="padding-left: 40px;">
{
</div>
<div style="padding-left: 40px;">
// Example S0 meter
</div>
<div style="padding-left: 40px;">
</div>
<div style="padding-left: 40px;">
"enabled": true, // disabled meters will be ignored (default)
</div>
<div style="padding-left: 40px;">
"allowskip": false, // errors when opening meter may be ignored if enabled
</div>
<div style="padding-left: 40px;">
"protocol": "s0", // meter protocol, see 'vzlogger -h' for full list
</div>
<div style="padding-left: 40px;">
"device": "/dev/ttyAMA0", // meter device
</div>
<div style="padding-left: 40px;">
</div>
<div style="padding-left: 40px;">
"aggtime": -1, // aggregate meter readings and send middleware update after <aggtime> seconds
</div>
<div style="padding-left: 40px;">
"aggfixedinterval": false, // round timestamps to nearest <aggtime> before sending to middleware
</div>
<div style="padding-left: 40px;">
</div>
<div style="padding-left: 40px;">
"channel": {
</div>
<div style="padding-left: 40px;">
"identifier": "Impulse", // s0 meter knows "Impulse" and "Power"
</div>
<div style="padding-left: 40px;">
"uuid": "fa0767e0-f517-11eb-9ad0-5db6e9fd08c6",
</div>
<div style="padding-left: 40px;">
"middleware": "<a href="http://localhost/middleware.php" target="_blank" rel="noopener">http://localhost/middleware.php"</a>,
</div>
<div style="padding-left: 40px;">
"aggmode": "SUM" // aggregation mode: aggregate meter readings during <aggtime> interval
</div>
<div style="padding-left: 40px;">
// "SUM": add readings (use for s0 impulses)
</div>
<div style="padding-left: 40px;">
// "MAX": maximum value (use for meters sending absolute readings)
</div>
<div style="padding-left: 40px;">
// "AVG": average value (use for meters sending current usage)
</div>
<div style="padding-left: 40px;">
}
</div>
<div style="padding-left: 40px;">
},
</div>
<div style="padding-left: 40px;">
// ===============
</div>
<div>
</div>
<div>
Die vzlogger.conf Datei wird auch korrekt gelesen und vzlogger started korrekt:
</div>
<div>
</div>
<div style="padding-left: 40px;">
pi@volkszaehler:~ $ head /var/log/vzlogger.log
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59][main] vzlogger v0.8.5 based on heads/master-0-gbc864bd195 from Fri, 3 May 2024 19:42:00 +0200 started.
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59] New meter initialized (protocol=s0)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59][chn0] New channel initialized (uuid=...fd08c6 api=volkszaehler id=Impulse)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59] New meter initialized (protocol=sml)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59][chn1] New channel initialized (uuid=...0ced10 api=volkszaehler id=power)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59][chn2] New channel initialized (uuid=...42a90c api=volkszaehler id=counter)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59][chn3] New channel initialized (uuid=...104b48 api=volkszaehler id=1-0:1.8.0)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59] New meter initialized (protocol=s0)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59][chn4] New channel initialized (uuid=...45c7b2 api=volkszaehler id=Impulse)
</div>
<div style="padding-left: 40px;">
[May 08 19:43:59] New meter initialized (protocol=d0)
</div>
<div style="padding-left: 40px;">
pi@volkszaehler:~ $
</div>
<div class="default-style" style="padding-left: 40px;">
</div>
<div class="default-style">
Leider meldet vzlogger einen Fehler beim Schreiben der Daten in die Datenbank:
</div>
<div class="default-style">
</div>
<div class="default-style" style="padding-left: 40px;">
pi@volkszaehler:~ $ tail /var/log/vzlogger.log
<br>[May 12 14:44:41][chn0] Adding reading to queue (value=1.00 ts=1715521481883)
<br>[May 12 14:44:41][push] CURL: http://127.0.0.1:5582 Couldn't connect to server
<br>[May 12 14:44:49][chn0] Adding reading to queue (value=1.00 ts=1715521489485)
<br>[May 12 14:44:49][push] CURL: http://127.0.0.1:5582 Couldn't connect to server
<br>[May 12 14:44:54][chn0] Adding reading to queue (value=1.00 ts=1715521494117)
<br>[May 12 14:44:54][push] CURL: http://127.0.0.1:5582 Couldn't connect to server
<br>[May 12 14:45:03][chn0] Adding reading to queue (value=1.00 ts=1715521503386)
<br>[May 12 14:45:03][push] CURL: http://127.0.0.1:5582 Couldn't connect to server
<br>[May 12 14:45:12][chn0] Adding reading to queue (value=1.00 ts=1715521512640)
<br>[May 12 14:45:12][push] CURL: http://127.0.0.1:5582 Couldn't connect to server
</div>
<div class="default-style">
</div>
<div class="default-style">
Meine Config.yaml sieht wie folgt aus:
</div>
<div class="default-style">
</div>
<div class="default-style">
<div class="default-style" style="padding-left: 40px;">
pi@volkszaehler:~/volkszaehler.org/etc $ cat config.yaml
<br># general settings overriding php configuration
<br>php:
<br>timezone: Europe/Berlin
<br>locale: ['de_DE', 'en_US', 'C']
</div>
<div class="default-style" style="padding-left: 40px;">
# Doctrine database configuration
<br># http://www.doctrine-project.org/projects/doctrine-dbal/en/2.6
<br>db:
<br>driver: pdo_mysql
<br>host: localhost
<br># port: 3306
<br>user: vz
<br>password: demo
<br>charset: utf8
<br>dbname: volkszaehler
<br>path: volkszaehler # only used for sqlite
</div>
<div class="default-style" style="padding-left: 40px;">
# db admin credentials (used by doctrine cli and setup script)
<br>admin:
<br>user: vz-admin
<br>password: raspberry
</div>
<div class="default-style" style="padding-left: 40px;">
# database optimizer - leave empty for automatic
<br># optimizer: Volkszaehler\Interpreter\SQL\MySQLOptimizer # provides additional group=15m setting for demo purposes
</div>
<div class="default-style" style="padding-left: 40px;">
# push server for realtime frontend updates
<br>push:
<br>server: 5582
<br>broadcast: 8082
<br># routes for wamp access
<br>wamp:
<br>- /
<br>- /ws
<br># routes for plain web socket access
<br>websocket:
<br>- /socket
</div>
<div class="default-style" style="padding-left: 40px;">
network:
<br># limit maximum POST body size, e.g. 4096
<br>postlimit: false
</div>
<div class="default-style" style="padding-left: 40px;">
# enable debug messages by default if true
<br>debug: false
<br>pi@volkszaehler:~/volkszaehler.org/etc $
</div>
</div>
<div class="default-style">
</div>
<div class="default-style">
Meine middleware.json sieht wie folgt aus:
</div>
<div class="default-style">
</div>
<div class="default-style" style="padding-left: 40px;">
pi@volkszaehler:~/volkszaehler.org/etc $ cat middleware.json
<br>{
<br>"host": "0.0.0.0",
<br>"port": 8080,
<br>"workers": 8,
<br>"static-directory": "/var/www/volkszaehler.org/htdocs",
<br>"logging": 0,
<br>"max-requests": 1000,
<br>"bridge": "HttpKernel",
<br>"bootstrap": "Volkszaehler\\Server\\PPMBootstrapAdapter"
<br>}
<br>pi@volkszaehler:~/volkszaehler.org/etc $
</div>
<div class="default-style" style="padding-left: 40px;">
</div>
<div class="default-style">
Hat jemand ein Idee oder Hinweis, warum die Middleware nicht auf Port 5582 Daten annimmt?
</div>
<div class="default-style">
</div>
<div class="default-style">
Würde mich über Hilfe und Hinweise freuen.
</div>
<div class="default-style">
</div>
<div class="default-style">
Gruss
</div>
<div class="default-style">
</div>
<div class="default-style">
Dominic
</div>
</body>
</html>