/**
 * vzlogger configuration
 *
 * Use properly encoded JSON with javascript comments
 *
 * Take a look at the wiki for detailed information:
 * http://wiki.volkszaehler.org/software/controller/vzlogger#configuration
 *
 * For an online configuration editor refer to:
 * http://volkszaehler.github.io/vzlogger/
 */

{
//Generelle Einstellungen
    "daemon": true,        // run periodically
    "verbosity": 0,         // log verbosity (0=log_alert, 1=log_error, 3=log_warning, 5=log_info, 10=log_debug, 15=log_finest)
    "log": "/var/log/vzlogger.log", // log file, optional
    "retry": 2,            // http retry delay in seconds

// Build-in HTTP server
    "local": {
        "enabled": true,   // 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": 1,      // 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)
    },

// realtime notification settings
    "push": [
        {
            "url": "http://127.0.0.1:5582"  // notification destination, e.g. frontend push-server
        }
    ],

// mqtt client support (if ENABLE_MQTT set at cmake generation)
    "mqtt": {
        "enabled": true,  // enable mqtt client. needs host and port as well
        "host": "127.0.0.1", // mqtt server addr
        "port": 1883, // 1883 for unencrypted, 8883 enc, 8884 enc cert needed,
        "cafile": "", // optional file with server CA
        "capath": "", // optional path for server CAs. see mosquitto.conf. Specify only cafile or capath
        "certfile": "", // optional file for your client certificate (e.g. client.crt)
        "keyfile": "", // optional path for your client certficate private key (e.g. client.key)
        "keypass": "", // optional password for your private key
        "keepalive": 2, // optional keepalive in seconds.
        "topic": "vzlogger/data", // optional topic dont use $ at start and no / at end
        "user": "", // optional user name for the mqtt server
        "pass": "", // optional password for the mqtt server
        "retain": false, // optional use retain message flag
        "rawAndAgg": false // optional publish raw values even if agg mode is used
    },


//Konfiguration der Zähler
    "meters": [
        {
//TD3511 per D0 ansprechen
            "enabled": true,               // disabled meters will be ignored (default)
            "skip": false,                  // errors when opening meter may be ignored if enabled
            "protocol": "d0",               // meter protocol, see 'vzlogger -h' for full list
            "device": "/dev/ttyUSB0",       // meter device
//            "dump_file": "/var/log/d01.txt", // detailed log file for all received/transmitted data (optional)            
//TD3511 Initialisierung
            "parity": "7E1",                // Serial parity, 7E1 or 8N1
            "baudrate": 300,               // Serial baud rate, typically 9600 or 300
            "pullseq": "2F3F210D0A",        // Pull sequence in 'hex'
//TD3511 Baudrate erhöhen 300bps->19200bps
            "ackseq": "063036300d0a",       // optional (default: keine Antwortsequenz auf Zaehlerantwort) kann entweder feste hex-Sequenz sein (z.B. 063035300d0a für mode C mit 9600bd oder 063030300d0a = 300bd) oder kann auf "auto" gesetzt werden, damit die Sequenz autom. berechnet wird und autom. auf die max. Baudrate umgeschaltet wird (baudrate_read wird dann ignoriert)
            "read_timeout": 1,       // optional read timeout, default 10s. Data reading is considered finished if no state change after that timeout
//            "wait_sync": "end",      //Synchronisationsendsignal             
            "baudrate_change_delay": 300,   // optional, default none. Delay value in ms after ACKSEQ send before baudrate change
            "baudrate_read": 19200,           // Baudratenumschaltung auf gewünschte Baudrate, abhängig von Zählerantwort
//Mittelwertbildung der Kanäle           
            "aggtime": -1,                  // Mittelwertzeit in Sekunden
            "interval": -1,                  // Wartezeit in Sekunden bis neue Werte in die middleware übertragen werden
//Definition Kanal OBIS->UUID
            "channels": [
	    {
                "uuid": "f5e91180-1238-11eb-9d08-4b86d4a0f8f3",
                "middleware": "http://localhost/middleware.php",
                "identifier": "1.7.0",  // OBIS identifier
              "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "e3cfb370-1238-11eb-8990-8d907a74dde6",
                "middleware": "http://localhost/middleware.php",
                "identifier": "2.7.0",  // OBIS identifier
                "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "0f5821a0-1239-11eb-947c-8fd287e2e1a7",
                "middleware": "http://localhost/middleware.php",
                "identifier": "32.7",  // OBIS identifier
                "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "1dd06c60-1239-11eb-b08b-45e282a7f0e2",
                "middleware": "http://localhost/middleware.php",
                "identifier": "52.7",  // OBIS identifier
              "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "2914a7e0-1239-11eb-93a2-2f5dec61e123",
                "middleware": "http://localhost/middleware.php",
                "identifier": "72.7",  // OBIS identifier
              "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            }, 
            {
                "uuid": "78a42a80-1239-11eb-b037-099297cbb5a7",
                "middleware": "http://localhost/middleware.php",
                "identifier": "31.7",  // OBIS identifier
              "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "52b569b0-1239-11eb-a8dd-113652261527",
                "middleware": "http://localhost/middleware.php",
                "identifier": "51.7",  // OBIS identifier
              "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "617bba20-1239-11eb-9428-573daf73078a",
                "middleware": "http://localhost/middleware.php",
                "identifier": "71.7",  // OBIS identifier
              "aggmode": "AVG"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "b00546d0-1238-11eb-ac29-4724b4705248",
                "middleware": "http://localhost/middleware.php",
                "identifier": "1.8.0",  // OBIS identifier
              "aggmode": "MAX"            // aggregation mode: aggregate meter readings during <aggtime> interval
            },
            {
                "uuid": "04b681c0-1c21-11eb-b621-516a215985d7",
                "middleware": "http://localhost/middleware.php",
                "identifier": "2.8.0",  // OBIS identifier
              "aggmode": "MAX"            // aggregation mode: aggregate meter readings during <aggtime> interval
            }  
            ]
        }
    ]
}

