fhempy: tuya (lokal)

Begonnen von dominik, 26 April 2022, 19:12:25

Vorheriges Thema - Nächstes Thema

Mazz78

#300
Ok, das fhempy Logfile sagt folgendes...

Kann damit leider nicht so viel anfangen  :-[
Die Error-Meldung am Ende wiederholt sich dann im Logfile ca. 30x

Was ist der "KeyError - result" ?


2022-11-20 10:59:58,895 - INFO     - fhempy.lib.fhem_pythonbinding: Start update...
2022-11-20 10:59:58,896 - INFO     - fhempy.lib.pkg_installer: Attempting install of fhempy
2022-11-20 11:00:12,147 - INFO     - fhempy.lib.pkg_installer: Successfully installed fhempy update!
2022-11-20 11:00:12,163 - INFO     - fhempy.lib.fhem_pythonbinding: Restart initiated...
2022-11-20 11:00:12,164 - INFO     - websockets.server: server closing
2022-11-20 11:00:22,191 - INFO     - websockets.server: connection closed
2022-11-20 11:00:22,193 - INFO     - websockets.server: server closed
2022-11-20 11:00:22,197 - INFO     - fhempy.lib.fhem_pythonbinding: Exit 1
2022-11-20 11:00:23,308 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.520...
2022-11-20 11:00:23,316 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2022-11-20 11:00:23,351 - INFO     - websockets.server: server listening on 0.0.0.0:15733
2022-11-20 11:00:32,967 - INFO     - websockets.server: connection open
2022-11-20 11:00:32,971 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2022-11-20 11:02:37,960 - INFO     - fhempy.lib.pkg_installer: Attempting install of tinytuya==1.7.1
2022-11-20 11:02:37,969 - WARNING  - asyncio: Executing <Handle <TaskWakeupMethWrapper object at 0xb5154250>(<Future finis...events.py:396>) created at /usr/lib/python3.7/asyncio/tasks.py:368> took 0.242 seconds
2022-11-20 11:02:47,075 - INFO     - fhempy.lib.pkg_installer: Successfully installed tinytuya==1.7.1 update!

2022-11-20 11:03:36,180 - ERROR    - tuya_system: Exception raised by task: <Task finished coro=<FhemModule._run_coro() done, defined at /opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/generic.py:194> exception=KeyError('result') created at /usr/lib/python3.7/asyncio/tasks.py:325>
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/generic.py", line 202, in _handle_task_result
    task.result()
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/generic.py", line 196, in _run_coro
    await coro
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya/tuya.py", line 617, in _scan_devices
    for i in json_data["result"]:
KeyError: 'result'
RaPi 4 / Buster / FHEM 6
CUL868 / JeeLink868
Banana M1 (Bananian) + ser2net + Stiebel Eltron LWZ403
FIRMATA -> Gartenbewässerung /-licht
ALEXA

dominik

Dein Scan dürfte gar keine Ergebnisse liefern. Teste mal folgendes:

sudo -u fhem bash
python3 -m tinytuya scan

Poste dann das Ergebnis.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Mazz78

Ja richtig, der scan_devices liefert gar nichts (hatte ich ja schon geschrieben)
Hier das Ergebnis von...
Zitat
python3 -m tinytuya scan

Zitat
fhem@FHEM:/root$ python3 -m tinytuya scan

TinyTuya (Tuya device scanner) [1.7.1]

Scanning on UDP ports 6666 and 6667 for devices (15 retries)...

Unknown v3.3 Device   Product ID = key8u54q9dtru5jw  [Valid payload]:
    Address = 192.168.178.20,  Device ID = bfb7dd28425a8ede0078z3, Local Key = ,  Version = 3.3, MAC =
    No Stats for 192.168.178.20: DEVICE KEY required to poll for status

Scan Complete!  Found 1 devices.

>> Saving device snapshot data to snapshot.json

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/opt/fhem/.local/lib/python3.7/site-packages/tinytuya/__main__.py", line 57, in <module>
    scanner.scan(color=color, forcescan=force)
  File "/opt/fhem/.local/lib/python3.7/site-packages/tinytuya/scanner.py", line 81, in scan
    devices(verbose=True, maxretry=maxretry, color=color, poll=True, forcescan=forcescan)
  File "/opt/fhem/.local/lib/python3.7/site-packages/tinytuya/scanner.py", line 431, in devices
    with open(SNAPSHOTFILE, "w") as outfile:
PermissionError: [Errno 13] Permission denied: 'snapshot.json'

In welchem Ordner sollte die Snapshot.json abgelegt sein ?
RaPi 4 / Buster / FHEM 6
CUL868 / JeeLink868
Banana M1 (Bananian) + ser2net + Stiebel Eltron LWZ403
FIRMATA -> Gartenbewässerung /-licht
ALEXA

ahermann86

ZitatVerstehe ich es richtig, dass aber trotz "Initializing..." die Werte aktualisiert werden?

Ja, du brauchst danach auch noch Zugriff auf die Cloud. Dort werden bei jedem Start die Infos geladen. Das könnte ich durchaus entfernen wenn die Readings einmalig geladen wurden.

@dominik:
Nein, der state springt irgendwann (vermutlich, sobald der Sensor einmal online gegangen ist) auf ready. Das geht aber nur bis zu der Version 0.1.504. Mit einer neueren, wird der state nie ready und es kommen damit auch keine Readings bzw. werden nie aktualisiert.

Mit tuya (lokal) hatte ich es so verstanden, dass die Sensoren komplett offline funktionieren

dominik

Zitat von: Mazz78 am 21 November 2022, 07:27:17
Ja richtig, der scan_devices liefert gar nichts (hatte ich ja schon geschrieben)
Hier das Ergebnis von...
In welchem Ordner sollte die Snapshot.json abgelegt sein ?

Dein Login für die Cloud ist sicher korrekt und du hast auch die Verknüpfung deines Kontos in der App mit der Cloud gemacht?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Zitat von: ahermann86 am 21 November 2022, 09:43:30
@dominik:
Nein, der state springt irgendwann (vermutlich, sobald der Sensor einmal online gegangen ist) auf ready. Das geht aber nur bis zu der Version 0.1.504. Mit einer neueren, wird der state nie ready und es kommen damit auch keine Readings bzw. werden nie aktualisiert.

Mit tuya (lokal) hatte ich es so verstanden, dass die Sensoren komplett offline funktionieren

Kommt bei dir in den neueren Version eine Fehlermeldung im Log dazu?
Z.B. sowas wie bei jfmennedy hier: https://github.com/fhempy/fhempy/issues/106
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

denis.robel

bei meinem Tuya Thermostat kommt folgendes im Log:


2022.11.21 17:19:23 4: BindingsIo (fhempy_local): <<< WS: {"result":"tuya_spec_functions tuya_spec_status dp_01:switch,temp_set,temp_current,mode,child_lock dp_02:switch,temp_set,temp_current,mode,child_lock dp_03:switch,temp_set,temp_current,mode,child_lock dp_04:switch,temp_set,temp_current,mode,child_lock dp_08:switch,temp_set,temp_current,mode,child_lock dp_05:switch,temp_set,temp_current,mode,child_lock dp_13:switch,temp_set,temp_current,mode,child_lock dp_16:switch,temp_set,temp_current,mode,child_lock dp_20:switch,temp_set,temp_current,mode,child_lock dp_21:switch,temp_set,temp_current,mode,child_lock dp_25:switch,temp_set,temp_current,mode,child_lock dp_26:switch,temp_set,temp_current,mode,child_lock dp_31:switch,temp_set,temp_current,mode,child_lock dp_41:switch,temp_set,temp_current,mode,child_lock dp_42:switch,temp_set,temp_current,mode,child_lock dp_101:switch,temp_set,temp_current,mode,child_lock dp_105:switch,temp_set,temp_current,mode,child_lock dp_107:switch,temp_set,temp_current,mode,child_lock IODev:fhempy_local,fhempy_peer_192_168_179_32 event-aggregator event-min-interval event-on-change-reading event-on-update-reading oldreadings stateFormat:textField-long timestamp-on-change-reading","error":0,"awaitId":66269478}
2022.11.21 17:19:23 4: BindingsIo (fhempy_local): <<< WS: {"awaitId":18010712,"error":0,"result":"[{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch'}, {'code': 'temp_set', 'dp_id': 2, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 700, 'scale': 1, 'step': 1}, 'desc': 'temp set'}, {'code': 'mode', 'dp_id': 4, 'type': 'Enum', 'values': {'range': ['cold', 'hot', 'wind', 'comfortable', 'energy', 'auto', 'holiday', 'eco', 'manual', 'sleep', 'dry', 'program', 'floor_heat', 'auxiliary_heat']}, 'desc': 'mode'}, {'code': 'child_lock', 'dp_id': 8, 'type': 'Boolean', 'values': {}, 'desc': 'child lock'}]"}
2022.11.21 17:19:23 4: BindingsIo (fhempy_local): <<< WS: {"result":"[{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'temp_set', 'dp_id': 2, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 700, 'scale': 1, 'step': 1}}, {'code': 'temp_current', 'dp_id': 3, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 999, 'scale': 1, 'step': 1}}, {'code': 'mode', 'dp_id': 4, 'type': 'Enum', 'values': {'range': ['cold', 'hot', 'wind', 'comfortable', 'energy', 'auto', 'holiday', 'eco', 'manual', 'sleep', 'dry', 'program', 'floor_heat', 'auxiliary_heat']}}, {'code': 'child_lock', 'dp_id': 8, 'type': 'Boolean', 'values': {}}]","awaitId":86853090,"error":0}

VG

Denis

Paul_M

Zitat von: dominik am 20 November 2022, 12:27:29
Schau mal im fhempy Log (/opt/fhem/log/fhempy....log) was dort drin steht. Nach scan_devices solltest du alle Infos in den Readings erhalten. Sobald die da sind, kannst du im setup Device ein create machen und damit die Devices selbst anlegen. Das Setup Device ist nur ein Management Device mit dem man die Devices erstellt.

Alsoo, leider kann ich mit dem Log nicht so viel anfangen und bin wieder auf dich, Dominik angewiesen.

2022-11-21 20:44:34,868 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.508...
2022-11-21 20:44:34,875 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
Traceback (most recent call last):
  File "/opt/fhem/FHEM/bindings/python/bin/fhempy", line 155, in <module>
    fpb.run()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 708, in run
    loop.run_until_complete(async_main())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 616, in async_main
    async with websockets.serve(
  File "/opt/fhem/.local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1070, in __aenter__
    return await self
  File "/opt/fhem/.local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1088, in __await_impl__
    server = await self._create_server()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1494, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 15733): address already in use


Vielleicht sagt dir das ja was.
VIELEN DANK für deine Mühe!!! Das weiß ich, und sicherlich auch viele andere hier sehr zu schätzen  ;)

dominik

Zitat von: denis.robel am 21 November 2022, 17:21:57
bei meinem Tuya Thermostat kommt folgendes im Log:


2022.11.21 17:19:23 4: BindingsIo (fhempy_local): <<< WS: {"result":"tuya_spec_functions tuya_spec_status dp_01:switch,temp_set,temp_current,mode,child_lock dp_02:switch,temp_set,temp_current,mode,child_lock dp_03:switch,temp_set,temp_current,mode,child_lock dp_04:switch,temp_set,temp_current,mode,child_lock dp_08:switch,temp_set,temp_current,mode,child_lock dp_05:switch,temp_set,temp_current,mode,child_lock dp_13:switch,temp_set,temp_current,mode,child_lock dp_16:switch,temp_set,temp_current,mode,child_lock dp_20:switch,temp_set,temp_current,mode,child_lock dp_21:switch,temp_set,temp_current,mode,child_lock dp_25:switch,temp_set,temp_current,mode,child_lock dp_26:switch,temp_set,temp_current,mode,child_lock dp_31:switch,temp_set,temp_current,mode,child_lock dp_41:switch,temp_set,temp_current,mode,child_lock dp_42:switch,temp_set,temp_current,mode,child_lock dp_101:switch,temp_set,temp_current,mode,child_lock dp_105:switch,temp_set,temp_current,mode,child_lock dp_107:switch,temp_set,temp_current,mode,child_lock IODev:fhempy_local,fhempy_peer_192_168_179_32 event-aggregator event-min-interval event-on-change-reading event-on-update-reading oldreadings stateFormat:textField-long timestamp-on-change-reading","error":0,"awaitId":66269478}
2022.11.21 17:19:23 4: BindingsIo (fhempy_local): <<< WS: {"awaitId":18010712,"error":0,"result":"[{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch'}, {'code': 'temp_set', 'dp_id': 2, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 700, 'scale': 1, 'step': 1}, 'desc': 'temp set'}, {'code': 'mode', 'dp_id': 4, 'type': 'Enum', 'values': {'range': ['cold', 'hot', 'wind', 'comfortable', 'energy', 'auto', 'holiday', 'eco', 'manual', 'sleep', 'dry', 'program', 'floor_heat', 'auxiliary_heat']}, 'desc': 'mode'}, {'code': 'child_lock', 'dp_id': 8, 'type': 'Boolean', 'values': {}, 'desc': 'child lock'}]"}
2022.11.21 17:19:23 4: BindingsIo (fhempy_local): <<< WS: {"result":"[{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'temp_set', 'dp_id': 2, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 700, 'scale': 1, 'step': 1}}, {'code': 'temp_current', 'dp_id': 3, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 999, 'scale': 1, 'step': 1}}, {'code': 'mode', 'dp_id': 4, 'type': 'Enum', 'values': {'range': ['cold', 'hot', 'wind', 'comfortable', 'energy', 'auto', 'holiday', 'eco', 'manual', 'sleep', 'dry', 'program', 'floor_heat', 'auxiliary_heat']}}, {'code': 'child_lock', 'dp_id': 8, 'type': 'Boolean', 'values': {}}]","awaitId":86853090,"error":0}



Poste bitte ein List vom Device (Keys entfernen).
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Zitat von: Paul_M am 21 November 2022, 21:31:10
Alsoo, leider kann ich mit dem Log nicht so viel anfangen und bin wieder auf dich, Dominik angewiesen.

2022-11-21 20:44:34,868 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.508...
2022-11-21 20:44:34,875 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
Traceback (most recent call last):
  File "/opt/fhem/FHEM/bindings/python/bin/fhempy", line 155, in <module>
    fpb.run()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 708, in run
    loop.run_until_complete(async_main())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 616, in async_main
    async with websockets.serve(
  File "/opt/fhem/.local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1070, in __aenter__
    return await self
  File "/opt/fhem/.local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1088, in __await_impl__
    server = await self._create_server()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1494, in create_server
    raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('0.0.0.0', 15733): address already in use


Vielleicht sagt dir das ja was.
VIELEN DANK für deine Mühe!!! Das weiß ich, und sicherlich auch viele andere hier sehr zu schätzen  ;)

Dafür muss ich echt mal eine schönere Fehlermeldung bauen ;)

Es läuft bereits ein fhempy welches den Port 15733 nutzt und daher kann fhempy nicht starten. Einfach die andere Instanz stoppen oder mit kill -9 killen.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Paul_M

Zitat von: dominik am 21 November 2022, 23:22:32
Dafür muss ich echt mal eine schönere Fehlermeldung bauen ;)

Es läuft bereits ein fhempy welches den Port 15733 nutzt und daher kann fhempy nicht starten. Einfach die andere Instanz stoppen oder mit kill -9 killen.

Alles klar, hat geklappt, es läuft jetzt normal ohne die ganze Zeit start-stop...

AAAABER folgendes...

Module failed to load: tuya Maybe you need to update fhempy on this or remote peer. Stacktrace: Traceback (most recent call last): File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 320, in handle_function module_object = await self.import_module(hash) File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 527, in import_module module_object = await utils.run_blocking( File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/utils.py", line 35, in run_blocking return await asyncio.get_event_loop().run_in_executor(pool, function) File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 7, in from tinytuya import BulbDevice, Cloud, deviceScan File "/opt/fhem/.local/lib/python3.9/site-packages/tinytuya/__init__.py", line 92, in from .core import * File "/opt/fhem/.local/lib/python3.9/site-packages/tinytuya/core.py", line 66, in from colorama import init ModuleNotFoundError: No module named 'colorama

Das wird mir jetzt beim tuya_system angezeigt. fhempy_local und fhempyserver_15733 sind beide grün... Haste noch eine Idee?

denis.robel

#311
Hallo Dominik,

hier das device list von dem Thermostat: EDIT: also dem Tuya Raumthermostat für die Fussbodenheizung, kein eq3bt.


Internals:
   DEF        tuya gw173aldekvpzalg bfe1335a2d7c86bc93xitg 192.168.179.239 6baa6d3c25995f4a 3.3 [API_KEY] [API_SECRET]
   DEVICEID   bfe1335a2d7c86bc93xitg
   FHEMPYTYPE tuya
   FUUID      6378b20b-f33f-3305-ca0b-5454a756c99c18a1
   IODev      fhempy_local
   NAME       tuya_local_bfe1335a2d7c86bc93xitg
   NR         788
   PYTHONTYPE tuya
   STATE      Initializing...
   TYPE       fhempy
   eventCount 3
   CHANGED:
   READINGS:
     2022-11-19 11:38:05   active_time     1657354229
     2022-11-19 11:38:05   biz_type        0
     2022-11-19 11:38:05   category        wk
     2022-11-19 11:38:05   child_lock      off
     2022-11-19 11:38:05   create_time     1657354229
     2022-11-21 17:23:57   dp_05           0
     2022-11-19 11:38:05   dp_101          0
     2022-11-19 11:38:05   dp_105          10
     2022-11-19 11:38:05   dp_107          35
     2022-11-19 11:38:05   dp_13           1
     2022-11-19 11:38:05   dp_16           0
     2022-11-19 11:38:05   dp_20           -20
     2022-11-19 11:38:05   dp_21           30
     2022-11-19 11:38:05   dp_25           2
     2022-11-19 11:38:05   dp_26           0
     2022-11-19 11:38:05   dp_31           0
     2022-11-19 11:38:05   dp_41           1
     2022-11-19 11:38:05   dp_42           1
     2022-11-19 11:38:05   icon            smart/program_category_icon/wk.png
     2022-11-19 11:38:05   id              bfe1335a2d7c86bc93xitg
     2022-11-19 11:38:05   ip              79.246.120.203
     2022-11-19 11:38:05   lat             0.0000
     2022-11-19 11:38:05   local_key       [API_KEY] [API_SECRET]
     2022-11-19 11:38:05   lon             0.0000
     2022-11-19 11:38:05   mode            cold
     2022-11-19 11:38:05   model           Temp
     2022-11-19 11:38:05   name            Temp
     2022-11-22 14:03:26   online          1
     2022-11-19 11:38:05   owner_id        60699953
     2022-11-19 11:38:05   product_id      gw173aldekvpzalg
     2022-11-19 11:38:05   product_name    Temp
     2022-11-22 14:03:25   state           Initializing...
     2022-11-19 11:38:05   sub             0
     2022-11-21 23:10:00   switch          off
     2022-11-21 23:10:00   temp_current    19.6
     2022-11-19 11:38:05   temp_set        20.4
     2022-11-19 11:38:05   time_zone       +02:00
     2022-11-19 11:38:05   uid             eu1657214536858UvzcG
     2022-11-19 11:38:05   update_time     1657354232
     2022-11-19 11:38:05   uuid            31a10241444d8401
   args:
     tuya_local_bfe1335a2d7c86bc93xitg
     fhempy
     tuya
     gw173aldekvpzalg
     bfe1335a2d7c86bc93xitg
     192.168.179.239
     6baa6d3c25995f4a
     3.3
     mrhacrhhkjayq4gjhf7y
     3ea6d5f6213e4bcfa3d4a51e51d8d35a
   argsh:
Attributes:
   alias      Temp
   dp_01      switch
   dp_02      temp_set
   dp_03      temp_current
   dp_04      mode
   dp_08      child_lock
   group      Fussbodenheizung,fhempy,tuya
   room       Heizung,Kinderzimmer Jannik,Rhasspy,fhempy
   tuya_spec_functions [{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch'}, {'code': 'temp_set', 'dp_id': 2, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 700, 'scale': 1, 'step': 1}, 'desc': 'temp set'}, {'code': 'mode', 'dp_id': 4, 'type': 'Enum', 'values': {'range': ['cold', 'hot', 'wind', 'comfortable', 'energy', 'auto', 'holiday', 'eco', 'manual', 'sleep', 'dry', 'program', 'floor_heat', 'auxiliary_heat']}, 'desc': 'mode'}, {'code': 'child_lock', 'dp_id': 8, 'type': 'Boolean', 'values': {}, 'desc': 'child lock'}]
   tuya_spec_status [{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'temp_set', 'dp_id': 2, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 700, 'scale': 1, 'step': 1}}, {'code': 'temp_current', 'dp_id': 3, 'type': 'Integer', 'values': {'unit': '℃', 'min': 0, 'max': 999, 'scale': 1, 'step': 1}}, {'code': 'mode', 'dp_id': 4, 'type': 'Enum', 'values': {'range': ['cold', 'hot', 'wind', 'comfortable', 'energy', 'auto', 'holiday', 'eco', 'manual', 'sleep', 'dry', 'program', 'floor_heat', 'auxiliary_heat']}}, {'code': 'child_lock', 'dp_id': 8, 'type': 'Boolean', 'values': {}}]

VG

Denis

dominik

Zitat von: Paul_M am 22 November 2022, 18:14:38
Alles klar, hat geklappt, es läuft jetzt normal ohne die ganze Zeit start-stop...

AAAABER folgendes...

Module failed to load: tuya Maybe you need to update fhempy on this or remote peer. Stacktrace: Traceback (most recent call last): File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 320, in handle_function module_object = await self.import_module(hash) File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/fhem_pythonbinding.py", line 527, in import_module module_object = await utils.run_blocking( File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/utils.py", line 35, in run_blocking return await asyncio.get_event_loop().run_in_executor(pool, function) File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 790, in exec_module File "", line 228, in _call_with_frames_removed File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 7, in from tinytuya import BulbDevice, Cloud, deviceScan File "/opt/fhem/.local/lib/python3.9/site-packages/tinytuya/__init__.py", line 92, in from .core import * File "/opt/fhem/.local/lib/python3.9/site-packages/tinytuya/core.py", line 66, in from colorama import init ModuleNotFoundError: No module named 'colorama

Das wird mir jetzt beim tuya_system angezeigt. fhempy_local und fhempyserver_15733 sind beide grün... Haste noch eine Idee?

Spannend, das Modul sollte automatisch installiert werden.
Probier mal:

sudo -u fhem bash
pip3 install colorama
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

ahermann86

#313
ZitatKommt bei dir in den neueren Version eine Fehlermeldung im Log dazu?
Z.B. sowas wie bei jfmennedy hier: https://github.com/fhempy/fhempy/issues/106

Hallo Dominik,

Ich habe gestern mein Testsystem um ~20:48 von der Version 0.1.504 auf die Version 0.1.522 geupdatet. Seitdem steht der Temperatursensor dauerhaft auf "Initialzing...!

Ich habe hierzu die fhemy Logdatei angehängt.

Was ich auch nicht verstehe, bei der fhempy Definition muss ich zwingend  [VERSION] [API_KEY] [API_SECRET] angeben. Warum geht das nicht ohne? Hängt das damit zusammen, dass das ganze nur online mit der tuya Cloud funktioniert (was ich ja eigentlich vermeiden wollte...)?

Gruß Axel

dominik

Background API_KEY, API_SECRET
VERSION API_KEY API_SECRET werden benötigt, damit die Mappings der DPs (Data Points) auf einen Namen stattfinden. Ansonsten hättest du nur
dp_1
dp_20
dp_24
als Reading, so hast du
state
current
colour
als Beispiel. Genauso kann die Umrechnung eines DP Wertes nur erfolgen, wenn bekannt ist was für ein Wert es ist. dp_24 Colour ist ein Hexstring und muss umgerechnet werden. Es ist aber nicht bei jedem Device dp_24 Colour. Jeder Hersteller macht da sein eigenes Ding.

Nachdem man das Mapping hat, werden die Command NUR lokale gesendet. Nur bei einem Neustart von fhempy werden die Mappings nochmals aus der Cloud gezogen.

Es gibt nur eine Möglichkeit komplett ohne Cloud auszukommen:
1. Man muss den local key wissen (ohne dem geht garnix!)
2. Das Device muss in den Mappings hinterlegt sein (https://raw.githubusercontent.com/fhempy/fhempy/master/FHEM/bindings/python/fhempy/lib/tuya/mappings.py).
In so einem Fall werden die Mappings aus den hinterlegten Mappings genommen.

Nun zum Thema "Initializing..."
Seite Version 505 wird das state erst auf ready gesetzt wenn es Werte vom Device erhält. Daher kann es vorkommen, dass es länger auf "Initializing..." steht. Dein Thermostat hat aber bisher auch laufend Werte geschickt, daher wundert es mich, dass es so lange dauert.
Teste es bitte nochmals mit fhempy 504 (sudo -u fhem pip3 install fhempy==0.1.504).
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik