Autor Thema: fhempy: Tuya Cloud  (Gelesen 20125 mal)

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #45 am: 05 August 2021, 12:22:42 »
Neustart von fhempy hat auch keine Änderung gebracht? Die Readings sollten eigentlich innerhalb einer Sekunden aktualisiert werden nach dem Schalten.
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline patator

  • Jr. Member
  • **
  • Beiträge: 53
Antw:fhempy: Tuya Cloud
« Antwort #46 am: 05 August 2021, 13:01:45 »
leider nein,

2021-08-05 11:24:49,146 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-08-05 11:24:49,173 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2021-08-05 11:25:24,754 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-08-05 11:25:24,816 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2021-08-05 11:25:32,046 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
[2021-08-05 11:25:41,067] [tuya-openmq] error while get mqtt config
2021-08-05 11:25:41,067 - ERROR    - tuya iot: error while get mqtt config
2021-08-05 11:36:27,246 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-08-05 11:36:27,300 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2021-08-05 11:36:37,937 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2021-08-05 11:39:19,035 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy...
2021-08-05 11:39:19,097 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2021-08-05 11:39:26,941 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2021-08-05 11:39:27,048 - WARNING  - asyncio: Executing <Handle <TaskWakeupMethWrapper object at 0x75adc770>(<Future finis...events.py:396>) created at /usr/lib/python3.7/asyncio/streams.py:408> took 0.121 seconds
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/opt/fhem/.local/lib/python3.7/site-packages/tuya_iot/openmq.py", line 170, in run
    self.__run_mqtt()
  File "/opt/fhem/.local/lib/python3.7/site-packages/tuya_iot/openmq.py", line 184, in __run_mqtt
    mqttc = self._start(mq_config)
  File "/opt/fhem/.local/lib/python3.7/site-packages/tuya_iot/openmq.py", line 204, in _start
    mqttc.connect(url.hostname, url.port)
  File "/opt/fhem/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 941, in connect
    return self.reconnect()
  File "/opt/fhem/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1075, in reconnect
    sock = self._create_socket_connection()
  File "/opt/fhem/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 3546, in _create_socket_connection
    return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
  File "/usr/lib/python3.7/socket.py", line 727, in create_connection
    raise err
  File "/usr/lib/python3.7/socket.py", line 716, in create_connection
    sock.connect(sa)
socket.timeout: timed out

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #47 am: 05 August 2021, 14:11:04 »
Aha, er kann keine MQTT Connection zu tuya aufbauen. Hast du irgendeine Firewall oder so aktiv?
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline patator

  • Jr. Member
  • **
  • Beiträge: 53
Antw:fhempy: Tuya Cloud
« Antwort #48 am: 05 August 2021, 14:52:54 »
tatsache, danke für den Hinweis.
Port 8883 muss nach extern erlaubt sein.
Prima, danke nochmal
Gefällt mir Gefällt mir x 1 Liste anzeigen

Offline patator

  • Jr. Member
  • **
  • Beiträge: 53
Antw:fhempy: Tuya Cloud
« Antwort #49 am: 06 August 2021, 08:59:45 »
Ich würde gerne fhempy vom fhem raspberry wegbekommen.
Ich hatte ja versucht auf einer Ubuntu 20.04 Maschine fhempy mit pyhton3.8 zu implementieren.
Sobald fhem versucht zu verbinden knallts:

2021-08-06 08:57:02,897 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 10.10.20.109
2021-08-06 08:57:02,899 - 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 64, in pybinding
    await activate_internal_modules()
  File "/home/bitnami/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 47, 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

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #50 am: 06 August 2021, 17:32:04 »
Startest du fhempy per Commandline? Mach mal
fhempy --local
Dann startet es kein Zeroconf.
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #51 am: 06 August 2021, 22:21:48 »
Mach bitte mal
pip3 install zeroconf==0.28.6

Ich glaub mit 0.32.0 sind da ein paar Breaking Changes reingekommen.
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline patator

  • Jr. Member
  • **
  • Beiträge: 53
Antw:fhempy: Tuya Cloud
« Antwort #52 am: 08 August 2021, 17:00:12 »
Hallo ich habe immer wieder das Problem,
dass auf meinem Raspi keine MQTT Informationen mehr kommen.
Im fhempy Log erscheint dann:
2021-08-08 12:42:41,823 - ERROR    - tuya_cloud_connector: 'TuyaDeviceManager' object has no attribute '_on_message'
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 71, in restart_mqtt_loop
    await self.restart_mqtt()
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 81, in restart_mqtt
    tuya_mq.add_message_listener(self.device_manager._on_message)
AttributeError: 'TuyaDeviceManager' object has no attribute '_on_message'
2021-08-08 14:41:01,847 - ERROR    - tuya_cloud_connector: 'TuyaDeviceManager' object has no attribute '_on_message'
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 71, in restart_mqtt_loop
    await self.restart_mqtt()
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 81, in restart_mqtt
    tuya_mq.add_message_listener(self.device_manager._on_message)
AttributeError: 'TuyaDeviceManager' object has no attribute '_on_message'
2021-08-08 16:39:21,960 - ERROR    - tuya_cloud_connector: 'TuyaDeviceManager' object has no attribute '_on_message'
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 71, in restart_mqtt_loop
    await self.restart_mqtt()
  File "/opt/fhem/.local/lib/python3.7/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 81, in restart_mqtt
    tuya_mq.add_message_listener(self.device_manager._on_message)
AttributeError: 'TuyaDeviceManager' object has no attribute '_on_message'
Restarte ich das Pythonbinding, geht es wieder für einen Weile.
Ne Idee?

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #53 am: 08 August 2021, 17:59:52 »
Ah, da ist was bei der Tuya iot Library geändert worden. Korrigiere ich heute Abend bzw. fixiere ich dann gleich die Library Version.

//Edit
Bitte mal ein Update machen, in 0.1.82 wird nun die "alte" Tuya Library verwendet, dann klappt es wieder.
« Letzte Änderung: 08 August 2021, 18:10:19 von dominik »
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline patator

  • Jr. Member
  • **
  • Beiträge: 53
Antw:fhempy: Tuya Cloud
« Antwort #54 am: 08 August 2021, 21:38:25 »
hat geklappt danke

Offline juergen012

  • Full Member
  • ***
  • Beiträge: 347
Antw:fhempy: Tuya Cloud
« Antwort #55 am: 12 August 2021, 12:40:01 »
Hallo,
leider muss ich mich nochmal melden, da ich alleine nicht weiterkomme. Eigentlich funktioniert alles wie es soll.. Bis auf meinen smart_power_strip. Dieser hat 4 Steckdosen, die alle separat geschaltet werden können. Zusätzlich noch 4 USB Ports, die gemeinsam geschaltet werden. Bis auf die Steckdose 1 (switch1) kann ich alles schalten. Der Switch wird mir in fhem nicht angezeigt. In der App funktioniert das.

Hier das List..
DEF        tuya_cloud tuya_cloud_connector yyyyy
   DEVICEID   aaaaaaaa
   FUUID      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   IODev      local_pybinding
   NAME       smart_power_strip_xxxxxx
   NR         297
   PYTHONTYPE tuya_cloud
   STATE      off
   TYPE       PythonModule
   READINGS:
     2021-08-11 14:10:17   active_time     1626194558
     2021-08-11 14:10:17   biz_type        0
     2021-08-11 14:10:17   category        pc
     2021-08-12 12:28:11   countdown_1     0.0
     2021-08-12 12:28:11   countdown_2     0.0
     2021-08-12 12:28:11   countdown_3     0.0
     2021-08-12 12:28:11   countdown_4     0.0
     2021-08-12 12:28:11   countdown_usb1  0.0
     2021-08-11 14:10:17   create_time     1620742633
     2021-08-11 14:10:17   icon            https://images.tuyaeu.com/smart/icon/1555585425a1oqvs7elur_0.jpg
     2021-08-11 14:10:17   id              aaaaa
     2021-08-11 14:10:17   ip              11111
     2021-08-11 14:10:17   lat             53.685hhh
     2021-08-11 14:10:17   local_key       7xxxxx
     2021-08-11 14:10:17   lon             10.029nnn
     2021-08-11 14:10:17   model           A339
     2021-08-11 14:10:17   name            smart power strip
     2021-08-11 14:10:17   online          on
     2021-08-11 14:10:17   owner_id        xxxxxxxxxxxxx
     2021-08-11 14:10:17   product_id      gl5fdiv1tc9mkvlp
     2021-08-11 14:10:17   product_name    smart power strip
     2021-08-12 12:28:11   state           off
     2021-08-11 14:10:17   sub             off
     2021-08-12 12:28:11   switch_2        off
     2021-08-12 12:28:11   switch_3        off
     2021-08-12 12:28:11   switch_4        off
     2021-08-12 12:28:11   switch_usb1     off
     2021-08-11 14:10:17   time_zone       +01:00
     2021-08-11 14:10:17   uid             eu1598540337292fORIB
     2021-08-11 14:10:17   update_time     1628669008
     2021-08-11 14:10:17   uuid            xxxxxxxxxxxxxxxxxxx
   args:
     smart_power_strip_xxxxxxx
     PythonModule
     tuya_cloud
     tuya_cloud_connector
     xxxxxxxxxxxxxxxxxxxxx
   argsh:
Attributes:
   DbLogExclude .*
   alias      smart power strip
   room       tuya
   verbose    2
Wenn ich am smart_power_strip die Steckdose 1 schalte, dann wird mir das in fhem angezeigt..

Beste Grüße
Jürgen K.
Fhem im Proxmox LXC

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #56 am: 12 August 2021, 13:24:03 »
Hi,

schalte Mal direkt das Device On/Off
set smart_power_strip_xxxxxx on

Damit sollte es funktionieren.
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline juergen012

  • Full Member
  • ***
  • Beiträge: 347
Antw:fhempy: Tuya Cloud
« Antwort #57 am: 12 August 2021, 13:28:48 »
Hallo dominik,
wenn ich set smart_power_strip_xxxxxxxxxxxxxxxxxxx  switch_1 on mache, bekomme ich:  Command not available for this device.
Mit den andere Steckdosen (2-4) funktioniert das.
Fhem im Proxmox LXC

Offline dominik

  • Developer
  • Hero Member
  • ****
  • Beiträge: 2877
Antw:fhempy: Tuya Cloud
« Antwort #58 am: 12 August 2021, 13:34:21 »
Ohne switch_1, nur das Command von oben.
fhempy -  https://github.com/dominikkarall/fhempy: GoogleCast, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Offline juergen012

  • Full Member
  • ***
  • Beiträge: 347
Antw:fhempy: Tuya Cloud
« Antwort #59 am: 12 August 2021, 13:58:14 »
mit dem Kommando werden alle Steckdosen geschaltet..
Fhem im Proxmox LXC

 

decade-submarginal