fhempy: tuya (lokal)

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

Vorheriges Thema - Nächstes Thema

thburkhart

sodele .. ich habe nun den SP04 nochmals local suchen lassen.

nun liest er Daten :-)

lösche nun das alte Device und benenne um

1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

thburkhart

allerdings kommt nix mit power oder energy

[code]define tuya_local_045074212462ab24e988 fhempy tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3
attr tuya_local_045074212462ab24e988 DbLogExclude .*
attr tuya_local_045074212462ab24e988 alias SP04 Spuelmaschine
attr tuya_local_045074212462ab24e988 dp_01 switch_1
attr tuya_local_045074212462ab24e988 dp_09 countdown_1
attr tuya_local_045074212462ab24e988 dp_17 add_ele
attr tuya_local_045074212462ab24e988 dp_18 cur_current
attr tuya_local_045074212462ab24e988 dp_19 cur_power
attr tuya_local_045074212462ab24e988 dp_20 cur_voltage
attr tuya_local_045074212462ab24e988 event-on-change-reading .*
attr tuya_local_045074212462ab24e988 group tuya
attr tuya_local_045074212462ab24e988 room fhempy
attr tuya_local_045074212462ab24e988 tuya_spec_functions [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch 1'}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}, 'desc': 'countdown 1'}]
attr tuya_local_045074212462ab24e988 tuya_spec_status [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}}, {'code': 'add_ele', 'dp_id': 17, 'type': 'Integer', 'values': {'unit': '', 'min': 0, 'max': 50000, 'scale': 3, 'step': 100}}, {'code': 'cur_current', 'dp_id': 18, 'type': 'Integer', 'values': {'unit': 'mA', 'min': 0, 'max': 30000, 'scale': 0, 'step': 1}}, {'code': 'cur_power', 'dp_id': 19, 'type': 'Integer', 'values': {'unit': 'W', 'min': 0, 'max': 50000, 'scale': 1, 'step': 1}}, {'code': 'cur_voltage', 'dp_id': 20, 'type': 'Integer', 'values': {'unit': 'V', 'min': 0, 'max': 5000, 'scale': 1, 'step': 1}}]
#   DEF        tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3 ea8453wdazquzfl08l0e 8a4b27dd759d4c6a9456aa8155d2a0ea
#   DEVICEID   045074212462ab24e988
#   FHEMPYTYPE tuya
#   FUUID      63f8d9d1-f33f-fd5f-6e90-0338c5a483982238
#   IODev      local_pybinding
#   NAME       tuya_local_045074212462ab24e988
#   NR         1790
#   PYTHONTYPE tuya
#   STATE      ready
#   TYPE       fhempy
#   eventCount 3
#   READINGS:
#     2023-02-24 16:38:43   active_time     1573754287
#     2023-02-24 16:38:43   biz_type        18
#     2023-02-24 16:38:43   category        cz
#     2023-02-24 16:38:43   create_time     1572954162
#     2023-02-24 16:38:43   icon            smart/icon/1536752669ijospdb3eoq_0.png
#     2023-02-24 16:38:43   id              045074212462ab24e988
#     2023-02-24 16:38:43   ip              46.5.205.127
#     2023-02-24 16:38:43   lat             48.5585
#     2023-02-24 16:38:43   local_key       6e637c2cfed441d8
#     2023-02-24 16:38:43   lon             9.2025
#     2023-02-24 16:38:43   model           SP1-C/16A/带计电量/gosund
#     2023-02-24 16:38:43   name            SP04 Spuelmaschine
#     2023-02-24 16:49:45   online          1
#     2023-02-24 16:38:43   owner_id        3389434
#     2023-02-24 16:38:43   product_id      IGzCi97RpN2Lf9cu
#     2023-02-24 16:38:43   product_name    Smart Socket
#     2023-02-24 16:49:45   state           ready
#     2023-02-24 16:38:43   sub             0
#     2023-02-24 16:38:43   time_zone       +01:00
#     2023-02-24 16:38:43   uid             eu1548823829280mLHX1
#     2023-02-24 16:38:43   update_time     1677182847
#     2023-02-24 16:38:43   uuid            045074212462ab24e988
#   args:
#     tuya_local_045074212462ab24e988
#     fhempy
#     tuya
#     IGzCi97RpN2Lf9cu
#     045074212462ab24e988
#     192.168.9.34
#     6e637c2cfed441d8
#     3.3
#     ea8453wdazquzfl08l0e
#     8a4b27dd759d4c6a9456aa8155d2a0ea
#   argsh:
#
setstate tuya_local_045074212462ab24e988 ready
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 active_time 1573754287
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 biz_type 18
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 category cz
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 create_time 1572954162
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 icon smart/icon/1536752669ijospdb3eoq_0.png
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 id 045074212462ab24e988
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 ip 46.5.205.127
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 lat 48.5585
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 local_key 6e637c2cfed441d8
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 lon 9.2025
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 model SP1-C/16A/带计电量/gosund
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 name SP04 Spuelmaschine
setstate tuya_local_045074212462ab24e988 2023-02-24 16:49:45 online 1
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 owner_id 3389434
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 product_id IGzCi97RpN2Lf9cu
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 product_name Smart Socket
setstate tuya_local_045074212462ab24e988 2023-02-24 16:49:45 state ready
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 sub 0
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 time_zone +01:00
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 uid eu1548823829280mLHX1
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 update_time 1677182847
setstate tuya_local_045074212462ab24e988 2023-02-24 16:38:43 uuid 045074212462ab24e988

[/code]

1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

thburkhart

Nachtrag:

habe nun in der fhem.cnf das SP04 auskommentiert.

FHEM shutdown restart
SP04 wird schön neu als _cloud erkannt :-)

und SP04 ist mit allen Daten incl. energy da :-)

scheint also ein Problem in lokal zu sein.

nun ist nur noch ungeklärt; war die SPxx keine Events erzeugen.

1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

dominik

Also, bitte nicht schon wieder was anderes...wir bleiben weiterhin beim SP05 und fixen das für local.
Lege SP05 nochmals an, prüfe bitte nochmals die IP und stell beim Device verbose 5. Danach poste das fhempy Log.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

thburkhart

Zitat von: dominik am 24 Februar 2023, 18:36:02
Also, bitte nicht schon wieder was anderes...wir bleiben weiterhin beim SP05 und fixen das für local.
Lege SP05 nochmals an, prüfe bitte nochmals die IP und stell beim Device verbose 5. Danach poste das fhempy Log.

SP05 ist ok

du meinst sp04 rollback auf Lokal?
1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

thburkhart

ok

ich habe SP04 durch Reauskommentieren reaktiviert:

define TUYA_SP04 fhempy tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3 ea8453wdazquzfl08l0e 8a4b27dd759d4c6a9456aa8155d2a0ea
setuuid TUYA_SP04 63f8d9d1-f33f-fd5f-6e90-0338c5a483982238
attr TUYA_SP04 alias SP04 Spuelmaschine
attr TUYA_SP04 dp_01 switch_1
attr TUYA_SP04 dp_01 verbose5
attr TUYA_SP04 dp_09 countdown_1
attr TUYA_SP04 dp_17 add_ele
attr TUYA_SP04 dp_18 cur_current
attr TUYA_SP04 dp_19 cur_power
attr TUYA_SP04 dp_20 cur_voltage
attr TUYA_SP04 event-on-change-reading .*
attr TUYA_SP04 group tuya
attr TUYA_SP04 room -TUYA,Küche,TUYA Stromverbrauch,fhempy
attr TUYA_SP04 tuya_spec_functions [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch 1'}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}, 'desc': 'countdown 1'}]
attr TUYA_SP04 tuya_spec_status [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}}, {'code': 'add_ele', 'dp_id': 17, 'type': 'Integer', 'values': {'unit': '', 'min': 0, 'max': 50000, 'scale': 3, 'step': 100}}, {'code': 'cur_current', 'dp_id': 18, 'type': 'Integer', 'values': {'unit': 'mA', 'min': 0, 'max': 30000, 'scale': 0, 'step': 1}}, {'code': 'cur_power', 'dp_id': 19, 'type': 'Integer', 'values': {'unit': 'W', 'min': 0, 'max': 50000, 'scale': 1, 'step': 1}}, {'code': 'cur_voltage', 'dp_id': 20, 'type': 'Integer', 'values': {'unit': 'V', 'min': 0, 'max': 5000, 'scale': 1, 'step': 1}}]

IP ist ok, da readings kamen; nur keine dynamischen Werte

jetzt im 3. Anlauf sieht es so aus :

[code]define TUYA_SP04 fhempy tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3
attr TUYA_SP04 alias SP04 Spuelmaschine
attr TUYA_SP04 dp_01 verbose5
attr TUYA_SP04 dp_09 countdown_1
attr TUYA_SP04 dp_17 add_ele
attr TUYA_SP04 dp_18 cur_current
attr TUYA_SP04 dp_19 cur_power
attr TUYA_SP04 dp_20 cur_voltage
attr TUYA_SP04 event-on-change-reading .*
attr TUYA_SP04 group tuya
attr TUYA_SP04 room -TUYA,Küche,TUYA Stromverbrauch,fhempy
attr TUYA_SP04 tuya_spec_functions [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch 1'}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}, 'desc': 'countdown 1'}]
attr TUYA_SP04 tuya_spec_status [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}}, {'code': 'add_ele', 'dp_id': 17, 'type': 'Integer', 'values': {'unit': '', 'min': 0, 'max': 50000, 'scale': 3, 'step': 100}}, {'code': 'cur_current', 'dp_id': 18, 'type': 'Integer', 'values': {'unit': 'mA', 'min': 0, 'max': 30000, 'scale': 0, 'step': 1}}, {'code': 'cur_power', 'dp_id': 19, 'type': 'Integer', 'values': {'unit': 'W', 'min': 0, 'max': 50000, 'scale': 1, 'step': 1}}, {'code': 'cur_voltage', 'dp_id': 20, 'type': 'Integer', 'values': {'unit': 'V', 'min': 0, 'max': 5000, 'scale': 1, 'step': 1}}]
#   DEF        tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3 ea8453wdazquzfl08l0e 8a4b27dd759d4c6a9456aa8155d2a0ea
#   DEVICEID   045074212462ab24e988
#   FHEMPYTYPE tuya
#   FUUID      63f8d9d1-f33f-fd5f-6e90-0338c5a483982238
#   IODev      local_pybinding
#   NAME       TUYA_SP04
#   NR         2122
#   PYTHONTYPE tuya
#   STATE      ready
#   TYPE       fhempy
#   eventCount 3
#   READINGS:
#     2023-02-24 17:26:30   active_time     1573754287
#     2023-02-24 17:27:59   add_ele         0.023
#     2023-02-24 17:26:30   biz_type        18
#     2023-02-24 17:26:30   category        cz
#     2023-02-24 17:49:49   countdown_1     0.0
#     2023-02-24 17:26:30   create_time     1572954162
#     2023-02-24 17:27:59   cur_current     46.0
#     2023-02-24 17:27:59   cur_power       5.3
#     2023-02-24 17:27:59   cur_voltage     231.7
#     2023-02-24 17:27:59   energy          0.0
#     2023-02-24 17:26:30   icon            https://images.tuyaeu.com/smart/icon/1536752669ijospdb3eoq_0.png
#     2023-02-24 17:26:30   id              045074212462ab24e988
#     2023-02-24 17:26:30   ip              46.5.205.127
#     2023-02-24 17:26:30   lat             48.5585
#     2023-02-24 17:26:30   local_key       6e637c2cfed441d8
#     2023-02-24 17:26:30   lon             9.2025
#     2023-02-24 17:26:30   model           SP1-C/16A/带计电量/gosund
#     2023-02-24 17:26:30   name            SP04 Spuelmaschine
#     2023-02-24 19:04:43   online          1
#     2023-02-24 17:26:30   owner_id        3389434
#     2023-02-24 17:26:30   product_id      IGzCi97RpN2Lf9cu
#     2023-02-24 17:26:30   product_name    Smart Socket
#     2023-02-24 19:04:43   state           ready
#     2023-02-24 17:26:30   sub             off
#     2023-02-24 17:26:30   time_zone       +01:00
#     2023-02-24 17:26:30   uid             eu1548823829280mLHX1
#     2023-02-24 17:26:30   update_time     1677182847
#     2023-02-24 17:26:30   uuid            045074212462ab24e988
#   args:
#     TUYA_SP04
#     fhempy
#     tuya
#     IGzCi97RpN2Lf9cu
#     045074212462ab24e988
#     192.168.9.34
#     6e637c2cfed441d8
#     3.3
#     ea8453wdazquzfl08l0e
#     8a4b27dd759d4c6a9456aa8155d2a0ea
#   argsh:
#
setstate TUYA_SP04 ready
setstate TUYA_SP04 2023-02-24 17:26:30 active_time 1573754287
setstate TUYA_SP04 2023-02-24 17:27:59 add_ele 0.023
setstate TUYA_SP04 2023-02-24 17:26:30 biz_type 18
setstate TUYA_SP04 2023-02-24 17:26:30 category cz
setstate TUYA_SP04 2023-02-24 17:49:49 countdown_1 0.0
setstate TUYA_SP04 2023-02-24 17:26:30 create_time 1572954162
setstate TUYA_SP04 2023-02-24 17:27:59 cur_current 46.0
setstate TUYA_SP04 2023-02-24 17:27:59 cur_power 5.3
setstate TUYA_SP04 2023-02-24 17:27:59 cur_voltage 231.7
setstate TUYA_SP04 2023-02-24 17:27:59 energy 0.0
setstate TUYA_SP04 2023-02-24 17:26:30 icon https://images.tuyaeu.com/smart/icon/1536752669ijospdb3eoq_0.png
setstate TUYA_SP04 2023-02-24 17:26:30 id 045074212462ab24e988
setstate TUYA_SP04 2023-02-24 17:26:30 ip 46.5.205.127
setstate TUYA_SP04 2023-02-24 17:26:30 lat 48.5585
setstate TUYA_SP04 2023-02-24 17:26:30 local_key 6e637c2cfed441d8
setstate TUYA_SP04 2023-02-24 17:26:30 lon 9.2025
setstate TUYA_SP04 2023-02-24 17:26:30 model SP1-C/16A/带计电量/gosund
setstate TUYA_SP04 2023-02-24 17:26:30 name SP04 Spuelmaschine
setstate TUYA_SP04 2023-02-24 19:04:43 online 1
setstate TUYA_SP04 2023-02-24 17:26:30 owner_id 3389434
setstate TUYA_SP04 2023-02-24 17:26:30 product_id IGzCi97RpN2Lf9cu
setstate TUYA_SP04 2023-02-24 17:26:30 product_name Smart Socket
setstate TUYA_SP04 2023-02-24 19:04:43 state ready
setstate TUYA_SP04 2023-02-24 17:26:30 sub off
setstate TUYA_SP04 2023-02-24 17:26:30 time_zone +01:00
setstate TUYA_SP04 2023-02-24 17:26:30 uid eu1548823829280mLHX1
setstate TUYA_SP04 2023-02-24 17:26:30 update_time 1677182847
setstate TUYA_SP04 2023-02-24 17:26:30 uuid 045074212462ab24e988

[/code]
als nun endlich  dyn. Werte


und das fhempy-log:

2023-02-24 19:02:32,071 - WARNING  - asyncio: socket.send() raised exception.
2023-02-24 19:02:32,315 - WARNING  - asyncio: socket.send() raised exception.
2023-02-24 19:04:01,122 - INFO     - fhempy.lib.fhem_pythonbinding: Starting fhempy 0.1.606...
2023-02-24 19:04:01,127 - INFO     - fhempy.lib.fhem_pythonbinding: Waiting for FHEM connection
2023-02-24 19:04:01,169 - INFO     - websockets.server: server listening on 0.0.0.0:15733
2023-02-24 19:04:07,656 - INFO     - websockets.server: connection open
2023-02-24 19:04:07,656 - INFO     - fhempy.lib.fhem_pythonbinding: Incoming FHEM connection: 127.0.0.1
2023-02-24 19:04:28,860 - ERROR    - TUYA_STF3: Failed create_device
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 547, in create_device
    await self._create_cloudmapping_dev()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 442, in _create_cloudmapping_dev
    await self.retrieve_tuya_specs()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 417, in retrieve_tuya_specs
    spec = await self.get_tuya_dev_specification()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 371, in get_tuya_dev_specification
    return resp["result"]
KeyError: 'result'

fmhe.log ist ok

mal sehen , ob energy noch kommt





1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

dominik

energy ist eh schon da, nur eben noch 0.0. Bei 5 Watt Verbrauch dauert es eben etwas, bis sich bei energy was tut. energy ist in kWh und mit 3 Kommastellen. Bedeutet die 5Watt sollten 0.005 kWh in 1h ergeben.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

thburkhart

Zitat von: dominik am 24 Februar 2023, 21:11:05
energy ist eh schon da, nur eben noch 0.0. Bei 5 Watt Verbrauch dauert es eben etwas, bis sich bei energy was tut. energy ist in kWh und mit 3 Kommastellen. Bedeutet die 5Watt sollten 0.005 kWh in 1h ergeben.


komisch ist, dass jetzt 22:17 die Werte noch auf 17:xx stehen; sie wurden also nicht aktualisiert


[code]define TUYA_SP04 fhempy tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3
attr TUYA_SP04 DbLogInclude energy,cur_power
attr TUYA_SP04 alias SP04 Spuelmaschine
attr TUYA_SP04 devStateStyle style="text-align:left;;;;font-weight:bold;;;;"
attr TUYA_SP04 dp_01 switch_1
attr TUYA_SP04 dp_09 countdown_1
attr TUYA_SP04 dp_17 add_ele
attr TUYA_SP04 dp_18 cur_current
attr TUYA_SP04 dp_19 cur_power
attr TUYA_SP04 dp_20 cur_voltage
attr TUYA_SP04 event-min-interval energy:300,cur_power:300
attr TUYA_SP04 event-on-change-reading .*
attr TUYA_SP04 group Schalter (T),Schalter Strommessung
attr TUYA_SP04 room -TUYA,Küche,TUYA Stromverbrauch
attr TUYA_SP04 stateFormat E: energy kWh cP: cur_power W cV: cur_voltage V
attr TUYA_SP04 tuya_spec_functions [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch 1'}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}, 'desc': 'countdown 1'}]
attr TUYA_SP04 tuya_spec_status [{'code': 'switch_1', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'countdown_1', 'dp_id': 9, 'type': 'Integer', 'values': {'unit': 's', 'min': 0, 'max': 86400, 'scale': 0, 'step': 1}}, {'code': 'add_ele', 'dp_id': 17, 'type': 'Integer', 'values': {'unit': '', 'min': 0, 'max': 50000, 'scale': 3, 'step': 100}}, {'code': 'cur_current', 'dp_id': 18, 'type': 'Integer', 'values': {'unit': 'mA', 'min': 0, 'max': 30000, 'scale': 0, 'step': 1}}, {'code': 'cur_power', 'dp_id': 19, 'type': 'Integer', 'values': {'unit': 'W', 'min': 0, 'max': 50000, 'scale': 1, 'step': 1}}, {'code': 'cur_voltage', 'dp_id': 20, 'type': 'Integer', 'values': {'unit': 'V', 'min': 0, 'max': 5000, 'scale': 1, 'step': 1}}]
attr TUYA_SP04 verbose 5
#   DEF        tuya IGzCi97RpN2Lf9cu 045074212462ab24e988 192.168.9.34 6e637c2cfed441d8 3.3 ea8453wdazquzfl08l0e 8a4b27dd759d4c6a9456aa8155d2a0ea
#   DEVICEID   045074212462ab24e988
#   FHEMPYTYPE tuya
#   FUUID      63f8d9d1-f33f-fd5f-6e90-0338c5a483982238
#   IODev      local_pybinding
#   NAME       TUYA_SP04
#   NR         2122
#   PYTHONTYPE tuya
#   STATE      E: 0.0 kWh cP: 5.3 W cV: 231.7 V
#   TYPE       fhempy
#   eventCount 3
#   READINGS:
#     2023-02-24 17:26:30   active_time     1573754287
#     2023-02-24 17:27:59   add_ele         0.023
#     2023-02-24 17:26:30   biz_type        18
#     2023-02-24 17:26:30   category        cz
#     2023-02-24 17:49:49   countdown_1     0.0
#     2023-02-24 17:26:30   create_time     1572954162
#     2023-02-24 17:27:59   cur_current     46.0
#     2023-02-24 17:27:59   cur_power       5.3
#     2023-02-24 17:27:59   cur_voltage     231.7
#     2023-02-24 17:27:59   energy          0.0
#     2023-02-24 17:26:30   icon            https://images.tuyaeu.com/smart/icon/1536752669ijospdb3eoq_0.png
#     2023-02-24 17:26:30   id              045074212462ab24e988
#     2023-02-24 17:26:30   ip              46.5.205.127
#     2023-02-24 17:26:30   lat             48.5585
#     2023-02-24 17:26:30   local_key       6e637c2cfed441d8
#     2023-02-24 17:26:30   lon             9.2025
#     2023-02-24 17:26:30   model           SP1-C/16A/带计电量/gosund
#     2023-02-24 17:26:30   name            SP04 Spuelmaschine
#     2023-02-24 20:19:10   online          1
#     2023-02-24 17:26:30   owner_id        3389434
#     2023-02-24 17:26:30   product_id      IGzCi97RpN2Lf9cu
#     2023-02-24 17:26:30   product_name    Smart Socket
#     2023-02-24 20:19:10   state           ready
#     2023-02-24 17:26:30   sub             off
#     2023-02-24 17:26:30   time_zone       +01:00
#     2023-02-24 17:26:30   uid             eu1548823829280mLHX1
#     2023-02-24 17:26:30   update_time     1677182847
#     2023-02-24 17:26:30   uuid            045074212462ab24e988
#   args:
#     TUYA_SP04
#     fhempy
#     tuya
#     IGzCi97RpN2Lf9cu
#     045074212462ab24e988
#     192.168.9.34
#     6e637c2cfed441d8
#     3.3
#     ea8453wdazquzfl08l0e
#     8a4b27dd759d4c6a9456aa8155d2a0ea
#   argsh:
#
setstate TUYA_SP04 E: 0.0 kWh cP: 5.3 W cV: 231.7 V
setstate TUYA_SP04 2023-02-24 17:26:30 active_time 1573754287
setstate TUYA_SP04 2023-02-24 17:27:59 add_ele 0.023
setstate TUYA_SP04 2023-02-24 17:26:30 biz_type 18
setstate TUYA_SP04 2023-02-24 17:26:30 category cz
setstate TUYA_SP04 2023-02-24 17:49:49 countdown_1 0.0
setstate TUYA_SP04 2023-02-24 17:26:30 create_time 1572954162
setstate TUYA_SP04 2023-02-24 17:27:59 cur_current 46.0
setstate TUYA_SP04 2023-02-24 17:27:59 cur_power 5.3
setstate TUYA_SP04 2023-02-24 17:27:59 cur_voltage 231.7
setstate TUYA_SP04 2023-02-24 17:27:59 energy 0.0
setstate TUYA_SP04 2023-02-24 17:26:30 icon https://images.tuyaeu.com/smart/icon/1536752669ijospdb3eoq_0.png
setstate TUYA_SP04 2023-02-24 17:26:30 id 045074212462ab24e988
setstate TUYA_SP04 2023-02-24 17:26:30 ip 46.5.205.127
setstate TUYA_SP04 2023-02-24 17:26:30 lat 48.5585
setstate TUYA_SP04 2023-02-24 17:26:30 local_key 6e637c2cfed441d8
setstate TUYA_SP04 2023-02-24 17:26:30 lon 9.2025
setstate TUYA_SP04 2023-02-24 17:26:30 model SP1-C/16A/带计电量/gosund
setstate TUYA_SP04 2023-02-24 17:26:30 name SP04 Spuelmaschine
setstate TUYA_SP04 2023-02-24 20:19:10 online 1
setstate TUYA_SP04 2023-02-24 17:26:30 owner_id 3389434
setstate TUYA_SP04 2023-02-24 17:26:30 product_id IGzCi97RpN2Lf9cu
setstate TUYA_SP04 2023-02-24 17:26:30 product_name Smart Socket
setstate TUYA_SP04 2023-02-24 20:19:10 state ready
setstate TUYA_SP04 2023-02-24 17:26:30 sub off
setstate TUYA_SP04 2023-02-24 17:26:30 time_zone +01:00
setstate TUYA_SP04 2023-02-24 17:26:30 uid eu1548823829280mLHX1
setstate TUYA_SP04 2023-02-24 17:26:30 update_time 1677182847
setstate TUYA_SP04 2023-02-24 17:26:30 uuid 045074212462ab24e988

[/code]

alle anders SPs sind mit aktuellen Werten versehen

du kannst ja meinen SP04 auch sehen ..





1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

dominik

Kannst du den SP04 mal komplett zurücksetzen und neu verbinden. Irgendwie kommt mir das komisch vor, oder der hat eine sehr instabile WiFi Verbindung.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

Superposchi

Habe deinen Code hinzugefügt, aber es funktioniert nicht. Auch ein fhempy-Neustart hat daran nichts geändert.
Die Funktion für den Modus wird zwar unter den Readings mit dp_02 angezeigt, jedoch weder mit dem Namen noch in den Funktionen.

Hier das geänderte List des Device:
Internals:
   CFGFN     
   DEF        tuya 6awobc9jfnlwvqtw bf75378cf6e13718e0rvcj 192.168.178.169 7ada5a7cbf4a78e8 3.3 asfg5sj9aurr9nib73fx fc553d7a6bfa4a569bc69ed2aa6924ed
   DEVICEID   bf75378cf6e13718e0rvcj
   FHEMPYTYPE tuya
   FUUID      63f930a1-f33f-7706-e6bf-2d98d17785b09e27
   IODev      fhempy_local
   NAME       tuya_local_bf75378cf6e13718e0rvcj
   NR         404450
   PYTHONTYPE tuya
   STATE      on
   TYPE       fhempy
   eventCount 8
   READINGS:
     2023-02-24 22:48:18   active_time     1654518995
     2023-02-24 22:48:18   biz_type        18
     2023-02-24 22:48:18   category        fs
     2023-02-24 22:48:18   create_time     1627922506
     2023-02-24 22:49:42   dp_02           strong
     2023-02-24 22:49:36   dp_106          51
     2023-02-24 22:48:18   icon            smart/icon/bay1579257011827QOvk/05cb05801c69fa7b6bdacda9c7f21196.png
     2023-02-24 22:48:18   id              bf75378cf6e13718e0rvcj
     2023-02-24 22:48:18   ip              88.153.83.160
     2023-02-24 22:48:18   lat             51.0583
     2023-02-24 22:48:18   local_key       7ada5a7cbf4a78e8
     2023-02-24 22:48:18   lon             6.1030
     2023-02-24 22:48:18   name            Schlafzimmerventilator
     2023-02-24 22:48:18   online          1
     2023-02-24 22:48:18   owner_id        23921647
     2023-02-24 22:48:18   product_id      6awobc9jfnlwvqtw
     2023-02-24 22:48:18   product_name    ARC Humidifier
     2023-02-24 22:49:36   state           on
     2023-02-24 22:48:18   sub             0
     2023-02-24 22:48:18   switch          off
     2023-02-24 22:48:18   time_zone       +02:00
     2023-02-24 22:48:18   uid             eu1610479166063muAw8
     2023-02-24 22:48:18   update_time     1654518998
     2023-02-24 22:48:18   uuid            fd0c8a9f78a36684
   args:
     tuya_local_bf75378cf6e13718e0rvcj
     fhempy
     tuya
     6awobc9jfnlwvqtw
     bf75378cf6e13718e0rvcj
     192.168.178.169
     7ada5a7cbf4a78e8
     3.3
     asfg5sj9aurr9nib73fx
     fc553d7a6bfa4a569bc69ed2aa6924ed
   argsh:
Attributes:
   alias      Schlafzimmerventilator
   dp_01      switch
   group      tuya
   room       fhempy
   tuya_spec_functions [{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}, 'desc': 'switch'}, {'code': 'fan_speed_percent', 'dp_id': 3, 'type': 'Integer', 'values': {'min': '1', 'max': '9', 'scale': '0', 'step': '1'}, 'desc': 'fan speed percent'}, {'code': 'switch_horizontal', 'dp_id': 5, 'type': 'Boolean', 'values': {}, 'desc': 'switch horizontal'}{'code': 'modus', 'dp_id': 2, 'type': 'Enum', 'values': '{"range":["sleep","fresh","strong", "auto", "close"]}', 'desc': 'modus'}]
   tuya_spec_status [{'code': 'switch', 'dp_id': 1, 'type': 'Boolean', 'values': {}}, {'code': 'fan_speed_percent', 'dp_id': 3, 'type': 'Integer', 'values': {'min': '1', 'max': '9', 'scale': '0', 'step': '1'}}, {'code': 'switch_horizontal', 'dp_id': 5, 'type': 'Boolean', 'values': {}}{'code': 'modus', 'dp_id': 2, 'type': 'Enum', 'values': '{"range":["sleep","fresh","strong", "auto", "close"]}', 'desc': 'modus'}]


Was mich irritiert ist das Wort Switch unterhalb der Funktionen und das bei den Attributen nur dp_01 auf switch angepasst wird.
Hat sich da vielleicht ein Fehler in der ersten Funktion in den beiden Attributen eingeschlichen? Ich weiß wie schnell ein fehlendes Zeichen eine ganze Webseite auf den Kopf stellen kann.

dominik

Da fehlt ein Komma
Zitat'switch horizontal'},{'code': 'modus', 'd

Kopier die Inhalte von den tuya Attribute in einen online json validator (https://jsonlint.com/), dann siehst du ob die Syntax passt.

Nach dem fhempy Neustart kannst du dann das Attribut dp_02 auf modus setzen.
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

thburkhart

#596
Zitat von: dominik am 24 Februar 2023, 22:52:44
Kannst du den SP04 mal komplett zurücksetzen und neu verbinden. Irgendwie kommt mir das komisch vor, oder der hat eine sehr instabile WiFi Verbindung.
ich habe

- den SP04 auch in der App neu angelernt.
- dann in FEHM DEvice gelöscht
- fhem shutdown restart

Nach ein paar Sekunden war er als _cloud vorhanden, ist schaltbar und zeigt aktuelle Werte

Wie kriege ich den nun lokal?

next step:
suche und create device SP04

nun sind beide da; nur _cloud mit aktuellen Werten

FHEMPYlog:

2023-02-25 10:40:17,667 - ERROR    - tuya_system: Exception raised by task: <Task finished name='Task-46153' coro=<FhemModule._run_coro() done, defined at /opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/generic.py:211> exception=OSError(98, 'Address already in use')>
Traceback (most recent call last):
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/generic.py", line 219, in _handle_task_result
    task.result()
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/generic.py", line 213, in _run_coro
    await coro
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/tuya/tuya.py", line 781, in _scan_devices
    devices = await utils.run_blocking(
  File "/opt/fhem/.local/lib/python3.9/site-packages/fhempy/lib/utils.py", line 72, 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 "/opt/fhem/.local/lib/python3.9/site-packages/tinytuya/core.py", line 1561, in deviceScan
    return scanner.devices(verbose=verbose, maxretry=maxretry, color=color, poll=poll, forcescan=forcescan, byID=byID)
  File "/opt/fhem/.local/lib/python3.9/site-packages/tinytuya/scanner.py", line 147, in devices
    client.bind(("", UDPPORT))
OSError: [Errno 98] Address already in use


Update:
nach ein paar Minuten wird "save config" rot und _local wie _cloud voll funktionsfähig da :-)

das ist also mal ok :-)
1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

dominik

Was meinst du mit nach ein paar Minuten wird save config rot? Und bekommst du jetzt aktuelle Werte + Energy mit local?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik

thburkhart

Zitat von: dominik am 25 Februar 2023, 11:16:08
Was meinst du mit nach ein paar Minuten wird save config rot? Und bekommst du jetzt aktuelle Werte + Energy mit local?

ich meine im Web-Frontend von FHEM ; das ist ja immer, wenn neue Devices erkannt wurden

und ja es sind alle dynamischen Werte aktuell:
tuya
SP04 Spuelmaschine
on
off
tuya_cloud
SP04 Spuelmaschine
on
off


dasselbe og. procedure habe ich mit JL05 gemacht, der sich nicht mehr gemeldet hatte
1 RASPI4B, 1 RASPI3B, 2 CUL, 2 Jeelink, 60 Tuya-Devices (Schalter, Dimmer, Sensoren, Cameras), 30 HUE-Lampen, 5 MAX! WTs, 16 MAX! HTs, 12 MAX! FKs, 1 Bresser 5in1, 1 OilFox, 8 ALEXA Echos und Dots, FHEM, 5 Tasmota-Devices, SonOff -Bridge, PowerFox, Buderus KM200

dominik

Ok, bedeutet alle Devices liefern jetzt lokal richtige Werte? Oder fehlt noch einer?
fhempy -  https://github.com/fhempy/fhempy: GoogleCast, Tuya, UPnP, Ring, EQ3BT, Nespresso, Xiaomi, Spotify, Object Detection, ...
Kaffeespende: https://paypal.me/todominik