DOIF mit Xiaomi und Gosund ??

Begonnen von Sky, 06 Oktober 2019, 19:09:25

Vorheriges Thema - Nächstes Thema

Sky

Hallo zusammen ,

ich habe noch nie ein DOIF angelegt . Habe einige Versuche gestartet ,auch anhand Beiträgen aus dem Forum.
Aber Irgendwie habe ich immer einen Fehler eingebaut .

Folgendes Szenario :
Ich möchte über einen Xiaomi Wandschalter QBKG12LM eine Gosund Steckdose mit Tasmota steuern

Gosund


Internals:
   CFGFN     
   DEF        sensor 7  IODev=deCONZ
   FUUID      5d9a17f7-f33f-88d2-6f9a-5fbbbe23a63e71b9
   FVERSION   31_HUEDevice.pm:0.203080/2019-10-04
   ID         S7
   INTERVAL   
   IODev      deCONZ
   NAME       Wandschalter_Alina
   NR         393
   STATE      LeftShortPress
   TYPE       HUEDevice
   lastupdated 2019-10-06 16:58:29
   lastupdated_local 2019-10-06 18:58:29
   manufacturername LUMI
   modelid    lumi.remote.b286acn01
   name       Wandsender Alina
   on         1
   reachable  1
   swversion  20180809
   type       ZHASwitch
   uniqueid   00:15:8d:00:02:f0:79:9f-01-0012
   READINGS:
     2019-10-06 18:33:48   battery         100
     2019-10-06 18:33:48   reachable       1
     2019-10-06 18:58:29   state           1002
     2019-10-06 18:33:48   temperature     27
   helper:
     devtype    S
     reachable  0
     update_timeout 1
     configList:
     setList:
Attributes:
   IODev      deCONZ
   eventMap   1001:LeftLongPress
1002:LeftShortPress
1004:LeftDoublePress
2001:RightLongPress
2002:RightShortPress
2004:RightDoublePress
3001:DoubleLongPress
3002:DoubleShortPress
3004:DoubleDoublePress
   genericDeviceType switch
   icon       taster
   room       Conbee


Xiaomi


Internals:
   CID        DVES_8594F8
   DEF        DVES_8594F8
   DEVICETOPIC Gosund_1
   FUUID      5d98d07c-f33f-88d2-6d29-2bc24496d6fe9e0b
   IODev      m2s
   LASTInputDev m2s
   MSGCNT     15
   NAME       Gosund_1
   NR         331
   STATE      off
   TYPE       MQTT2_DEVICE
   m2s_MSGCNT 15
   m2s_TIME   2019-10-06 19:05:38
   READINGS:
     2019-10-06 19:05:38   ENERGY_ApparentPower 0
     2019-10-06 19:05:38   ENERGY_Current  0.000
     2019-10-06 19:05:38   ENERGY_Factor   0.00
     2019-10-06 19:05:38   ENERGY_Period   0
     2019-10-06 19:05:38   ENERGY_Power    0
     2019-10-06 19:05:38   ENERGY_ReactivePower 0
     2019-10-06 19:05:38   ENERGY_Today    0.000
     2019-10-06 19:05:38   ENERGY_Total    0.000
     2019-10-06 19:05:38   ENERGY_TotalStartTime 2019-10-04T18:08:10
     2019-10-06 19:05:38   ENERGY_Voltage  0
     2019-10-06 19:05:38   ENERGY_Yesterday 0.000
     2019-10-06 18:50:29   FallbackTopic   cmnd/DVES_8594F8_fb/
     2019-10-06 18:50:29   GroupTopic      sonoffs
     2019-10-06 19:05:38   Heap            15
     2019-10-06 18:50:29   Hostname        sonoff_1-5368
     2019-10-06 18:50:29   IPAddress       192.168.178.113
     2019-10-06 18:50:29   LWT             Online
     2019-10-06 19:05:38   LoadAvg         19
     2019-10-06 18:50:29   Module          Gosund SP1 v23
     2019-10-06 19:05:38   POWER1          off
     2019-10-06 18:50:29   RestartReason   Power on
     2019-10-05 20:49:01   SaveData        on
     2019-10-05 20:49:00   SetOption26     on
     2019-10-06 19:05:38   Sleep           50
     2019-10-06 19:05:38   SleepMode       Dynamic
     2019-10-05 20:48:59   StateText1      off
     2019-10-05 20:48:59   StateText2      on
     2019-10-05 20:49:00   StateText3      toggle
     2019-10-05 20:49:00   StateText4      hold
     2019-10-06 19:05:38   Time            2019-10-06T18:05:38
     2019-10-06 19:05:38   Uptime          0T00:15:14
     2019-10-06 18:50:29   Version         6.6.0(release-sonoff)
     2019-10-06 18:50:29   WebServerMode   Admin
     2019-10-06 19:05:38   Wifi_AP         1
     2019-10-06 19:05:38   Wifi_BSSId      00:1F:3F:16:32:0C
     2019-10-06 19:05:38   Wifi_Channel    10
     2019-10-06 19:05:38   Wifi_Downtime   0T00:00:04
     2019-10-06 19:05:38   Wifi_LinkCount  1
     2019-10-06 19:05:38   Wifi_RSSI       64
     2019-10-06 19:05:38   Wifi_SSId       Mein Netz 1
     2019-10-06 18:50:34   state           set_off
Attributes:
   IODev      m2s
   autocreate 0
   comment    NOTE: on-for-timer is limited to 18h max duration!
   genericDeviceType Socket
   model      tasmota_basic_state_power1
   readingList tele/sonoff_1/LWT:.* LWT
  tele/sonoff_1/STATE:.* { json2nameValue($EVENT) }
  tele/sonoff_1/SENSOR:.* { json2nameValue($EVENT) }
  tele/sonoff_1/INFO.:.* { json2nameValue($EVENT) }
  stat/sonoff_1/RESULT:.* { json2nameValue($EVENT) }
   room       Homekit,MQTT2_DEVICE
   setList    off:noArg    cmnd/sonoff_1/POWER1 0
  on:noArg     cmnd/sonoff_1/POWER1 1
  toggle:noArg cmnd/sonoff_1/POWER1 2
  on-for-timer {my $duration = $EVTPART1 < 11.2 ? $EVTPART1*10 : $EVTPART1+100; 'cmnd/sonoff_1/Backlog pulseTime1 '.$duration.'; POWER1 1'}
  setOtaUrl:textField cmnd/sonoff_1/OtaUrl $EVTPART1
  upgrade:noArg   cmnd/sonoff_1/upgrade 1
   setStateList on off toggle
   stateFormat POWER1


Mein letzter Versuch sieht so aus :


define Steckdose_1 DOIF ([Wandschalter_Alina :"1002"]) (set Gosund_1 on )


Bitte nicht lachen ....


Danke

amenomade

Wenn Du eine Eventsteuerung möchtest, lieber im Eventmonitor schauen, wie die Events aussehen. Dort kannst Du die gewünschte Zeile markieren, und über "create/modify device" ein DOIF erstellen lassen. Dann bist Du sicher, dass die Regex richtig ist. Vermutlich kein Leerzeichen nach Alina, und möglicherweise noch einen Punkt nach dem Doppelpunkt.

Also([Wandschalter_Alina:"1002"]) oder ([Wandschalter_Alina:."1002"])

Pi 3B, Alexa, CUL868+Selbstbau 1/2λ-Dipol-Antenne, USB Optolink / Vitotronic, Debmatic und HM / HmIP Komponenten, Rademacher Duofern Jalousien, Fritz!Dect Thermostaten, Proteus

Sky

Hallo -
vielen Dank für Deine Hilfe.
Wusste gar nicht das es so einen Weg gibt .

Das DOIF sieht so aus :
define Wandschalter_Alina_DOIF_1 DOIF ([Wandschalter_Alina:"^LeftShortPress$"]) (set Gosund_1 on)


Hätte ich alleine nicht geschafft ...


Nochmal ein dickes Danke !!