fhempy: Tuya Cloud

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

Vorheriges Thema - Nächstes Thema

bewa58

Hallo Zusammen,

das System legte teilweise keine neuen Devices an !

Lösung:  Devicenamen: auf die Restrictionen von FHEM achten (z.B.: kein Backslash) war bei mir so.

@dominik: kann hier vielleicht ein Fehlercode angezeigt werden? Oder direkt in die richtige Form umwandeln?

xypzo

#316
Ok just tried to install all of this, i cant get the fileserver to start, the only thing my fhempy log says is:

File "FHEM/bindings/python/bin/fhempy", line 87
    logging.getLogger(__name__).info(f"Successfully installed {package}")
                                                                       ^
SyntaxError: invalid syntax


NOTE, i am a copy/paster, not a coder! :P

My defmod is:
defmod tuya_cloud_connector fhempy tuya_cloud setup clientIDcodehere Clientsecrethere emailhere@gmail.com passwordhere tuyaSmart Europe

dominik

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

bewa58

#318
@dominik

leider kann ich meine GU10 RGBW mit FHEM nicht die Farben einstellen und schalten.
Entsprechend funktioniert auch die Einbindung in "Lightscene" nicht richtig. Hier kann ich nur
ON/OFF schalten

bright_value etc. funktioniert.

Auch die Schaltung aus der Tuya-Cloud funktioniert.
Hast du eine Idee was ich ändern muss?

Bernd
ZitatInternals:
   DEF        tuya_cloud tuya_cloud_connectorNEU 02200318600194719d4c
   DEVICEID   02200318600194719d4c
   FHEMPYTYPE tuya_cloud
   FUUID      61815a43-f33f-f967-fea3-51e97d1c582b3644
   FVERSION   10_PythonModule.pm:0.182830/2019-01-16
   IODev      local_pybinding
   NAME       A70RGBW_A2_02200318600194719d4c
   NR         534
   PYTHONTYPE tuya_cloud
   STATE      off
   TYPE       PythonModule
   READINGS:
     2021-11-04 15:03:25   active_time     1635785872
     2021-11-04 15:03:25   biz_type        18
     2021-11-06 16:14:10   bright_value    130.0
     2021-11-04 15:03:25   category        dj
     2021-11-06 16:14:10   colour_data     28a-3ef28a
     2021-11-04 15:03:25   create_time     1635577443
     2021-11-06 16:14:10   flash_scene_1   {"bright":255,"frequency":80,"hsv":[{"h":120.0,"s":255.0,"v":255.0}],"temperature":255}
     2021-11-06 16:14:10   flash_scene_2   {"bright":255,"frequency":128,"hsv":[{"h":0.0,"s":255.0,"v":255.0},{"h":120.0,"s":255.0,"v":255.0},{"h":240.0,"s":255.0,"v":255.0},{"h":0.0,"s":0.0,"v":0.0},{"h":0.0,"s":0.0,"v":0.0},{"h":0.0,"s":0.0,"v":0.0}],"temperature":255}
     2021-11-06 16:14:10   flash_scene_3   {"bright":255,"frequency":80,"hsv":[{"h":0.0,"s":255.0,"v":255.0}],"temperature":255}
     2021-11-06 16:14:10   flash_scene_4   {"bright":255,"frequency":5,"hsv":[{"h":0.0,"s":255.0,"v":255.0},{"h":120.0,"s":255.0,"v":255.0},{"h":60.0,"s":255.0,"v":255.0},{"h":300.0,"s":255.0,"v":255.0},{"h":240.0,"s":255.0,"v":255.0},{"h":0.0,"s":0.0,"v":0.0}],"temperature":255}
     2021-11-04 15:03:25   icon            https://images.tuyaeu.com/smart/icon/1502765611_0.png
     2021-11-04 15:03:25   id              02200318600194719d4c
     2021-11-04 15:03:25   ip              95.88.176.139
     2021-11-04 15:03:25   lat             50.4420
     2021-11-04 15:03:25   local_key       762e2286f8f6a942
     2021-11-04 15:03:25   lon             7.5621
     2021-11-04 15:03:25   model           
     2021-11-04 15:03:25   name            A70RGBW_A2
     2021-11-04 15:03:25   online          on
     2021-11-04 15:03:25   owner_id        1048434
     2021-11-04 15:03:25   product_id      HGZ7aIKOHk99IAoA
     2021-11-04 15:03:25   product_name    io-WiFiA70/GU10
     2021-11-06 16:14:10   scene_data      {"h":0.0,"s":0.0,"v":0.0}
     2021-11-06 16:14:10   state           off
     2021-11-04 15:03:25   sub             off
     2021-11-06 16:14:10   temp_value      255.0
     2021-11-04 15:03:25   time_zone       +01:00
     2021-11-04 15:03:25   uid             eu1523555094960JvBlL
     2021-11-04 15:03:25   update_time     1635866825
     2021-11-04 15:03:25   uuid            02200318600194719d4c
     2021-11-06 16:14:10   work_mode       colour
   args:
     A70RGBW_A2_02200318600194719d4c
     PythonModule
     tuya_cloud
     tuya_cloud_connectorNEU
     02200318600194719d4c
   argsh:
Attributes:
   alias      A70RGBW_A2
   group      tuya_cloud
   room       fhempy

dominik

Was hast du für Set Commands?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

xypzo

Zitat von: dominik am 06 November 2021, 00:25:52
You need Python 3 instead of Python 2:
https://github.com/dominikkarall/fhempy#fhempy-beta

I did before i wrote this message, also removed all 3 fempy "defines" from fhem en reinstalled them, still no change

pi@raspberrypi:~ $ sudo apt install python3 python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.5.3-1).
python3-pip is already the newest version (9.0.1-2+rpt2).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
pi@raspberrypi:~ $ python --version
Python 3.10.0


dominik

Do also a check with
python3 --version
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

bewa58

#322
meine Set-Commands sind:

bright_value
Colour-data
flash_scene_1   bis _4
off
on
scene_data
work_mode

schau dir bitte mal bei meinem List die colour_data an?
die sind irgendwie kryptisch? die anderen sehen ganz anders aus?

HSV? HUE? RGB? wegen "Lightscene?
anbei noch n list-r
Zitatdefine A70RGBW_A1_02200318600194717fa9 PythonModule tuya_cloud tuya_cloud_connectorNEU 02200318600194717fa9
attr A70RGBW_A1_02200318600194717fa9 userattr lightSceneParamsToSave lightSceneRestoreOnlyIfChanged:1,0
attr A70RGBW_A1_02200318600194717fa9 alias A70RGBW_A1
attr A70RGBW_A1_02200318600194717fa9 genericDeviceType light
attr A70RGBW_A1_02200318600194717fa9 group tuya_cloud
attr A70RGBW_A1_02200318600194717fa9 room fhempy

setstate A70RGBW_A1_02200318600194717fa9 on
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 active_time 1635785914
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 biz_type 18
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 bright_value 255.0
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 category dj
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 colour_data 68-30528a
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 create_time 1635577439
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 flash_scene_1 {"bright":255,"frequency":80,"hsv":[{"h":120.0,"s":255.0,"v":255.0}],"temperature":255}
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 flash_scene_2 {"bright":255,"frequency":128,"hsv":[{"h":0.0,"s":255.0,"v":255.0},{"h":120.0,"s":255.0,"v":255.0},{"h":240.0,"s":255.0,"v":255.0},{"h":0.0,"s":0.0,"v":0.0},{"h":0.0,"s":0.0,"v":0.0},{"h":0.0,"s":0.0,"v":0.0}],"temperature":255}
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 flash_scene_3 {"bright":255,"frequency":80,"hsv":[{"h":0.0,"s":255.0,"v":255.0}],"temperature":255}
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 flash_scene_4 {"bright":255,"frequency":5,"hsv":[{"h":0.0,"s":255.0,"v":255.0},{"h":120.0,"s":255.0,"v":255.0},{"h":60.0,"s":255.0,"v":255.0},{"h":300.0,"s":255.0,"v":255.0},{"h":240.0,"s":255.0,"v":255.0},{"h":0.0,"s":0.0,"v":0.0}],"temperature":255}
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 icon https://images.tuyaeu.com/smart/icon/1502765611_0.png
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 id 02200318600194717fa9
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 ip 95.88.176.139
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 lat 50.4420
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 local_key cfc57ad6b6866db1
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 lon 7.5621
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 model
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 name A70RGBW_A1
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 online on
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 owner_id 1048434
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 product_id HGZ7aIKOHk99IAoA
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 product_name io-WiFiA70/GU10
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 scene_data {"h":0.0,"s":0.0,"v":0.0}
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 state on
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 sub off
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 temp_value 255.0
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 time_zone +01:00
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 uid eu1523555094960JvBlL
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 update_time 1636010249
setstate A70RGBW_A1_02200318600194717fa9 2021-11-04 15:03:25 uuid 02200318600194717fa9
setstate A70RGBW_A1_02200318600194717fa9 2021-11-07 01:01:46 work_mode colour

Gruß
Bernd

xypzo

#323
Zitat von: dominik am 07 November 2021, 14:59:38
Do also a check with
python3 --version
I made a mistake updating python3, the server is running now, but now this happens:
2021-11-09 11:15:07,539 - WARNING  - __main__: Failed to load fhempy: No module named 'fhempy'
2021-11-09 11:15:07,540 - INFO     - __main__: Attempting install of fhempy>=0.1.12
2021-11-09 11:15:27,793 - ERROR    - __main__: Unable to install package fhempy>=0.1.12: WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
ERROR: Could not find a version that satisfies the requirement fhempy>=0.1.12 (from versions: none)
ERROR: No matching distribution found for fhempy>=0.1.12
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
2021-11-09 11:15:27,794 - ERROR    - __main__: Failed to install fhempy, exit now...


It's strange because i have everything installed on the pi:
pi@raspberrypi:~ $ python3 -V
Python 3.10.0
pi@raspberrypi:~ $ openssl version
OpenSSL 1.1.0l  10 Sep 2019


EDIT: just upgraded to Buster, still same msg as above

dominik

Zitat von: bewa58 am 07 November 2021, 18:31:11
meine Set-Commands sind:

bright_value
Colour-data
flash_scene_1   bis _4
off
on
scene_data
work_mode

schau dir bitte mal bei meinem List die colour_data an?
die sind irgendwie kryptisch? die anderen sehen ganz anders aus?

HSV? HUE? RGB? wegen "Lightscene?
anbei noch n list-r
Gruß
Bernd

Wenn du colour_data set auswählst, kommt dann die RGB Auswahl?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

dominik

Zitat von: xypzo am 09 November 2021, 11:23:35
I made a mistake updating python3, the server is running now, but now this happens:
2021-11-09 11:15:07,539 - WARNING  - __main__: Failed to load fhempy: No module named 'fhempy'
2021-11-09 11:15:07,540 - INFO     - __main__: Attempting install of fhempy>=0.1.12
2021-11-09 11:15:27,793 - ERROR    - __main__: Unable to install package fhempy>=0.1.12: WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/fhempy/
ERROR: Could not find a version that satisfies the requirement fhempy>=0.1.12 (from versions: none)
ERROR: No matching distribution found for fhempy>=0.1.12
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
2021-11-09 11:15:27,794 - ERROR    - __main__: Failed to install fhempy, exit now...


It's strange because i have everything installed on the pi:
pi@raspberrypi:~ $ python3 -V
Python 3.10.0
pi@raspberrypi:~ $ openssl version
OpenSSL 1.1.0l  10 Sep 2019


EDIT: just upgraded to Buster, still same msg as above

Please set the default python 3 interpreter which is 3.7 for Buster. I assume you compiled Python 3.10 on your own and maybe you forgot some flag to activate ssl.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Sommerfeld

Hallo,
in der fhempy Logfile habe ich die folgenden Einträge.
Merkwürdig ist auch der Hinweis zum Contact_Sensor_bfe51adb47726ca7ads0pb

2021-11-12 12:12:08,005 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.193 seconds
2021-11-12 12:12:08,805 - WARNING  - asyncio: Executing <Task pending name='Task-34138' coro=<tuya_cloud_device.update() running at /opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py:266> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f97f5d46d60>()] created at /usr/lib/python3.8/asyncio/base_events.py:422> cb=[_chain_future.<locals>._call_set_state() at /usr/lib/python3.8/asyncio/futures.py:367] created at /usr/lib/python3.8/asyncio/tasks.py:922> took 0.111 seconds
2021-11-12 12:12:09,816 - WARNING  - asyncio: Executing <Handle run_coroutine_threadsafe.<locals>.callback() at /usr/lib/python3.8/asyncio/tasks.py:920 created at /usr/lib/python3.8/asyncio/tasks.py:930> took 0.520 seconds
2021-11-12 12:12:10,322 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.110 seconds
2021-11-12 12:12:10,478 - WARNING  - asyncio: Executing <Task pending name='Task-34138' coro=<tuya_cloud_device.update() running at /opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py:266> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f989c651370>()] created at /usr/lib/python3.8/asyncio/base_events.py:422> cb=[_chain_future.<locals>._call_set_state() at /usr/lib/python3.8/asyncio/futures.py:367] created at /usr/lib/python3.8/asyncio/tasks.py:922> took 0.134 seconds
2021-11-12 12:14:10,105 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to execute function Set: Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 381, in ssl_wrap_socket
OSError: [Errno 24] Too many open files

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connection.py", line 411, in connect
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/util/ssl_.py", line 383, in ssl_wrap_socket
urllib3.exceptions.SSLError: [Errno 24] Too many open files

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='openapi.tuyaeu.com', port=443): Max retries exceeded with url: /v1.0/iot-03/users/token/f1fcf5a99a15b8f50ef25c71a95e15d8 (Caused by SSLError(OSError(24, 'Too many open files')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 411, in _onMessage
    ret = await asyncio.wait_for(
  File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/generic.py", line 158, in Set
    return await utils.handle_set(self._conf_set, self, hash, args, argsh)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/utils.py", line 274, in handle_set
    return await fct_call(hash, final_params)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud.py", line 34, in set_boolean
    await self.device.set_boolean(hash, params)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 155, in set_boolean
    await self.send_commands([{"code": code, "value": onoff}])
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 202, in send_commands
    await self.tuyaiot.send_commands(self._t_deviceid, commands)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 237, in send_commands
    await utils.run_blocking(
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/utils.py", line 33, in run_blocking
    return await asyncio.get_event_loop().run_in_executor(pool, function)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/device.py", line 497, in send_commands
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/device.py", line 621, in send_commands
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 324, in post
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 238, in __request
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 164, in __refresh_access_token_if_need
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 324, in post
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 267, in __request
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/adapters.py", line 514, in send
requests.exceptions.SSLError: HTTPSConnectionPool(host='openapi.tuyaeu.com', port=443): Max retries exceeded with url: /v1.0/iot-03/users/token/f1fcf5a99a15b8f50ef25c71a95e15d8 (Caused by SSLError(OSError(24, 'Too many open files')))
(id: 18775936)
2021-11-12 12:14:10,129 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f970bc44ee0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:14:10,130 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f98b893d520>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:14:10,130 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f98137666d0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:16:02,825 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.106 seconds
2021-11-12 12:16:35,477 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.173 seconds
2021-11-12 12:17:20,648 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.105 seconds
2021-11-12 12:18:50,776 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.615 seconds
2021-11-12 12:19:36,872 - WARNING  - asyncio: Executing <TimerHandle when=239650.94416018456 _ServiceBrowserBase._async_send_ready_queries_schedule_next() created at /opt/fhem/.local/lib/python3.8/site-packages/zeroconf/_services/browser.py:485> took 0.400 seconds
2021-11-12 12:21:52,291 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.125 seconds
2021-11-12 12:22:23,977 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.103 seconds
2021-11-12 12:24:56,016 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.127 seconds
2021-11-12 12:25:32,725 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.113 seconds
2021-11-12 12:25:32,934 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.110 seconds
2021-11-12 12:25:36,938 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.146 seconds
2021-11-12 12:26:26,299 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.147 seconds
2021-11-12 12:29:45,404 - ERROR    - Contact_Sensor_bfe51adb47726ca7ads0pb: unsupported operand type(s) for ** or pow(): 'int' and 'str'
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 298, in update_readings_dict
    self._convert_value2fhem(st_name, status_dic[st_name]),
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 234, in _convert_value2fhem
    return value / (10 ** values["scale"])
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'str'
2021-11-12 12:29:45,415 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f94ff0e2be0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:29:45,416 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f94ff0e29d0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:29:45,417 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f96c6092340>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:29:45,662 - ERROR    - Contact_Sensor_bfe51adb47726ca7ads0pb: unsupported operand type(s) for ** or pow(): 'int' and 'str'
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 298, in update_readings_dict
    self._convert_value2fhem(st_name, status_dic[st_name]),
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 234, in _convert_value2fhem
    return value / (10 ** values["scale"])
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'str'
2021-11-12 12:29:45,675 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f98349e6760>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:29:45,676 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9852deccd0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:29:45,676 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f9668c2ddf0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:29:54,822 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.101 seconds
2021-11-12 12:33:49,368 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.152 seconds
2021-11-12 12:35:00,113 - ERROR    - fhempy.lib.fhem_pythonbinding: Failed to execute function Set: Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/util/connection.py", line 73, in create_connection
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f965ab47ee0>: Failed to establish a new connection: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
  File "/opt/fhem/.local/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='openapi.tuyaeu.com', port=443): Max retries exceeded with url: /v1.0/devices/bf5ee44c2ba7b84276eueh/commands (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f965ab47ee0>: Failed to establish a new connection: [Errno 22] Invalid argument'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/fhem_pythonbinding.py", line 411, in _onMessage
    ret = await asyncio.wait_for(
  File "/usr/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/generic.py", line 158, in Set
    return await utils.handle_set(self._conf_set, self, hash, args, argsh)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/utils.py", line 274, in handle_set
    return await fct_call(hash, final_params)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud.py", line 34, in set_boolean
    await self.device.set_boolean(hash, params)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 155, in set_boolean
    await self.send_commands([{"code": code, "value": onoff}])
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_device.py", line 202, in send_commands
    await self.tuyaiot.send_commands(self._t_deviceid, commands)
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/tuya_cloud/tuya_cloud_setup.py", line 237, in send_commands
    await utils.run_blocking(
  File "/opt/fhem/.local/lib/python3.8/site-packages/fhempy/lib/utils.py", line 33, in run_blocking
    return await asyncio.get_event_loop().run_in_executor(pool, function)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/device.py", line 497, in send_commands
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/device.py", line 621, in send_commands
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 324, in post
  File "/opt/fhem/.local/lib/python3.8/site-packages/tuya_iot/openapi.py", line 267, in __request
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
  File "/opt/fhem/.local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='openapi.tuyaeu.com', port=443): Max retries exceeded with url: /v1.0/devices/bf5ee44c2ba7b84276eueh/commands (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f965ab47ee0>: Failed to establish a new connection: [Errno 22] Invalid argument'))
(id: 30716344)
2021-11-12 12:35:00,132 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f94e6f7c670>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:35:00,133 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f94e6f7c4f0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:35:00,133 - WARNING  - urllib3.connectionpool: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f94e6f7c6a0>: Failed to establish a new connection: [Errno 22] Invalid argument')': /api/6031048/store/
2021-11-12 12:37:04,851 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.168 seconds
2021-11-12 12:39:29,853 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.102 seconds
2021-11-12 12:41:04,747 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.116 seconds
2021-11-12 12:42:33,901 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.193 seconds
2021-11-12 12:43:48,579 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.106 seconds


Kann mir jemand helfen, was ich ändern müsste?
Vielen Dank

dominik

Hi,

hast du nur tuya_cloud im Einsatz oder auch andere Module? Mich würde nämlich interessieren, ob die hier
Zitat2021-11-12 12:37:04,851 - WARNING  - asyncio: Executing <Handle _SelectorDatagramTransport._read_ready() created at /usr/lib/python3.8/asyncio/selector_events.py:259> took 0.168 seconds
von der tuya Library kommen.

Zum Contact Sensor:
Log dich bitte auf der tuya iot Plattform ein und wähle beim Contact Sensor "Debug Device" aus - siehe Screenshot. Dann kommt ein neues Fenster und dort wählst du "Device Debugging" aus. Da kommt dann eine Übersicht - bitte Standard Status Set auswählen. Sieht z.B. so aus:
switch_1 Boolean
"{true,false}"
countdown_1 Integer
{
  "unit": "s",
  "min": 0,
  "max": 86400,
  "scale": 0,
  "step": 1
}
relay_status Enum
{
  "range": [
    "power_off",
    "power_on",
    "last"
  ]
}
cycle_time String
{}
random_time String
{}

Das kopiere bitte hier rein.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Sommerfeld

Guten Morgen Dominik,
Ja, ich habe tuya_cloud im Einsatz.
Ich nutze auch noch googlecast.
ZitatLog dich bitte auf der tuya iot Plattform ein und wähle beim Contact Sensor "Debug Device" aus - siehe Screenshot. Dann kommt ein neues Fenster und dort wählst du "Device Debugging" aus. Da kommt dann eine Übersicht - bitte Standard Status Set auswählen. Sieht z.B. so aus:
Es wird nichts angezeigt, nur die Meldung:

An unexpected error has occurred.

dominik

Wo kommt diese Fehlermeldung? Auf der iot Plattform? Poste bitte einen Screenshot dazu.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik