Git Product home page Git Product logo

Comments (7)

wvhn avatar wvhn commented on July 4, 2024

Ursache ist wahrscheinlich, dass im JSON das datetime-Objekt nicht ausgewertet ist.:
{'cmd': 'series', 'series': [(1672386364233, 24.3), (1672386665008, 24.3), (1672386965805, 24.4), (1672387266567, 24.5), (1672387567398, 24.0), (1672387567398, 24.0), (1672387714496, 24.0)], 'sid': 'env.system.memory.percent|raw|1h|now|100', 'params': {'update': True, 'item': 'env.system.memory.percent', 'func': 'raw', 'start': 1672387714496, 'end': 'now', 'step': 36000, 'sid': 'env.system.memory.percent|raw|1h|now|100'}, 'update': datetime.datetime(2022, 12, 30, 9, 9, 10, 501995, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin'))} .

Hier müsste entweder das datetime-Objekt in Anführungszeichen stehen
'update': 'datetime.datetime(2022, 12, 30, 9, 9, 10, 501995, tzinfo=tzfile("/usr/share/zoneinfo/Europe/Berlin")'
oder (sinnvoller) als Ergebnis:
'update' : '2022-12-30T09:09:10Z+01:00'

from smarthome.

wvhn avatar wvhn commented on July 4, 2024

Beim Kommando "series_cancel" ist dies in den Log-Infos des Websocket-Moduls auch zu beobachten:

2023-01-17  14:06:54 INFO     modules.websocket   cancel_series: reply={'cmd': 'series', 'series': [(1673874414093, 63057920.0), ... komplette Datenreihe ... (1673960505797, 63287296.0)], 'series_ext': [(1673960806658, 63287296.0), (1673960814098, 63287296.0)], 'sid': 'env.core.memory|avg|1d|now|100', 'params': {'update': True, 'item': 'env.core.memory', 'func': 'avg', 'start': 1673960814098, 'end': 'now', 'step': 864000, 'sid': 'env.core.memory|avg|1d|now|100'}, 'update': datetime.datetime(2023, 1, 17, 14, 21, 18, 203993, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin'))}
2023-01-17  14:06:54 INFO     modules.websocket   cancel_series: self.sv_update_series={'192.168.2.112:52100': {'env.core.memory|avg|1d|now|100': {'update': datetime.datetime(2023, 1, 17, 14, 21, 3, 800367, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), 'params': {'update': True, 'item': 'env.core.memory', 'func': 'avg', 'start': 1673960799779, 'end': 'now', 'step': 864000, 'sid': 'env.core.memory|avg|1d|now|100'}}}}

from smarthome.

wvhn avatar wvhn commented on July 4, 2024

Von Andre kam folgender Lösungsvorschlag:
Im DB-Plugin in Zeile 885
'update': self.shtime.now() + datetime.timedelta(seconds=int(logs['step'] / 1000))
in
'update': str(self.shtime.now() + datetime.timedelta(seconds=int(logs['step'] / 1000)))
ändern.
Dies hier zur weiteren Diskussion.

from smarthome.

msinn avatar msinn commented on July 4, 2024

Das ist kein Bug. Der Eval Syntax Checker bildet exakt nach, was im eval passiert und eval würde auf genau den selben Fehler laufen.

Das Executor Plugin stellt eine andere Umgebung zur Verfügung und kann daher auch mit obigem Problem umgehen (eval jedoch nicht).

Für viele (aber nicht alle) ähnlich gelagerte Probleme (Syntax Checker meldet Error) kann man das Problem lösen, indem man den Ausdruck im eval Checker noch in einen String wandelt.

from smarthome.

wvhn avatar wvhn commented on July 4, 2024

Das stimmt natürlich im Hinblick auf den eval Syntax Checker. Aber ist es nicht trotzdem sinnvoller, im DB-Plugin die Update-Zeit im Klartext zu schreiben, so dass diese auch weiterverarbeitet werden kann?

from smarthome.

msinn avatar msinn commented on July 4, 2024

Mit der Wandlung würde das zwar im eval funktionieren, aber funktioniert es auch in den weiteren Use cases, die Zeit-Rechnugn machen (z.b. Bereitstellung für die smartVISU) oder wäre es dafür ein breaking change?

Ich bin mit dem database Plugin zuwenig „verheiratet“, um sicher zu beurteilen, ob das an anderen Stellen breaken würde.

from smarthome.

msinn avatar msinn commented on July 4, 2024

SmartHomeNG v1.9.4 has been released

from smarthome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.