[vz-users] Anleitung: VZLogger als MQTT-Subscriber

Bernd Kisters bernd.kisters at schmithof.de
Fr Dez 15 12:56:38 CET 2023


Hallo,

habe mich nun an diese Channelart über protocol=exec gewagt. Es 
funktioniert aber leider nicht. Es werden keine Werte in die Datenbank 
geschrieben.

Das Kommando liefert Wert zurück:

pi at raspberrypi:~ $ mosquitto_sub -h 192.168.5.69 -p 32777 -C 1 -t 
evcc/warp2/meter/values  | jq -r '.power'
2.4136343

Im Log findet man dann solche Zeilen:

[Dec 15 12:55:16][exec] MeterExec::read: Calling 'mosquitto_sub -h 
192.168.5.69 -p 32777 -C 1-t evcc/warp2/meter/values  | jq -r '.power''
[Dec 15 12:55:16][exec] MeterExec::read: Closing process 'mosquitto_sub 
-h 192.168.5.69 -p 32777 -C 1-t evcc/warp2/meter/values  | jq -r '.power''
[Dec 15 12:55:16][mtr2] Got 0 new readings from meter:
[Dec 15 12:55:16][mtr2] waiting 10 seconds before next reading

Meine vzlogger.conf sieht so aus. Die ersten beiden Meter sind Gas und 
Strom. Die funktionieren schon über Jahre einwandfrei.
Der dritte ist der Wallboxzähler der über den MQTT Broker läuft.

{
     // General settings
     "verbosity": 15,         // log verbosity (0=log_alert, 
1=log_error, 3=log_warning, 5=log_info, 10=log_debug, 15=log_finest)
     "log": "/var/log/vzlogger/vzlogger.log", // log file, optional
     "retry": 30,            // http retry delay in seconds

     // Build-in HTTP server
     "local": {
         "enabled": false,   // enable local HTTPd for serving live readings
         "port": 8080,       // TCP port for local HTTPd
         "index": true,      // provide index listing of available 
channels if no UUID was requested
         "timeout": 30,      // timeout for long polling comet requests 
in seconds (0 disables comet)
         "buffer": -1        // HTTPd buffer configuration for serving 
readings, default -1
                             //   >0: number of seconds of readings to serve
                             //   <0: number of tuples to server per 
channel (e.g. -3 will serve 3 tuples)
     },

         "meters" : [{                            /* Strom Ferraris-Meter */
              "enabled" : true,
              "protocol" : "s0",
              "device" : "/dev/ttyUSB0",
              "aggtime" : -1,
              "aggfixedinterval" : false,
              "channel" : {
                            "uuid": "5a50f240-6861-11e6-93a2-ebf973f48426",
                            "middleware" : 
"http://localhost/middleware.php",
                            "identifier": "Impulse",
                            "aggmode" : "none"
                          }
            },{                            /* Gas Meter */
              "enabled" : true,
              "protocol" : "s0",
              "device" : "/dev/ttyUSB1",
              "aggtime" : -1,
              "aggfixedinterval" : false,
              "channel" : {
                            "uuid": "9e966320-888b-11e6-b2b7-fb7e92405315",
                            "middleware" : 
"http://localhost/middleware.php",
                            "identifier": "Impulse",
                            "aggmode" : "none"
                          }
            },
         {
              "enabled": true,
              "allowskip": true,
              "interval": 10,
              "aggtime": -1,
              "aggfixedinterval": false,
              "channel": [
                {
                  "uuid": "799c25f0-9b2f-11ee-9e4b-15d68bad4b80",
                  "middleware" : "http://localhost/middleware.php",
                  "identifier": "",
                  "aggmode": "none"
                }
               ],
               "protocol": "exec",
               "command": "mosquitto_sub -h 192.168.5.69 -p 32777 -C 1 
-t evcc/warp2/meter/values  | jq -r '.power'"
          }
       ]
}



Mehr Informationen über die Mailingliste volkszaehler-users