Ankündigung

Einklappen
Keine Ankündigung bisher.

Neues Plugin: DatabaseAddOn - Erweitere Testphase

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Sisamiwe
    antwortet
    Zitat von android Beitrag anzeigen
    Auskennen ist übertrieben. Habe mal um django kennen zu lernen, eine kleine Web-/Pythonanwendung mit einem Zugriff auf eine sqlite Datenbank gebastelt.
    Zugriff ist hier weniger das Thema. Vielmehr geht es im die Abfrage der Datenbank. Hier mal ein SQL Beispiel. Man müsste nun prüfen, ob es für sqlite einen vergleichbaren Syntax gibt.

    Code:
    SELECT UNIX_TIMESTAMP(DATE(FROM_UNIXTIME(time/1000))) * 1000 as time1, ROUND(SUM(value), 1) as value FROM (SELECT time, IF(min(val_num) < 0, ROUND(MIN(val_num), 1), 0) as value FROM log WHERE item_id = :item AND val_bool = 1 AND DATE(FROM_UNIXTIME(time/1000)) BETWEEN DATE_SUB(CURDATE(), INTERVAL :start DAY) AND DATE_SUB(CURDATE(), INTERVAL :end DAY) GROUP BY DATE(FROM_UNIXTIME(time/1000)) ORDER BY time ASC ) AS table1 GROUP BY YEAR(FROM_UNIXTIME(time/1000))
    
    {'item': 846, 'end': 17, 'start': 199}

    Einen Kommentar schreiben:


  • android
    antwortet
    Auskennen ist übertrieben. Habe mal um django kennen zu lernen, eine kleine Web-/Pythonanwendung mit einem Zugriff auf eine sqlite Datenbank gebastelt.

    Einen Kommentar schreiben:


  • Sisamiwe
    antwortet
    Zitat von android Beitrag anzeigen
    Falls du das Plugin mal dahin erweiterst und einer testen soll, sag bescheid!
    Da ich kein sqlite habe, kann ich das nicht wirklich entwicklen. Kennst Du dich mit sqlite aus?

    Einen Kommentar schreiben:


  • android
    antwortet
    Zitat von android Beitrag anzeigen
    Werde am Wochenende mal testen!
    Wollt gerade testen, kann aber leider nicht, da ich mit sqlite unterwegs bin. Falls du das Plugin mal dahin erweiterst und einer testen soll, sag bescheid!

    Einen Kommentar schreiben:


  • Maexle
    antwortet
    bmx pip... in die smarthome.yaml eingetragen --> jetzt funktioniert die Sache.


    ich habe bei einer Temperatur das Beispiel eingefügt --> habe ich das richtig verstanden? Da alle vier Items im WebIF vom Addon angezeigt werden denke ich ja.
    Allerdings haben alle den Wert ".0.0 " ich denke es muss erste "ein Tag vergehen" bis was rauskommt, richtig?


    Anbei ein Auszug aus den Temperatur-Items

    Code:
    innen:
                type: num
                database: init
                knx_dpt: 9
                knx_listen: 7/2/11
                knx_init: 7/2/11
                
                #### ab hier TEST
                heute_min:
                    type: num
                    database_addon_fct: heute_min
                    
                gestern_min:
                    type: num
                    database_addon_fct: heute_minus1_min    
                
                    
                heute_max:
                    type: num
                    database_addon_fct: heute_max
    
                gestern_max:
                    type: num
                    database_addon_fct: heute_minus1_max
                    
                ### bis hier TEST
    Zum Beispiel hier...
    Code:
    innen:
                type: num
                      
                database: init
                knx_dpt: 9
                knx_listen: 7/2/11
                knx_init: 7/2/11
                
                auswertung:
                    type: foo
                    
                    heute_min:
                        type: num
                        database_addon_fct: heute_min
                    
                    gestern_min:
                        type: num
                        database_addon_fct: heute_minus1_min    
                
                    
                    heute_max:
                        type: num
                        database_addon_fct: heute_max
    
                    gestern_max:
                        type: num
                        database_addon_fct: heute_minus1_max

    Auch das "Verschieben" nach rechts mit "auswertung" bringt keine Ergebnisse zu Tage. Gehört "database_addon_fct" ganz woanders hin?
    Zuletzt geändert von Maexle; 28.03.2022, 09:33.

    Einen Kommentar schreiben:


  • bmx
    antwortet
    Steht doch da:
    Do you have multiple Python3 Versions installed? Maybe PIP3 looks into a wrong Python environment. Try to configure pip_command in etc/smarthome.yaml
    Du kannst das Paket nicht installieren, weil Python evtl. an der falschen Stelle für PIP sucht.
    Also schreibst Du in Deine smarthome.yaml eine Zeile mit pip_command: "python3 -m pip" rein.

    PS: Du bist Meister in der Kunst des weglassens, oder?

    Pakete für den Bau der Dokumentation bezieht sich auf die vier obersten Einträge Deiner Tabelle und

    Pakete für die Testsuite bezieht sich auf die letzten zwei Zeilen.

    Das stand nicht über der Tabelle aber diese Pakete sind irrelevant für den Betrieb von SHNG sondern nur für die Spezialzwecke der Dokumentation und der Tests.
    Zuletzt geändert von bmx; 25.03.2022, 14:33.

    Einen Kommentar schreiben:


  • Maexle
    antwortet

    2022-03-25 10:44:59 CRITICAL lib.smarthome Python package requirements for configured plugins are not met and unable to install those requirements
    2022-03-25 10:44:59 CRITICAL lib.smarthome Do you have multiple Python3 Versions installed? Maybe PIP3 looks into a wrong Python environment. Try to configure pip_command in etc/smarthome.yaml
    2022-03-25 10:44:59 CRITICAL lib.smarthome Aborting
    2022-03-25 10:45:02 NOTICE lib.smarthome -------------------- Init SmartHomeNG v1.9.1-master (8133e714) --------------------
    2022-03-25 10:45:02 NOTICE lib.smarthome Running in Python interpreter 'v3.9.2 final', from directory /usr/local/smarthome
    2022-03-25 10:45:02 NOTICE lib.smarthome - on Linux-5.10.92-v7+-armv7l-with-glibc2.31 (pid=2326)
    2022-03-25 10:45:06 ERROR lib.shpypi test_requirements: 'sqlvalidator' not installed, any version needed
    2022-03-25 10:45:06 WARNING lib.shpypi Installing plugin requirements for the current user, please wait...
    2022-03-25 10:45:06 WARNING lib.shpypi > using PIP command: '/usr/bin/pip3'
    2022-03-25 10:45:06 ERROR lib.shpypi /bin/sh: 1: /usr/bin/pip3: not found

    gelb markiert --> keine Ahnung was ich da tun soll...


    PyPi Check
    myst-parser * fehlt * --
    sphinx 3.1 fehlt 4 --
    sphinx-rtd-theme 1.0 fehlt * --
    sphinx-tabs * fehlt * --
    beautifulsoup4 4.1.0 fehlt * --
    pytest 3.6.0 fehlt * --

    Einen Kommentar schreiben:


  • Sisamiwe
    antwortet
    Zitat von Maexle Beitrag anzeigen
    der PyPiCheck schreibt nur "Loading"
    Und was steht im Log?

    Einen Kommentar schreiben:


  • Maexle
    antwortet
    Zitat von Sisamiwe Beitrag anzeigen
    Im WebIF kannst Du unter System\SystemPropoerties\PyPI Check nachschauen, ob die Libs geladen wurden.
    wenn ich das plugin "addon" aktiviere --> geht "Dienste" nicht über das ? hinaus und der PyPiCheck schreibt nur "Loading"

    Einen Kommentar schreiben:


  • henfri
    antwortet
    Logs sind schon besser als "geht nicht"

    Einen Kommentar schreiben:


  • Sisamiwe
    antwortet
    Maexle

    Das db_addon Plugin hat 2 bzw. 3 requirements zu "externen" Python Libs u.a. sqlvalidator. Diese müssen nachinstalliert werden. shNG macht das automatisch.

    Im Log steht das auch
    Code:
    2022-03-25 10:48:56 ERROR lib.shpypi test_requirements: 'sqlvalidator' not installed, any version needed
    2022-03-25 10:48:56 WARNING lib.shpypi Installing plugin requirements for the current user, please wait...
    2022-03-25 10:48:56 WARNING lib.shpypi > using PIP command: '/usr/bin/pip3'
    2022-03-25 10:48:56 ERROR lib.shpypi /bin/sh: 1: /usr/bin/pip3: not found
    2022-03-25 10:48:56 CRITICAL lib.smarthome Python package requirements for configured plugins are not met and unable to install those requirements
    2022-03-25 10:48:56 CRITICAL lib.smarthome Do you have multiple Python3 Versions installed? Maybe PIP3 looks into a wrong Python environment. Try to configure pip_command in etc/smarthome.yaml
    2022-03-25 10:48:56 CRITICAL lib.smarthome Aborting
    shNG versucht die fehlenden PythonLibs nachzuinstallieren. Dort tritt eine Problem auf, dass der PIP nicht findet.

    Die für das Plugin notwendigen Python Libs sind jeweils in der Datei "requirements.txt" enthalten.
    Im WebIF kannst Du unter System\SystemPropoerties\PyPI Check nachschauen, ob die Libs geladen wurden.

    Einen Kommentar schreiben:


  • Maexle
    antwortet
    sudo systemctl status smarthome.service
    --->
    Code:
    ● smarthome.service - SmartHomeNG daemon
    Loaded: loaded (/lib/systemd/system/smarthome.service; enabled; vendor preset: enabled)
    Active: active (running) since Fri 2022-03-25 10:46:13 CET; 1s ago
    Process: 2458 ExecStart=/usr/bin/python /usr/local/smarthome/bin/smarthome.py (code=exited, status=0/SUCCESS)
    Main PID: 2468 (python)
    IO: 0B read, 0B written
    Tasks: 1 (limit: 1597)
    Memory: 19.1M
    CPU: 5.505s
    CGroup: /system.slice/smarthome.service
    └─2468 /usr/bin/python /usr/local/smarthome/bin/smarthome.py
    
    Mär 25 10:46:10 SmartHomeNG systemd[1]: Starting SmartHomeNG daemon...
    Mär 25 10:46:13 SmartHomeNG python[2467]: Daemon PID 2468
    Mär 25 10:46:13 SmartHomeNG systemd[1]: smarthome.service: Supervising process 2468 which is not our child. We'll most likely not noti>
    Mär 25 10:46:13 SmartHomeNG systemd[1]: Started SmartHomeNG daemon.

    Nun hat sich doch mal etwas getan --> allerdings sehe ich da keinen Zusammenhang...

    Code:
    2022-03-25 10:48:48 CRITICAL lib.smarthome Python package requirements for configured plugins are not met and unable to install those requirements
    2022-03-25 10:48:48 CRITICAL lib.smarthome Do you have multiple Python3 Versions installed? Maybe PIP3 looks into a wrong Python environment. Try to configure pip_command in etc/smarthome.yaml
    2022-03-25 10:48:48 CRITICAL lib.smarthome Aborting
    2022-03-25 10:48:52 NOTICE lib.smarthome -------------------- Init SmartHomeNG v1.9.1-master (8133e714) --------------------
    2022-03-25 10:48:52 NOTICE lib.smarthome Running in Python interpreter 'v3.9.2 final', from directory /usr/local/smarthome
    2022-03-25 10:48:52 NOTICE lib.smarthome - on Linux-5.10.92-v7+-armv7l-with-glibc2.31 (pid=2782)
    2022-03-25 10:48:56 ERROR lib.shpypi test_requirements: 'sqlvalidator' not installed, any version needed
    2022-03-25 10:48:56 WARNING lib.shpypi Installing plugin requirements for the current user, please wait...
    2022-03-25 10:48:56 WARNING lib.shpypi > using PIP command: '/usr/bin/pip3'
    2022-03-25 10:48:56 ERROR lib.shpypi /bin/sh: 1: /usr/bin/pip3: not found
    
    2022-03-25 10:48:56 CRITICAL lib.smarthome Python package requirements for configured plugins are not met and unable to install those requirements
    2022-03-25 10:48:56 CRITICAL lib.smarthome Do you have multiple Python3 Versions installed? Maybe PIP3 looks into a wrong Python environment. Try to configure pip_command in etc/smarthome.yaml
    2022-03-25 10:48:56 CRITICAL lib.smarthome Aborting
    2022-03-25 10:48:59 NOTICE lib.smarthome -------------------- Init SmartHomeNG v1.9.1-master (8133e714) --------------------
    2022-03-25 10:48:59 NOTICE lib.smarthome Running in Python interpreter 'v3.9.2 final', from directory /usr/local/smarthome
    2022-03-25 10:48:59 NOTICE lib.smarthome - on Linux-5.10.92-v7+-armv7l-with-glibc2.31 (pid=2809)
    2022-03-25 10:49:02 NOTICE lib.smarthome - Nutze Feiertage für Land 'DE', Provinz 'BY', 1 benutzerdefinierte(r) Feiertag(e) definiert
    2022-03-25 10:49:05 ERROR lib.smarthome Unhandled exception: 'NoneType' object has no attribute 'stop'
    <class 'AttributeError'>
    File "/usr/local/smarthome/bin/smarthome.py", line 288, in <module>
    sh.start()
    File "/usr/local/smarthome/lib/smarthome.py", line 588, in start
    self.modules.start()
    File "/usr/local/smarthome/lib/module.py", line 362, in start
    self.m.start()
    File "/usr/local/smarthome/modules/admin/__init__.py", line 206, in start
    self.mod_http.register_webif(WebInterface(self.web if_dir, self, self.shng_url_root, self.url_root),
    File "/usr/local/smarthome/modules/admin/__init__.py", line 337, in __init__
    SystemData.__init__(self)
    File "/usr/local/smarthome/modules/admin/systemdata.py", line 60, in __init__
    self.read_cpuinfo()
    File "/usr/local/smarthome/modules/admin/systemdata.py", line 108, in read_cpuinfo
    import lib.cpuinfo
    File "/usr/local/smarthome/lib/cpuinfo.py", line 2421, in <module>
    _check_arch()
    File "/usr/local/smarthome/lib/cpuinfo.py", line 231, in _check_arch
    arch, bits = _parse_arch(DataSource.arch_string_raw)
    File "/usr/local/smarthome/lib/cpuinfo.py", line 624, in _parse_arch
    elif re.match('^x64$|^x86_64$|^x86_64t$|^i686-64$|^amd64$|^ia64$|^ia-64$', arch_string_raw):
    File "/usr/lib/python3.9/re.py", line 191, in match
    return _compile(pattern, flags).match(string)
    File "/usr/lib/python3.9/re.py", line 304, in _compile
    p = sre_compile.compile(pattern, flags)
    File "/usr/lib/python3.9/sre_compile.py", line 768, in compile
    code = _code(p, flags)
    File "/usr/lib/python3.9/sre_compile.py", line 607, in _code
    _compile(code, p.data, flags)
    File "/usr/lib/python3.9/sre_compile.py", line 209, in _compile
    _compile(code, av, flags)
    File "/usr/lib/python3.9/sre_compile.py", line 90, in _compile
    for op, av in pattern:
    File "/usr/lib/python3.9/sre_parse.py", line 165, in __getitem__
    if isinstance(index, slice):
    File "/usr/local/smarthome/lib/smarthome.py", line 677, in stop
    self.items.stop()
    
    2022-03-25 10:51:38 NOTICE lib.smarthome -------------------- Init SmartHomeNG v1.9.1-master (8133e714) --------------------
    2022-03-25 10:51:38 NOTICE lib.smarthome Running in Python interpreter 'v3.9.2 final', from directory /usr/local/smarthome
    2022-03-25 10:51:38 NOTICE lib.smarthome - on Linux-5.10.92-v7+-armv7l-with-glibc2.31 (pid=2858)
    2022-03-25 10:51:40 NOTICE lib.smarthome - Nutze Feiertage für Land 'DE', Provinz 'BY', 1 benutzerdefinierte(r) Feiertag(e) definiert
    2022-03-25 10:51:53 WARNING lib.item.item Item garage.tor.wechsel: _cast_duration (3/10) problem: invalid literal for int() with base 10: '3/10'
    2022-03-25 10:51:53 WARNING lib.item.item Item garage.tor.oeffnen: _cast_duration (1.5) problem: invalid literal for int() with base 10: '1.5'
    2022-03-25 10:51:54 WARNING plugins.openweathermap home@: owm.home.uvi The UVI API is deprecated - if you intend to query the current UV-index, use 'current/uvi' instead
    2022-03-25 10:51:54 WARNING plugins.openweathermap home@: owm.home.uvi_date The UVI API is deprecated - if you intend to query the current UV-index, use 'current/uvi' instead
    2022-03-25 10:51:54 WARNING plugins.knx Ignoring dg.dach.wind.alarm: please add knx_dpt.
    2022-03-25 10:51:54 NOTICE lib.smarthome -------------------- SmartHomeNG initialization finished --------------------
    Zuletzt geändert von Maexle; 25.03.2022, 10:58.

    Einen Kommentar schreiben:


  • Maexle
    antwortet
    Hier der Auszug aus der Log-Datei.

    Code:
    2022-03-25 10:22:29 NOTICE lib.smarthome -------------------- SmartHomeNG initialization finished --------------------
    2022-03-25 10:25:21 NOTICE lib.smarthome -------------------- SmartHomeNG stopped --------------------
    2022-03-25 10:25:21 ERROR asyncio Task was destroyed but it is pending!
    task: <Task pending name='update_all_series' coro=<Websocket.update_all_series() running at /usr/local/smarthome/modules/websocket/__init__.py:741> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x63247808>()]>>
    2022-03-25 10:25:21 ERROR asyncio Task was destroyed but it is pending!
    task: <Task pending name='update_visu' coro=<Websocket.update_visu() running at /usr/local/smarthome/modules/websocket/__init__.py:842> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x62f2ef28>()]>>
    2022-03-25 10:27:56 NOTICE lib.smarthome -------------------- Init SmartHomeNG v1.9.1-master (8133e714) --------------------
    2022-03-25 10:27:56 NOTICE lib.smarthome Running in Python interpreter 'v3.9.2 final', from directory /usr/local/smarthome
    2022-03-25 10:27:56 NOTICE lib.smarthome - on Linux-5.10.92-v7+-armv7l-with-glibc2.31 (pid=1542)
    2022-03-25 10:27:58 NOTICE lib.smarthome - Nutze Feiertage für Land 'DE', Provinz 'BY', 1 benutzerdefinierte(r) Feiertag(e) definiert
    2022-03-25 10:28:11 WARNING lib.item.item Item garage.tor.wechsel: _cast_duration (3/10) problem: invalid literal for int() with base 10: '3/10'
    2022-03-25 10:28:11 WARNING lib.item.item Item garage.tor.oeffnen: _cast_duration (1.5) problem: invalid literal for int() with base 10: '1.5'
    2022-03-25 10:28:12 WARNING plugins.openweathermap home@: owm.home.uvi The UVI API is deprecated - if you intend to query the current UV-index, use 'current/uvi' instead
    2022-03-25 10:28:12 WARNING plugins.openweathermap home@: owm.home.uvi_date The UVI API is deprecated - if you intend to query the current UV-index, use 'current/uvi' instead
    2022-03-25 10:28:12 WARNING plugins.knx Ignoring dg.dach.wind.alarm: please add knx_dpt.
    2022-03-25 10:28:12 NOTICE lib.smarthome -------------------- SmartHomeNG initialization finished --------------------


    Ich habe den Tab offen gelassen --> aktualisieren --> "FILE NOT FOUND!"


    Wenn ich das "maria_db" aktiviere komme ich gar nicht an den Punkt um das Log anzusehen.
    Zuletzt geändert von Maexle; 25.03.2022, 10:46.

    Einen Kommentar schreiben:


  • henfri
    antwortet
    Hallo,

    pycache wird automatisch erzeugt.
    Eine Fehlermeldung aus dem Log hab ich bisher aber auch nicht gesehen. Gibt es keine?

    Deine Einstellung sieht soweit aber richtig aus.

    Gruß,
    Hendrik

    Einen Kommentar schreiben:


  • Maexle
    antwortet
    Zitat von Sisamiwe Beitrag anzeigen
    Versuche es nochmal.
    Leider erfolglos...

    Code:
    uzsu:
       plugin_name: uzsu
    
    maria_db_addon:
        plugin_name: _priv_db_addon
        startup_run_delay: '300'
        ignore_0_at_temp_items: true

    mir fehlt der Ordner __pycache__ bzw. dieser liegt "eine Ebene höher" (SHNG\plugins\__pycache___ ) kann es daran liegen?
    addon.png

    Einen Kommentar schreiben:

Lädt...
X