fhempy: rct_power (RCT-Power)

Begonnen von dominik, 10 Februar 2022, 20:20:12

Vorheriges Thema - Nächstes Thema

loescher

Hallo Ingo,

Bei mir liegt es hier:
/home/fhem/.fhempy/fhempy_venv/lib/python3.12/site-packages/fhempy/lib/fhem.py
Das Statistik-Modul ist m.E. auch nur ein Hinweis darauf, dass dein FHEM evtl. immer eine Minute vor der vollen Stunde etwas überlastet ist.
Das wäre ja auch nicht unüblich.
Bei mir laufen auch viele Automatismen zur vollen Stunde.
Aber mein FHEM läuft auf einem starken Rechner, da fällt das nicht auf.

Dem Performance-Thema kannst evtl. mit dem perfmon auf den Grund gehen:
https://wiki.fhem.de/wiki/Perfmon

LG,
Stephan.

is2late

Vielen Dank, Stephan! Mal sehen, obs die Intervallverlängerung bringt.
Pi4, Tahoma Jalousien, Hue, Echo, Sonos, Lupusec XT3, FritzBox

is2late

#302
Sehr seltsam...

fhem.py will nicht gefunden werden:

pi@R4:~ $ realpath fhem.py
/home/pi/fhem.py
pi@R4:~ $ cd home/pi/fhem.py
bash: cd: home/pi/fhem.py: Datei oder Verzeichnis nicht gefunden
pi@R4:~ $ cd /home/pi
pi@R4:~ $ ls
absminitowerkit    Downloads      node_modules       R4FhemBackup.sh
Bookshelf          install        out.dat            rpdiags.txt
cc2538-bsl-master  luma.examples  package-lock.json  Templates
debug.log          master.zip     Pictures           thinclient_drives
Desktop            Music          Public             Videos
Documents          NAS            R4backup.sh

Hier das Fhempy-Log:

2025-03-19 04:01:29,928 - ERROR    - fhempy.lib.fhem: FHEM took 6502ms for readingsBulkUpdateIfChanged($defs{'RCT'},'error','');;
2025-03-19 05:01:30,295 - ERROR    - fhempy.lib.fhem: FHEM took 5036ms for readingsBeginUpdate($defs{'RCT'});;
2025-03-19 06:27:08,472 - ERROR    - fhempy.lib.fhem: FHEM took 7875ms for readingsEndUpdate($defs{'RCT'},1);;
2025-03-19 06:35:18,700 - ERROR    - fhempy.lib.fhem: FHEM took 10238ms for readingsEndUpdate($defs{'RCT'},1);;
2025-03-19 06:40:03,569 - ERROR    - fhempy.lib.fhem: FHEM took 7909ms for readingsBulkUpdateIfChanged($defs{'RCT'},'error','');;
2025-03-19 08:27:09,191 - ERROR    - fhempy.lib.fhem: FHEM took 7882ms for readingsBeginUpdate($defs{'RCT'});;
2025-03-19 08:27:34,739 - ERROR    - fhempy.lib.fhem: FHEM took 8844ms for readingsBeginUpdate($defs{'RCT'});;
2025-03-19 09:49:04,090 - INFO     - fhempy.lib.fhem_pythonbinding: Shutdown initiated...
2025-03-19 09:49:04,136 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to cancel task <Task finished name='Task-6020411' coro=<wait_for() done, defined at /usr/lib/python3.9/asyncio/tasks.py:421> exception=ValueError('list.remove(x): x not in list')>, exception: list.remove(x): x not in list
2025-03-19 09:49:04,136 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to cancel task <Task finished name='Task-6020412' coro=<wait_for() done, defined at /usr/lib/python3.9/asyncio/tasks.py:421> exception=ValueError('list.remove(x): x not in list')>, exception: list.remove(x): x not in list
2025-03-19 09:49:04,137 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to cancel task <Task finished name='Task-6020413' coro=<wait_for() done, defined at /usr/lib/python3.9/asyncio/tasks.py:421> exception=ValueError('list.remove(x): x not in list')>, exception: list.remove(x): x not in list
2025-03-19 09:49:04,137 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to cancel task <Task finished name='Task-6020414' coro=<wait_for() done, defined at /usr/lib/python3.9/asyncio/tasks.py:421> exception=ValueError('list.remove(x): x not in list')>, exception: list.remove(x): x not in list
2025-03-19 09:49:04,152 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to cancel task <Task finished name='Task-6020415' coro=<wait_for() done, defined at /usr/lib/python3.9/asyncio/tasks.py:421> exception=ValueError('list.remove(x): x not in list')>, exception: list.remove(x): x not in list
2025-03-19 09:49:04,152 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to cancel task <Task finished name='Task-6020416' coro=<wait_for() done, defined at /usr/lib/python3.9/asyncio/tasks.py:421> exception=ValueError('list.remove(x): x not in list')>, exception: list.remove(x): x not in list
2025-03-19 09:49:04,153 - INFO     - fhempy.lib.fhem_pythonbinding: All modules successfully undefined!
2025-03-19 09:49:04,155 - INFO     - websockets.server: server closing
2025-03-19 09:49:14,218 - INFO     - websockets.server: connection closed
2025-03-19 09:49:14,218 - INFO     - websockets.server: server closed
2025-03-19 09:49:14,220 - INFO     - fhempy.lib.fhem_pythonbinding: Exit 0
Activating virtual environment...OK
2025-03-19 09:49:15,862 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.753...
2025-03-19 09:49:15,864 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2025-03-19 09:49:15,917 - INFO     - websockets.server: server listening on 0.0.0.0:15733
Activating virtual environment...OK
2025-03-19 09:51:19,683 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.753...
2025-03-19 09:51:19,686 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2025-03-19 09:51:19,740 - INFO     - websockets.server: server listening on 0.0.0.0:15733
2025-03-19 09:51:23,192 - INFO     - websockets.server: connection open
2025-03-19 09:51:23,193 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2025-03-19 09:51:23,726 - INFO     - fhempy.lib.pkg_installer: Attempting install of cryptography==43.0.0
2025-03-19 09:51:40,719 - ERROR    - fhempy.lib.fhem: FHEM took 10598ms for setDevAttrList('RCT', ' IODev disable:0,1 '.$readingFnAttributes)
2025-03-19 09:51:52,572 - ERROR    - fhempy.lib.fhem: FHEM took 11852ms for setDevAttrList('RCT', 'interval disable:0,1 update_readings:always,on_change default_device_readings error_reading device_readings device_readings_json:textField-long IODev disable:0,1 '.$readingFnAttributes)
2025-03-19 09:52:03,199 - ERROR    - fhempy.lib.pkg_installer: Unable to install package cryptography==43.0.0: ERROR: Command errored out with exit status 1:
     command: /opt/fhem/.fhempy/fhempy_venv/bin/python3 /tmp/tmp9jn6k5ft_in_process.py prepare_metadata_for_build_wheel /tmp/tmpvdauayw1
         cwd: /tmp/pip-install-l538wpda/cryptography_ef55f8a208a84ad99c373d531b6276ea
    Complete output (6 lines):
   
    Cargo, the Rust package manager, is not installed or is not on PATH.
    This package requires Rust and Cargo to compile extensions. Install it through
    the system's package manager or via https://rustup.rs/
   
    Checking for Rust toolchain....

WARNING: Discarding https://files.pythonhosted.org/packages/69/ec/9fb9dcf4f91f0e5e76de597256c43eedefd8423aa59be95c70c4c3db426a/cryptography-43.0.0.tar.gz#sha256=b88075ada2d51aa9f18283532c9f60e72170041bba88d7f37e49cbb10275299e (from https://pypi.org/simple/cryptography/) (requires-python:>=3.7). Command errored out with exit status 1: /opt/fhem/.fhempy/fhempy_venv/bin/python3 /tmp/tmp9jn6k5ft_in_process.py prepare_metadata_for_build_wheel /tmp/tmpvdauayw1 Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement cryptography==43.0.0
ERROR: No matching distribution found for cryptography==43.0.0
2025-03-19 09:52:03,205 - INFO     - fhempy.lib.pkg_installer: Attempting install of cryptography==43.0.0
2025-03-19 09:52:37,982 - ERROR    - fhempy.lib.pkg_installer: Unable to install package cryptography==43.0.0: ERROR: Command errored out with exit status 1:
     command: /opt/fhem/.fhempy/fhempy_venv/bin/python3 /tmp/tmpymapmk8o_in_process.py prepare_metadata_for_build_wheel /tmp/tmp0vf592qm
         cwd: /tmp/pip-install-mxi55qvn/cryptography_fac0fbfe6f274bc9b6d3b8abf452f3ce
    Complete output (6 lines):

Verstehe ich recht, dass "Cargo" fehlt, was das Problem sein könnte?

LG Ingo
Pi4, Tahoma Jalousien, Hue, Echo, Sonos, Lupusec XT3, FritzBox

loescher

Hallo Ingo,

realpath ist das falsche Kommando.
Versuche mal: find -name fhem.py

Zum Log: Was hast du gemacht? FHEM neu gestartet?
Das schaut ja aus, als würde das fhem.py neu installiert werden, was nicht ganz glückt.

LG,
Stephan.

is2late

Hallo Stephan,

ich musste fhempy ja neu installieren. Das liegt allerdings schon etwas zurück - geschehen am 2.3.25.
Das ging nur durch eine Änderung der Login-Methode (btw: Bei jedem Neustart gibt es jetzt ein neues Amazon-Einmalpasswort, welches der Raspi aber gar nicht einsetzt.)
Übrigens bestanden die Fehlermeldungen auch schon vorher, so dass die Neuinstallation insofern nichts gebracht hat.

Auffällig finde ich, dass fhempy_local ganz viele Updates hat - hab es jetzt nicht exakt nachverfolgt,
kommt mir aber vor, als würde ca zweimal wöchentlich ein Update kommen. Bin jetzt bei 0.1.753.
Das letzte Update erfolgte, nachdem ich den R4 neu gestartet habe. Kann sogar sein, dass die Updatemeldungen grundsätzlich nach einem Neustart auftauchen.

Hier das neueste Log nach Update:
define fhempy_local BindingsIo fhempy
attr fhempy_local devStateIcon {      my $attr_ver = "1.1.0";;;;      my $status_img = "10px-kreis-gruen";;;;      my $status_txt = "connected";;;;      my $ver = ReadingsVal($name, "version", "-");;;;      my $ver_available = ReadingsVal($name, "version_available", $ver);;;;      my $update_icon = "";;;;      my $refresh_img = "refresh";;;;      my $refresh_txt = "Update fhempy";;;;      if ($ver_available ne $ver) {        $refresh_img = "refresh\@orange";;;;        $refresh_txt = "Version ".$ver_available." available for update";;;;      }      if (ReadingsVal($name, "state", "disconnected") eq "disconnected") {        $status_img = "10px-kreis-rot";;;;        $status_txt = "disconnected";;;;      }      $update_icon = "<a  href=\"/fhem?cmd.dummy=set $name update&XHR=1\" title=\"Start ".$ver_available." update\">".FW_makeImage($refresh_img, $refresh_txt)."</a>";;;;      my $restart_icon = "<a  href=\"/fhem?cmd.dummy=set $name restart&XHR=1\" title=\"Restart fhempy\">".FW_makeImage("control_reboot")."</a>";;;;      "<div><a>".FW_makeImage($status_img, $status_txt)."</a><a> ".$ver." </a>".$update_icon.$restart_icon."</div>"    }
attr fhempy_local group fhempy
attr fhempy_local icon file_json-ld2
attr fhempy_local room fhempy
attr fhempy_local verbose 0
#  BindingType fhempy
#  DEF        fhempy
#  DeviceName ws:127.0.0.1:15733
#  FD        296
#  FUUID      674dc883-f33f-a79d-0852-730e9d04a64d6aa9
#  IP        127.0.0.1
#  NAME      fhempy_local
#  NR        825
#  NTFY_ORDER 50-fhempy_local
#  PARTIAL   
#  PORT      15733
#  STATE      opened
#  TYPE      BindingsIo
#  WEBSOCKET  1
#  binary    1
#  connecttime 1742553064.14896
#  devioLoglevel 0
#  eventCount 10
#  installing 0
#  localBinding 1
#  nextOpenDelay 10
#  prev_error 127.0.0.1: Verbindungsaufbau abgelehnt (111)
#  READINGS:
#    2025-03-21 11:31:08  hostname        R4
#    2025-03-21 11:31:08  os              posix
#    2025-03-21 11:31:08  python          3.9.2
#    2025-03-21 11:31:08  release        6.6.62-v8+
#    2025-03-21 11:31:04  state          opened
#    2025-03-21 11:31:08  system          Linux
#    2025-03-21 11:31:08  version        0.1.753
#    2025-03-21 11:31:11  version_available 0.1.753
#    2025-03-21 11:31:11  version_release_notes <html><a href="https://github.com/fhempy/fhempy/releases" target="_blank">Release Notes</a></html>
#  args:
#    fhempy_local
#    BindingsIo
#    fhempy
#  messages:
#    0:
#    RCT:
#    tuya_smartlife_bf4930061fa45b4ae2fnq9:
#    tuya_smartlife_bfac6bd4d8dc1b8f09dahr:
#    tuya_smartlife_bfaf7d2add5cbf5932vxir:
#    tuya_smartlife_bfb2611eda4f2f54fcweii:
#    tuya_smartlife_bfc79f5fc0a9ce7e03rpka:
#    tuya_smartlife_bfc7c0fde4ad7252f61vwm:
#    tuya_smartlife_integration:
#
setstate fhempy_local opened
setstate fhempy_local 2025-03-21 11:31:08 hostname R4
setstate fhempy_local 2025-03-21 11:31:08 os posix
setstate fhempy_local 2025-03-21 11:31:08 python 3.9.2
setstate fhempy_local 2025-03-21 11:31:08 release 6.6.62-v8+
setstate fhempy_local 2025-03-21 11:31:04 state opened
setstate fhempy_local 2025-03-21 11:31:08 system Linux
setstate fhempy_local 2025-03-21 11:31:08 version 0.1.753
setstate fhempy_local 2025-03-21 11:31:11 version_available 0.1.753
setstate fhempy_local 2025-03-21 11:31:11 version_release_notes <html><a href="https://github.com/fhempy/fhempy/releases" target="_blank">Release Notes</a></html>


Auf find -name fhem.py kommt..
pi@R4:~ $ find -name fhem.py
find: './.dbus': Keine Berechtigung
pi@R4:~ $ sudo find -name fhem.py
find: './thinclient_drives': Keine Berechtigung

Bleibt dabei, fhem.py versteckt sich...
Kurios, nicht?

LG Ingo
Pi4, Tahoma Jalousien, Hue, Echo, Sonos, Lupusec XT3, FritzBox

loescher

Probier mal:
sudo find / -name fhem.py

is2late

#306
Danke, hat geklappt:

i@R4:~ $ sudo find / -name fhem.py
/opt/fhem/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/fhem.py
/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/fhem.py
/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem.py
/opt/fhem/.fhempy/fhempy_venv/lib/python3.9/site-packages/fhempy/lib/fhem.py
find: '/home/pi/thinclient_drives': Keine Berechtigung
find: '/proc/6947': Datei oder Verzeichnis nicht gefunden
find: '/proc/6959': Datei oder Verzeichnis nicht gefunden
find: '/proc/6960': Datei oder Verzeichnis nicht gefunden
find: '/proc/6977': Datei oder Verzeichnis nicht gefunden
find: '/proc/6982': Datei oder Verzeichnis nicht gefunden
find: '/proc/6985': Datei oder Verzeichnis nicht gefunden

So werden aus "kein fhem.py" plötzlich VIER Dateien ;-)
Hast Du einen Tipp für mich, welche die Entscheidende ist? Vermutlich doch eine der beiden aus dem pyton3.9-Verzeichnis, oder?
Analog zu Deinem Link tippe ich mal auf
/opt/fhem/.fhempy/fhempy_venv/lib/python3.9/site-packages/fhempy/lib/fhem.py
Allerdings finde ich da nichts Erhellendes:
import asyncio
import json
import logging
import os
import platform
import random
import socket
import time
import traceback
from datetime import datetime

import aiohttp
import websockets

from .version import __version__

logger = logging.getLogger(__name__)

function_active = []
update_locks = {}

LG
Pi4, Tahoma Jalousien, Hue, Echo, Sonos, Lupusec XT3, FritzBox

loescher

Ja, vermutlich ist das unter 3.9 das Richtige.
Welches Python du nutzt, siehst du mit: python -V

Die Datei fängt bei mir auch so an, aber dann komen noch ca. 400 Zeilen Code.

LG,
Stephan.