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

Visu subscription of a memory log activates sending of env.core.log #595

Open
onkelandy opened this issue Sep 18, 2023 · 5 comments
Open

Comments

@onkelandy
Copy link
Member

handlers:
    memory_warn:
        (): lib.log.ShngMemLogHandler
        logname: memory_warn
        maxlen: 60
        level: WARNING
        filters: [stateengine, roborock, roborock_2, standby]
root:
    level: WARNING
    handlers: [shng_warnings_file, memory_warn]

and

{{ status.log('', 'memory_warn', 20) }}

results in correct subscription of the memory log on loading the visu page. However, as soon as the log gets updated (new entry added), the smartvisu also receives data from env.core.log which results in a console error. Maybe websocket exceptions also result from this behaviour or it's just a "cosmetic" issue..?

@wvhn could confirm that behaviour.

@wvhn
Copy link
Contributor

wvhn commented Sep 18, 2023

Yes. I have configured a Memory Log handler as described in the docu („mem_heiz“) and attached this to plugins.uzsu.
SmarthomeNG delivers the right data but then sends additional updates for env.core.log. The console error is thrown because env.core.log is not subscribed and thus not initialized in the widget.buffer.

@onkelandy
Copy link
Member Author

Das Problem kommt wohl von der Funktion initMemLog im log.py
Hier wird fix ein entsprechender Memory Logger erstellt, was ja prinzipiell keine schlechte Idee ist, da man dann das entsprechende memory log ohne weiteres Zutun in smartvisu einbinden kann. Wenn man es aber nicht einbindet, kommt es eben zu besagtem Fehler.

@Morg42
Copy link
Member

Morg42 commented Mar 3, 2024

Ich stecke da jetzt nicht drin - aber warum muss env.core.log pauschal als memlog bereitgestellt werden? Soweit ich den Code verstehe, werden ja auch keine anderen Logs verarbeitet, oder?

@msinn
Copy link
Member

msinn commented Mar 4, 2024

Dieses Log wird standardmäßig von der smartVISU verwendet (auf der Seite Konfiguration/SmartHomeNG)

@wvhn
Copy link
Contributor

wvhn commented Mar 4, 2024

Ich habe nochmal weiter getestet, indem ich einen weiteren memlog angelegt habe ('mem_webs'). Beim Abrufen des ursprünglichen Logs "mem_heiz" wird zunächst nur dessen Inhalt per Websocket übertragen. Soweit korrekt.

Sobald anschließend neue Einträge in "env.core.log" oder "mem_webs" erfolgen, werden diese als Updates übertragen obwohl sie nicht abonniert sind. Offenbar prüft die Update-Methode der memlogs nicht bzw. nich korrekt, welche Logs abonniert sind.

Ich habe jetzt einen workaround im smarthomeNG-Treiber von smartVISU erstellt, der die Fehlermeldung vermeidet und statt dessen eine Meldung auf der Konsole ausgibt:

console.log('[io.smarthomeng] ignoring data for not requested log "' + data.name + '"');

Die Änderung ist im smartVISU develop branch.

Dennoch sollte der bug in smarthomeNG behoben werden.

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

No branches or pull requests

4 participants