fhempy: Tuya Cloud

Begonnen von dominik, 30 Juli 2021, 21:36:48

Vorheriges Thema - Nächstes Thema

dominik

Hi,

ich habe ein Modul in fhempy gebaut, welches mit allen Tuya Devices über die Cloud sprechen kann. Der große Vorteil, man bekommt real-time Updates über die Cloud und muss kein Polling der Devices machen.

Anleitung zur Einrichtung:
1. fhempy installieren
https://github.com/dominikkarall/fhempy#installation

2. Tuya einrichten
https://github.com/dominikkarall/fhempy/blob/master/FHEM/bindings/python/fhempy/lib/tuya_cloud/README.md
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

patator

#1
Hallo,

leider komme ich bei der Grundinstallation evon fhempy auf meiner fhem Instanz nicht weiter:

pi@raspberrypi:~ $ pip3 install --upgrade fhempy
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement fhempy
ERROR: No matching distribution found for fhempy


Nachtrag jetzt hab ich fhempy auf ner ubuntu 20.04 eingerichtet, aber sobald fhem darauf zugreift wirft er folgende Fehler aus:
RuntimeError: The event loop is not running
2021-07-31 08:41:34,188 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 10.10.20.109
2021-07-31 08:41:34,191 - ERROR    - websockets.server: Error in connection handler
Traceback (most recent call last):
  File "/home/bitnami/.local/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 63, in pybinding
    await activate_internal_modules()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 46, in activate_internal_modules
    await instance.activate()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 82, in activate
    await self.runZeroconfScan()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 79, in runZeroconfScan
    self.browser = ServiceBrowser(self.zeroconf, services, listener)
  File "/home/bitnami/.local/lib/python3.8/site-packages/zeroconf/_services/browser.py", line 505, in __init__
    raise RuntimeError("The event loop is not running")

dominik

Deine Python Installation ist schon end of life. Nutzt du Raspbian? Mach mal sudo apt update und dann sudo apt install python3.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

patator

habe ich bereits gemacht, hat nicht geklappt drum hab ich das auf ubuntu installiert.
defmod fhempy_remote_IP BindingsIo fhempy-ip:15733 Python

dominik

Dann ist dein Raspbian noch eine alte Distribution wahrscheinlich. Sollte Buster sein.
Jetzt hat's geklappt?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

patator

leider nein, wegen der alten buster hab ich fhempy auf ubuntu gelegt:
RuntimeError: The event loop is not running
2021-07-31 08:41:34,188 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 10.10.20.109
2021-07-31 08:41:34,191 - ERROR    - websockets.server: Error in connection handler
Traceback (most recent call last):
  File "/home/bitnami/.local/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 63, in pybinding
    await activate_internal_modules()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 46, in activate_internal_modules
    await instance.activate()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 82, in activate
    await self.runZeroconfScan()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 79, in runZeroconfScan
    self.browser = ServiceBrowser(self.zeroconf, services, listener)
  File "/home/bitnami/.local/lib/python3.8/site-packages/zeroconf/_services/browser.py", line 505, in __init__
    raise RuntimeError("The event loop is not running")


fhem versucht zu connecten, aber fhempy bringt o.g. Fehler.

dominik

Hm...mach mal
pip3 install -U websockets
pip3 install -U zeroconf
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Poste auch bitte das gesamte Log vom Start weg.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

patator

war schon drauf websocket und zeroconf

bitnami@ubuntu-04:~$ fhempy
2021-07-31 10:44:31,320 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-07-31 10:44:31,325 - INFO     - fhempy.lib.fhem_pythonbinding: Advertise fhempy on local network
2021-07-31 10:44:32,133 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection


das hier kommt in Dauerschleife während FHem versucht zu verbinden:
2021-07-31 10:45:28,470 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 10.10.20.109
2021-07-31 10:45:28,472 - ERROR    - websockets.server: Error in connection handler
Traceback (most recent call last):
  File "/home/bitnami/.local/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 63, in pybinding
    await activate_internal_modules()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 46, in activate_internal_modules
    await instance.activate()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 82, in activate
    await self.runZeroconfScan()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 79, in runZeroconfScan
    self.browser = ServiceBrowser(self.zeroconf, services, listener)
  File "/home/bitnami/.local/lib/python3.8/site-packages/zeroconf/_services/browser.py", line 505, in __init__
    raise RuntimeError("The event loop is not running")
RuntimeError: The event loop is not running

carlos

Hallo,
Ich habe eine Frage. Könnte man damit auch die Lidl Produkte ,wie den Parkside Bewässerungscomputer, der ja auch ein Tuya device ist und im Moment mit deconz/Phoscon und zigbee2mqtt nur eingeschränkt funktioniert, benutzen?
Siehe hier:

https://forum.fhem.de/index.php/topic,121983.msg1165870.html#msg1165870

Gruß Carlos
FHEM svn auf Intel NUC mit proxmox,1 UDOO, 3 Raspberry Pi, signalduino, nanoCUL, div. Homematic Komponenten, toom Baumarkt Funksteckdosen, einige sonoffs, hue, shelly

dominik

Zitat von: patator am 31 Juli 2021, 10:46:29
war schon drauf websocket und zeroconf

bitnami@ubuntu-04:~$ fhempy
2021-07-31 10:44:31,320 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-07-31 10:44:31,325 - INFO     - fhempy.lib.fhem_pythonbinding: Advertise fhempy on local network
2021-07-31 10:44:32,133 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection


das hier kommt in Dauerschleife während FHem versucht zu verbinden:
2021-07-31 10:45:28,470 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 10.10.20.109
2021-07-31 10:45:28,472 - ERROR    - websockets.server: Error in connection handler
Traceback (most recent call last):
  File "/home/bitnami/.local/lib/python3.8/site-packages/websockets/legacy/server.py", line 293, in handler
    await self.ws_handler(self, path)
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 63, in pybinding
    await activate_internal_modules()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 46, in activate_internal_modules
    await instance.activate()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 82, in activate
    await self.runZeroconfScan()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/core/discover_fhempy/discover_fhempy.py", line 79, in runZeroconfScan
    self.browser = ServiceBrowser(self.zeroconf, services, listener)
  File "/home/bitnami/.local/lib/python3.8/site-packages/zeroconf/_services/browser.py", line 505, in __init__
    raise RuntimeError("The event loop is not running")
RuntimeError: The event loop is not running


Hast du fhempy mit dem bitnami User installiert, oder als root/sudo?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Zitat von: carlos am 31 Juli 2021, 10:47:55
Hallo,
Ich habe eine Frage. Könnte man damit auch die Lidl Produkte ,wie den Parkside Bewässerungscomputer, der ja auch ein Tuya device ist und im Moment mit deconz/Phoscon und zigbee2mqtt nur eingeschränkt funktioniert, benutzen?
Siehe hier:

https://forum.fhem.de/index.php/topic,121983.msg1165870.html#msg1165870

Gruß Carlos

Wenn es ein tuya device ist, sollte es problemlos funktionieren.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

patator

Zitat von: dominik am 31 Juli 2021, 13:05:43
Hast du fhempy mit dem bitnami User installiert, oder als root/sudo?

ich habe beide probiert

Udomatic

#13
Zitat von: dominik am 31 Juli 2021, 13:50:35
Wenn es ein tuya device ist, sollte es problemlos funktionieren.

Cooles Modul! Danke Schön für die Arbeit! Installation hat soweit funktioniert!

Ich sehe auch den Parkside Bewässerungscomputer. Sollten zu dem Gerät noch Readings kommen wie die z.B. der Countdown? (Gerät wird über das Silvercrest Gateway in Smart Life / Tuya eingebunden)

In Tuya IoT unter Device Debug sehe ich, dass die eingestellte Bewässerungszeit mit der DP ID Countdown geführt wird.

In der folge wäre es natürlich richtig cool, wenn der Countdown geändert werden könnte über ein FHEM Attribut??

Mehr als ein Ready sehe ich bisher nicht im Device


Internals:
   CFGFN     
   DEF        tuya_cloud tuya_cloud_connector xxxxxxx
   DEVICEID   xxxxxxx
   FUUID      61055fcd-f33f-6bbc-f1d4-8834b43445578c63
   IODev      local_pybinding
   NAME       Wassercomputer_xxxxx
   NR         32
   PYTHONTYPE tuya_cloud
   STATE      ready
   TYPE       PythonModule
   READINGS:
     2021-07-31 16:35:58   state           ready
   args:
     Wassercomputer_xxxxxx
     PythonModule
     tuya_cloud
     tuya_cloud_connector
     xxxxxxx
   argsh:
Attributes:
   alias      Wassercomputer


2x Raspberry 3B+, 1x Raspberry 4, Signalduino 433 (Somfy), CUL_HM (HM-MOD-RPI-PCB), MQTT, Hue, ConBee 2, Sonos, AVM DECT, Netatmo, eufy, Nuki,

dominik

#14
Aha, da fehlen scheinbar noch die Infos aus der Tuya Cloud.
Wäre es ok, wenn du mir per PN die Daten zum Testen schickst? So kommen wir wahrscheinlich am schnellsten weiter.

//Edit: Oder du kannst mir das Device in der SmartLife App teilen, habe ich zwar noch nicht probiert, aber müsste auch klappen.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik