Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no logging #633

Closed
smarteshome2020 opened this issue Mar 7, 2024 · 6 comments
Closed

no logging #633

smarteshome2020 opened this issue Mar 7, 2024 · 6 comments
Labels

Comments

@smarteshome2020
Copy link

smarteshome2020 commented Mar 7, 2024

Hallo, ich versuche es mal in Deutsch :-)
Ich bin gerade dabei mit einen Volkszähler auf Basis eines PI zu bauen. Mir gelingt es einfach nicht die Daten die ich vom IR bekommen per vzlogger an die middleware zu übergeben. Könntet mir bitte jemand helfen? :-(

Output cat /dev/ttyUSB0

1-0:1.8.0*255(009598.4687*kWh)
1-0:1.8.1*255(001084.3044*kWh)
1-0:1.8.2*255(008514.1643*kWh)
1-0:2.8.0*255(000055.5712*kWh)
1-0:16.7.0*255(000458*W)

pi@volkszaehler:/ $ curl -s 192.168.168.156:8081/ | jq .|cat -n

     1  {
     2    "version": "0.8.3",
     3    "generator": "vzlogger",
     4    "data": [],
     5    "exception": {
     6      "message": "channel index is disabled",
     7      "code": 0
     8    }
     9  }

vzlogger.conf

`{
    // General settings
    "daemon": true,
    "verbosity": 15,
    "log": "/var/log/vzlogger.log",
    "retry": 30,

    // Build-in HTTP server
    "local": {
        "enabled": false,
        "port": 8080,
        "index": true,
        "timeout": 30,
        "buffer": -1


    },

    // realtime notification settings
    
    "push": [
        {
            "url": "http://localhost:5582"  // notification destination, e.g. f$
        }
    ],

    // Meter configuration
    "meters": [
        {
            // Example SML meter

            "enabled": true,
            "skip": false,
            "protocol": "sml",
            "device": "/dev/ttyUSB0",
            "host": "",
            "pullseq": "",
            "aggtime": 10,
            "interval": -1,
            "baudrate": 9600,
            "patity": "8N1",
            "use_local_time": true,

            "channels": [{
                "api": "volkszaehler",
                "uuid": "6478bfa0-7638-11ea-aa70-55d237950150",
 "middleware": "http://localhost/middleware.php",
                "identifier": "1-0:1.8.0"

            }, {
                "uuid": "73d96fa0-7638-11ea-aee9-21e1d78bf6f1",
                "middleware": "http://localhost/middleware.php",
                "identifier": "1-0:1.16.0",
                "duplicates": 10
            },
]
        },

    ]

 }
`

vzlogger.log kurz nach dem neustart

[Mar 07 18:25:05][main] vzlogger v0.8.3 based on heads/master-0-g15ae6f29c5 from Mon, 4 Mar 2024 18:34:38 +0100 started.
[Mar 07 18:25:05][mtr0] Creating new meter with protocol sml.
[Mar 07 18:25:05][sml]  pullseq len:0 found
[Mar 07 18:25:05][mtr0] Meter configured, enabled.
[Mar 07 18:25:05]       New meter initialized (protocol=sml)
[Mar 07 18:25:05]       Configure channel.
[Mar 07 18:25:05][chn0] New channel initialized (uuid=...68cc34 api=volkszaehler id=1-0:1.8.0)
[Mar 07 18:25:05]       Configure channel.
[Mar 07 18:25:05][chn1] New channel initialized (uuid=...3cff37 api=volkszaehler id=1-0:16.7.0)
[Mar 07 18:25:05]       Configure channel.
[Mar 07 18:25:05][chn2] New channel initialized (uuid=...165308 api=volkszaehler id=1-0:16.7.0)
[Mar 07 18:25:05]       Have 1 meters.
[Mar 07 18:25:05][main] log level is 15
[Mar 07 18:25:05][main] local=1
[Mar 07 18:25:05]       Daemonize process...
[Mar 07 18:25:05]       Opened logfile /var/log/vzlogger/vzlogger.log
[Mar 07 18:25:05][push] pushdata_thread created.
[Mar 07 18:25:05][push] Start push_data_thread
[Mar 07 18:25:05][]     ===> Start meters
[Mar 07 18:25:05][mtr0] Meter connection established
[Mar 07 18:25:05][mtr0] Meter thread started
[Mar 07 18:25:05][mtr0] Meter is opened. Starting channels.
[Mar 07 18:25:05][mtr0] Number of readers: 32
[Mar 07 18:25:05][chn0] Logging thread started
[Mar 07 18:25:05][chn0] Start logging thread for volkszaehler-api.
[Mar 07 18:25:05][chn1] Logging thread started
[Mar 07 18:25:05][mtr0] Config.local: 1
[Mar 07 18:25:05][chn2] Logging thread started
[Mar 07 18:25:05][chn2] Start logging thread for volkszaehler-api.
[Mar 07 18:25:05][chn1] Start logging thread for volkszaehler-api.
[Mar 07 18:25:05][chn0] Using default volkszaehler api.
[Mar 07 18:25:05][http] Starting local interface HTTPd on port 8081
[Mar 07 18:25:05][]     Startup done.
[Mar 07 18:25:05][chn1] Using default volkszaehler api.
[Mar 07 18:25:05][chn2] Using default volkszaehler api.
[Mar 07 18:25:10][push] waitAndSendOnceToAll empty dataMap (timeout?
```)
@smarteshome2020
Copy link
Author

index = true, allerdings immer noch keine Daten :-(

image

@r00t-
Copy link
Contributor

r00t- commented Mar 7, 2024

this is not a support forum, but a place to report issues with the software itself (bugs, feature requests).
there's the -users mailing list: https://wiki.volkszaehler.org/contact
and i heard that there's a forum somewhere on the internet.

Output cat /dev/ttyUSB0

1-0:1.8.0*255(009598.4687*kWh)
        "protocol": "sml",
       "device": "/dev/ttyUSB0",

sml is a binary protocol, the data from your meter is clearly not sml, probably rather d0.
you did not mention what model of meter you are trying to read.
can you say what made you assume it's sml?
we might have to improve some documentation.
the parser could also print some warnings if it finds the data it receives is garbage.

@r00t-
Copy link
Contributor

r00t- commented Mar 7, 2024

the parser could also print some warnings if it finds the data it receives is garbage.

that is essentiallly a libsml issue (and somewhat blocked by volkszaehler/libsml#17 )
we read from the meter using sml_transport_read(): https://github.com/volkszaehler/libsml/blob/master/sml/src/sml_transport.c#L59
which silently skips over any unrecognized data.
(it only prints a warning for valid but unrecognized sml sequences.)

we need to either improve the sml_transport code and the libsml API,
or replace sml_transport with local code.

=> a short investigation shows: the sml_transport_read() api is completely broken.
there's no way for it to keep state between invocations (it's not passed an sml_buffer struct that would be used for that.)
and it can't return anything to the caller because it only returns the number of bytes read.
(we already enhanced this by allowing to return 0 to indicate read errors.)
sml_transport needs to be deprecated and replaced.

@smarteshome2020
Copy link
Author

smarteshome2020 commented Mar 7, 2024

Thanks, i don*t know why im using SML, i change to S0 and it looks better. I will test it.

Thanks a lot

[Mar 07 20:13:02][mtr0] Got 24 new readings from meter:
[Mar 07 20:13:02][mtr0] Reading: id=1-0:96.1.0*255/ObisIdentifier:1-0:96.1.0*255 value=1.00 ts=1709838781645
[Mar 07 20:13:02][mtr0] Reading: id=1-0:1.8.0*255/ObisIdentifier:1-0:1.8.0*255 value=9600.84 ts=1709838781650
[Mar 07 20:13:02][mtr0] Reading: id=1-0:1.8.1*255/ObisIdentifier:1-0:1.8.1*255 value=1086.68 ts=1709838781654
[Mar 07 20:13:02][mtr0] Reading: id=1-0:1.8.2*255/ObisIdentifier:1-0:1.8.2*255 value=8514.16 ts=1709838781659
[Mar 07 20:13:02][mtr0] Reading: id=1-0:2.8.0*255/ObisIdentifier:1-0:2.8.0*255 value=55.57 ts=1709838781663
[Mar 07 20:13:02][mtr0] Reading: id=1-0:16.7.0*255/ObisIdentifier:1-0:16.7.0*255 value=1642.00 ts=1709838781683
[Mar 07 20:13:02][mtr0] Reading: id=1-0:72.7.0*255/ObisIdentifier:1-0:72.7.0*255 value=235.10 ts=1709838781711
[Mar 07 20:13:02][mtr0] Reading: id=1-0:31.7.0*255/ObisIdentifier:1-0:31.7.0*255 value=1.46 ts=1709838781740

@r00t- r00t- closed this as completed Mar 7, 2024
@r00t- r00t- added the Invalid label Mar 7, 2024
@r00t-
Copy link
Contributor

r00t- commented Mar 7, 2024

i'll just leave this link here,
it has example configurations for lots of meters, including the correct protocol:
https://wiki.volkszaehler.org/hardware/channels/meters/power/edl-ehz

@J-A-U
Copy link
Collaborator

J-A-U commented Mar 8, 2024

we might have to improve some documentation.

Doesn't strike me like @smarteshome2020 used our wiki. E.g. "port": 8080,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants