Hauptmenü

Doif und defmod

Begonnen von hugo, 03 November 2024, 17:39:04

Vorheriges Thema - Nächstes Thema

hugo

Hallo, mein doif schneidet bei der Ausführung einen Teil der Definition ab.
Das Device OBIsZähler verliert immer wieder die Verbindung.

Jetzt habe ich ein DOIf erstellt, das ein defmod ausführt.
doif setzt die Kommas in neue Befehle um. wie kann ich dies vermeiden?
 

define di.readingswatcher DOIF ([myreadingsWatcher:deadDevs] eq "Strom")(defmod Strom OBIS /dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_0061BD41-if00-port0@300,7,E,1 VSM102)\
DOELSEIF\
([myreadingsWatcher:state] ne "ok")(set pushmsg msg 'fhemKeller' 'ALARM: Geräte funktionieren nicht mehr: [myreadingsWatcher:deadDevs]' '' 0 '')
attr di.readingswatcher do always
attr di.readingswatcher room Zentrale
#   DEF        ([myreadingsWatcher:deadDevs] eq "Strom")(defmod Strom OBIS /dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_0061BD41-if00-port0@300,7,E,1 VSM102)
#DOELSEIF
#([myreadingsWatcher:state] ne "ok")(set pushmsg msg 'fhemKeller' 'ALARM: Geräte funktionieren nicht mehr: [myreadingsWatcher:deadDevs]' '' 0 '')
#   FUUID      66fb1294-f33f-3e5d-bc69-9b5c76ac01179d9f
#   MODEL      FHEM
#   NAME       di.readingswatcher
#   NOTIFYDEV  myreadingsWatcher,global
#   NR         63
#   NTFY_ORDER 50-di.readingswatcher
#   STATE      cmd_1
#   TYPE       DOIF
#   VERSION    28546 2024-02-23 20:11:05
#   eventCount 11
#   READINGS:
#     2024-11-03 17:25:59   Device          myreadingsWatcher
#     2024-11-03 17:27:43   cmd             1
#     2024-11-03 17:27:43   cmd_event       set_cmd_1
#     2024-11-03 17:27:43   cmd_nr          1
#     2024-11-03 17:25:59   e_myreadingsWatcher_deadDevs Strom
#     2024-11-03 17:25:59   e_myreadingsWatcher_state timeout
#     2024-11-03 17:27:43   error           7: Unknown command 7, try help. E: current encoding is  1 VSM102: Unknown command 1, try help.
#     2024-11-01 18:24:42   mode            enabled
#     2024-11-03 17:27:43   state           cmd_1
#   Regex:
#     accu:
#     bar:
#     barAvg:
#     collect:
#     cond:
#       myreadingsWatcher:
#         0:
#           deadDevs   ^myreadingsWatcher$:^deadDevs:
#         1:
#           state      ^myreadingsWatcher$:^state:
#   attr:
#     cmdState:
#     wait:
#     waitdel:
#   condition:
#     0          ::ReadingValDoIf($hash,'myreadingsWatcher','deadDevs') eq "Strom"
#     1          ::ReadingValDoIf($hash,'myreadingsWatcher','state') ne "ok"
#   do:
#     0:
#       0          defmod Strom OBIS /dev/serial/by-id/usb-Silicon_Labs_CP2104_USB_to_UART_Bridge_Controller_0061BD41-if00-port0@300,7,E,1 VSM102
#     1:
#       0          set pushmsg msg 'fhemKeller' 'ALARM: Geräte funktionieren nicht mehr: [myreadingsWatcher:deadDevs]' '' 0 ''
#     2:
#   helper:
#     NOTIFYDEV  myreadingsWatcher,global
#     event      Strom_Version: timeout,readings: 1,devices: 1,dead: 1,skipped: 0,timeouts: 1,timeout,timeoutDevs: Strom,deadDevs: Strom,skippedDevs: none
#     globalinit 1
#     last_timer 0
#     sleeptimer -1
#     timerdev   
#     timerevent Strom_Version: timeout,readings: 1,devices: 1,dead: 1,skipped: 0,timeouts: 1,timeout,timeoutDevs: Strom,deadDevs: Strom,skippedDevs: none
#     timerevents
#     timereventsState
#     triggerDev
#   internals:
#   readings:
#     all         myreadingsWatcher:deadDevs myreadingsWatcher:state
#   trigger:
#   uiState:
#   uiTable:
#
setstate di.readingswatcher cmd_1
setstate di.readingswatcher 2024-11-03 17:25:59 Device myreadingsWatcher
setstate di.readingswatcher 2024-11-03 17:27:43 cmd 1
setstate di.readingswatcher 2024-11-03 17:27:43 cmd_event set_cmd_1
setstate di.readingswatcher 2024-11-03 17:27:43 cmd_nr 1
setstate di.readingswatcher 2024-11-03 17:25:59 e_myreadingsWatcher_deadDevs Strom
setstate di.readingswatcher 2024-11-03 17:25:59 e_myreadingsWatcher_state timeout
setstate di.readingswatcher 2024-11-03 17:27:43 error 7: Unknown command 7, try help. E: current encoding is  1 VSM102: Unknown command 1, try help.
setstate di.readingswatcher 2024-11-01 18:24:42 mode enabled
setstate di.readingswatcher 2024-11-03 17:27:43 state cmd_1


Gruß Josef
Raspi 3 mit CUL HM-MOD-UART; nanoCUL
Homematic: HM-SEC-SCo 5x;HM-LC-SW1-BA-PCB 3x;HM-Dis-EP-WM55; HM-LC-SW4-PCB; ARLO;
Somfy RTS Rollo 14x; Alexa; GardenaSmartDevice; Stromzähler(GPIO); shelly1; shelly2.5;Wasserzähler(GPIO);Brennerstuhlsteckdosen;

hugo

Habe commandref gelsen mit Doppelter Klammer funktionierts.
Raspi 3 mit CUL HM-MOD-UART; nanoCUL
Homematic: HM-SEC-SCo 5x;HM-LC-SW1-BA-PCB 3x;HM-Dis-EP-WM55; HM-LC-SW4-PCB; ARLO;
Somfy RTS Rollo 14x; Alexa; GardenaSmartDevice; Stromzähler(GPIO); shelly1; shelly2.5;Wasserzähler(GPIO);Brennerstuhlsteckdosen;