FHEM Forum

FHEM => Automatisierung => DOIF => Thema gestartet von: Spartacus am 03 Dezember 2016, 14:42:56

Titel: DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Spartacus am 03 Dezember 2016, 14:42:56
Hallo,
ich habe jetzt fast 1,5 Jahre nichts mit fhem gemacht und ich muss sagen, der erneute Einstieg fällt mir sehr schwer. Es bleibt doch Vieles auf der Strecke, nach so einer langen Zeit.

Ich möchte nun wieder einsteigen und meine alten Module aufhübschen. Ich habe festgestellt, dass es in Sachen DOIF sehr große Fortschritte gegeben hat. So ganz checke ich die neuen Möglichkeiten noch nicht, aber ich glaube "$SELF" ist hier eine Neuerung, die ich in fast alle Module einbauen könnte und damit alles etwas Übersichtlicher gestallten kann:

Im Prinzip ich bei mir Alles wie folgt aufgebaut:

Funktionsweise:
Ein "Softschalter" aktiviert bzw. deaktiviert eine Automatikfunktion:
Die Automatikmodus wird wie folgt visualisiert:
- Automatik ein  (grüner Punkt)
- Automatik aus (roter Punkt)

Aktor bzw. DOIF-Modulzustande werden i.d.R. wie folgt visualisiert
- Modul/Aktor ein/aktiv (grünes Symbol)
- Modul/Aktor aus (rotes Symbol)
- Modul Aktor deaktiv (graues Symbol, z.B. wenn die Weihnachtszeit vorbei ist)

Derzeit ist das sehr aufwändig gelöst, da man immer einen Softschalter, ein DOIF und die RG benötigt. Wenn hier jemand einen Tipp hat, wie man dies prinzipiell besser lösen könnte, wäre ich für Tipps dankbar.
Gruß,
Spartacus:

Hier ein Beispiel:

Softschalter:
Internals:
   NAME       switch.di.02.rp.01.EG.ku.SD.dum
   NR         1107
   STATE      on
   TYPE       dummy
   Readings:
     2016-12-01 17:46:20   state           on
Attributes:
   alias      autom. Steckdosensteuerung
   devStateIcon .*on:10px-kreis-gruen .*off:10px-kreis-rot
   group      Switch
   icon       message_socket
   room       98-Dummy
   webCmd     on:off


DOIF:
Internals:
   CFGFN      Config/99-Weihnachtszeit.cfg
   DEF        (((([09:25|12345] and  [?hl.01.Feiertag] eq "none" or
    [16:30|12345] and ([?hl.01.Feiertag] eq "none" and ![?state.NRW.Ferien.dum]) or
    [08:30]       and  [?state.NRW.Ferien.dum] or
    [08:30]       and  [?hl.01.Feiertag] ne "none" or
    [08:30|60])   and  Advent==1 and $mday>=25 and $month==12) or
    [16:15]       and  [?hl.01.Feiertag] eq "Heiligabend" or
    [08:30]       and  [?hl.01.Feiertag] eq "Silvester") and [?switch.di.02.rp.01.EG.ku.SD.dum] eq "on")
(set rp.02.EG.ku.SD.Kochinsel on)
DOELSEIF
(((([08:00|12345] and  [?hl.01.Feiertag] eq "none" or
     [22:00|12345] and ([?hl.01.Feiertag] eq "none" and ![?state.NRW.Ferien.dum]) or
     [23:00]       and  [?state.NRW.Ferien.dum] or
     [23:00]       and  [?hl.01.Feiertag] ne "none" or
     [23:00|60])   and  Advent==1 and $mday>=25 and $month==12) or
     [23:00]       and  [?hl.01.Feiertag] eq "Heiligabend" or
     [02:00]       and  [?hl.01.Feiertag] eq "Silvester")  and [?switch.di.02.rp.01.EG.ku.SD.dum] eq "on" or [switch.di.02.rp.01.EG.ku.SD.dum] eq "on")
(set rp.02.EG.ku.SD.Kochinsel off)

DOELSEIF
([switch.di.02.rp.01.EG.ku.SD.dum] eq "off")
(set rp.02.EG.ku.SD.Kochinsel on)

   NAME       di.01.rp.01.EG.ku.SD.Kochinsel
   NR         1074
   NTFY_ORDER 50-di.01.rp.01.EG.ku.SD.Kochinsel
   STATE      off
   TYPE       DOIF
   Readings:
     2016-12-01 17:46:20   Device          switch.di.02.rp.01.EG.ku.SD.dum
     2016-12-01 17:46:20   cmd             2
     2016-12-01 17:46:20   cmd_event       switch.di.02.rp.01.EG.ku.SD.dum
     2016-12-01 17:46:20   cmd_nr          2
     2016-12-01 17:46:20   e_switch.di.02.rp.01.EG.ku.SD.dum_STATE on
     2016-12-01 17:46:20   state           off
     2016-12-03 09:25:00   timer_01_c01    04.12.2016 09:25:00|12345
     2016-12-02 17:46:10   timer_02_c01    03.12.2016 16:30:00|12345
     2016-12-03 08:30:00   timer_03_c01    04.12.2016 08:30:00
     2016-12-03 08:30:00   timer_04_c01    04.12.2016 08:30:00
     2016-12-03 08:30:00   timer_05_c01    04.12.2016 08:30:00|60
     2016-12-02 17:46:10   timer_06_c01    03.12.2016 16:15:00
     2016-12-03 08:30:00   timer_07_c01    04.12.2016 08:30:00
     2016-12-03 08:00:00   timer_08_c02    04.12.2016 08:00:00|12345
     2016-12-02 22:00:00   timer_09_c02    03.12.2016 22:00:00|12345
     2016-12-02 23:00:00   timer_10_c02    03.12.2016 23:00:00
     2016-12-02 23:00:00   timer_11_c02    03.12.2016 23:00:00
     2016-12-02 23:00:00   timer_12_c02    03.12.2016 23:00:00|60
     2016-12-02 23:00:00   timer_13_c02    03.12.2016 23:00:00
     2016-12-03 02:00:00   timer_14_c02    04.12.2016 02:00:00
   Condition:
     0          (((DOIF_time_once($hash,0,$wday,"12345") and  InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "none" or     DOIF_time_once($hash,1,$wday,"12345") and (InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "none" and !InternalDoIf($hash,'state.NRW.Ferien.dum','STATE')) or     DOIF_time_once($hash,2,$wday)       and  InternalDoIf($hash,'state.NRW.Ferien.dum','STATE') or     DOIF_time_once($hash,3,$wday)       and  InternalDoIf($hash,'hl.01.Feiertag','STATE') ne "none" or     DOIF_time_once($hash,4,$wday,"60"))   and  Advent==1 and $mday>=25 and $month==12) or     DOIF_time_once($hash,5,$wday)       and  InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "Heiligabend" or     DOIF_time_once($hash,6,$wday)       and  InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "Silvester") and InternalDoIf($hash,'switch.di.02.rp.01.EG.ku.SD.dum','STATE') eq "on"
     1          (((DOIF_time_once($hash,7,$wday,"12345") and  InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "none" or      DOIF_time_once($hash,8,$wday,"12345") and (InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "none" and !InternalDoIf($hash,'state.NRW.Ferien.dum','STATE')) or      DOIF_time_once($hash,9,$wday)       and  InternalDoIf($hash,'state.NRW.Ferien.dum','STATE') or      DOIF_time_once($hash,10,$wday)       and  InternalDoIf($hash,'hl.01.Feiertag','STATE') ne "none" or      DOIF_time_once($hash,11,$wday,"60"))   and  Advent==1 and $mday>=25 and $month==12) or      DOIF_time_once($hash,12,$wday)       and  InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "Heiligabend" or      DOIF_time_once($hash,13,$wday)       and  InternalDoIf($hash,'hl.01.Feiertag','STATE') eq "Silvester")  and InternalDoIf($hash,'switch.di.02.rp.01.EG.ku.SD.dum','STATE') eq "on" or InternalDoIf($hash,'switch.di.02.rp.01.EG.ku.SD.dum','STATE') eq "on"
     2          InternalDoIf($hash,'switch.di.02.rp.01.EG.ku.SD.dum','STATE') eq "off"
   Days:
     0          12345
     1          12345
     11         60
     4          60
     7          12345
     8          12345
   Devices:
     1           switch.di.02.rp.01.EG.ku.SD.dum
     2           switch.di.02.rp.01.EG.ku.SD.dum
     all         switch.di.02.rp.01.EG.ku.SD.dum
   Do:
     0:
       0          set rp.02.EG.ku.SD.Kochinsel on
     1:
       0          set rp.02.EG.ku.SD.Kochinsel off
     2:
       0          set rp.02.EG.ku.SD.Kochinsel on
     3:
   Helper:
     event      timer_1
     globalinit 1
     last_timer 14
     sleeptimer -1
     timerdev
     timerevent timer_8
     timereventsState
     triggerDev
     timerevents:
       timer_8
     triggerEvents:
       timer_1
   Internals:
     0           hl.01.Feiertag:STATE state.NRW.Ferien.dum:STATE switch.di.02.rp.01.EG.ku.SD.dum:STATE
     1           hl.01.Feiertag:STATE state.NRW.Ferien.dum:STATE switch.di.02.rp.01.EG.ku.SD.dum:STATE
     2           switch.di.02.rp.01.EG.ku.SD.dum:STATE
     all         hl.01.Feiertag:STATE state.NRW.Ferien.dum:STATE switch.di.02.rp.01.EG.ku.SD.dum:STATE
   Interval:
   Itimer:
   Localtime:
     0          1480839900
     1          1480779000
     10         1480802400
     11         1480802400
     12         1480802400
     13         1480813200
     2          1480836600
     3          1480836600
     4          1480836600
     5          1480778100
     6          1480836600
     7          1480834800
     8          1480798800
     9          1480802400
   Readings:
   Realtime:
     0          09:25:00
     1          16:30:00
     10         23:00:00
     11         23:00:00
     12         23:00:00
     13         02:00:00
     2          08:30:00
     3          08:30:00
     4          08:30:00
     5          16:15:00
     6          08:30:00
     7          08:00:00
     8          22:00:00
     9          23:00:00
   Regexp:
     All:
   State:
   Time:
     0          09:25:00
     1          16:30:00
     10         23:00:00
     11         23:00:00
     12         23:00:00
     13         02:00:00
     2          08:30:00
     3          08:30:00
     4          08:30:00
     5          16:15:00
     6          08:30:00
     7          08:00:00
     8          22:00:00
     9          23:00:00
   Timecond:
     0          0
     1          0
     10         1
     11         1
     12         1
     13         1
     2          0
     3          0
     4          0
     5          0
     6          0
     7          1
     8          1
     9          1
   Timer:
     0          0
     1          0
     10         0
     11         0
     12         0
     13         0
     2          0
     3          0
     4          0
     5          0
     6          0
     7          0
     8          0
     9          0
   Timers:
     0           0  1  2  3  4  5  6
     1           7  8  9  10  11  12  13
   Triggertime:
     1480778100:
       localtime  1480778100
       Hash:
     1480779000:
       localtime  1480779000
       Hash:
     1480798800:
       localtime  1480798800
       Hash:
     1480802400:
       localtime  1480802400
       Hash:
     1480813200:
       localtime  1480813200
       Hash:
     1480834800:
       localtime  1480834800
       Hash:
     1480836600:
       localtime  1480836600
       Hash:
     1480839900:
       localtime  1480839900
       Hash:
Attributes:
   alias      Kochinsel linke Steckdose
   cmdState   on|off|deaktiv
   comment    vom 24.12 bis 06.01
   devStateIcon .*on:light_wire_system_1@lightgreen .*off:light_wire_system_1@red .*deaktiv:light_wire_system_1@grey
   group      Scripte
   icon       scene_x-mas@green
   room       01-Küche,99-Weihnachtszeit
   sortby     01



RG:
Internals:
   CFGFN      Config/01-Kueche.cfg
   DEF        switch.di.02.rp.01.EG.ku.SD.dum:<%time_automatic>,<Automatik>,state,!Ein,!Aus,<>
rp.02.EG.ku.SD.Kochinsel:<%message_socket>,<Steckdose&nbsp;links>,state,!Ein,!Aus,!10Minuten
rp.01.EG.ku.SD.Kochinsel:<%message_socket>,<Steckdose&nbsp;rechts>,state,!Ein,!Aus,!10Minuten

   NAME       rg.01.rp.nn.EG.ku.SD.Kochinsel
   NR         102
   NTFY_ORDER 50-rg.01.rp.nn.EG.ku.SD.Kochinsel
   STATE      Initialized
   TYPE       readingsGroup
   mayBeVisible 1
   Content:
     rp.01.EG.ku.SD.Kochinsel 1
     rp.02.EG.ku.SD.Kochinsel 1
     switch.di.02.rp.01.EG.ku.SD.dum 1
   Content2:
   DEVICES:
     ARRAY(0x40359b8)
     ARRAY(0x3def888)
     ARRAY(0x4075bb8)
   Fhem:
     lastDefChange 8
     last_update 1480769406.441
   Helper:
     DEF
     commands   {'Ein' => 'set $DEVICE on', 'Aus' => 'set $DEVICE off', '10Minuten' => 'set $DEVICE on-for-timer 600'}
     Positions:
       rp.01.EG.ku.SD.Kochinsel.10Minuten 3:6
       rp.01.EG.ku.SD.Kochinsel.Aus 3:5
       rp.01.EG.ku.SD.Kochinsel.Ein 3:4
       rp.01.EG.ku.SD.Kochinsel.state 3:3
       rp.02.EG.ku.SD.Kochinsel.10Minuten 2:6
       rp.02.EG.ku.SD.Kochinsel.Aus 2:5
       rp.02.EG.ku.SD.Kochinsel.Ein 2:4
       rp.02.EG.ku.SD.Kochinsel.state 2:3
       switch.di.02.rp.01.EG.ku.SD.dum.Aus 1:5
       switch.di.02.rp.01.EG.ku.SD.dum.Ein 1:4
       switch.di.02.rp.01.EG.ku.SD.dum.state 1:3
     Valueformat:
       10Minuten  10 Minuten
     Valueicon:
       state      %devStateIcon
     Values:
       formated:



         ARRAY(0x37176f0)
         ARRAY(0x406e808)
         ARRAY(0x405e220)
         ARRAY(0x3b98de0)
       orig:



         ARRAY(0x3f33c18)
         ARRAY(0x3717600)
         ARRAY(0x4077328)
         ARRAY(0x4080410)
       prefixsuffix:



         ARRAY(0x37175b8)
         ARRAY(0x37175a0)
         ARRAY(0x38b6800)
         ARRAY(0x40718b8)
Attributes:
   alias      Kochinsel schalten
   commands   {'Ein' => 'set $DEVICE on', 'Aus' => 'set $DEVICE off', '10Minuten' => 'set $DEVICE on-for-timer 600'}
   notime     1
   room       01-Küche
   valueFormat { '10Minuten' => '10 Minuten' }
   valueIcon  { state => '%devStateIcon' }
Titel: Antw:DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Ellert am 03 Dezember 2016, 19:38:47
Zitatich habe jetzt fast 1,5 Jahre nichts mit fhem gemacht

Mit ca. 250 Beiträgen in den letzten 18 Monaten, warst Du dafür aber recht aktiv ::)

Was Du mit Dummys gelöst hast, könntest Du direkt im DOIF lösen. Die Readings aus DOIF kannst Du in den rg`s auf die gleiche Weise einsetzen, wie Readings aus einem Dummy.

ZitatWenn hier jemand einen Tipp hat, wie man dies prinzipiell besser lösen könnte, wäre ich für Tipps dankbar.
Tipp 1 (http://fhem.de/commandref_DE.html#DOIF_setList__readingList)
Tipp 2 (http://www.fhemwiki.de/wiki/DOIF/Labor_-_ausf%C3%BChrbare,_praxisnahe_Beispiele_als_Probleml%C3%B6sung_zum_Experimetieren)
Titel: Antw:DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Spartacus am 05 Dezember 2016, 09:31:31
Hi Ellert,
danke für Deine Tipps. Das Labor war mir noch nicht bekannt. Ich werde das mal durcharbeiten.

BTW:
Naja, die 1,5 Jahre sind etwas übertrieben! Kam mir aber so vor!  Aber seit dem Frühjahr 16 habe ich wirklich nicht viel mit fhem gemacht. Höchstens ein paar Updates vom System!

Spartacus
Titel: Antw:DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Muschelpuster am 05 Dezember 2016, 10:41:29
Ein- & Ausschalten für eine Zeitsteuerung habe ich so gelöst:attr my_DOIF devStateIcon disabl.*:general_aus_fuer_zeit:enable .*:general_an_fuer_zeit:disable .*rro.*:icoTool

beispielhafte Grüße
Niels
Titel: Antw:DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Spartacus am 05 Dezember 2016, 17:44:42
Hi Niels,
danke für Deinen Input. Verstehe ich aber nicht komplett Deine Lösung:
was machst Du mit ".*rro.*:icoTool"?

Christian
Titel: Antw:DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Muschelpuster am 05 Dezember 2016, 18:30:56
Wenn der State irgendwo Error enthält, dann soll ein Schraubenschlüssel angezeigt werden. Das müsste aber eine Position nach vorne, da die Prüfung durch den .* dort nie mehr ankommt.
Oder gleich etwas verbindlicher:disabl.*:general_aus_fuer_zeit:enable initi.*|cmd.*:general_an_fuer_zeit:disable .*rro.*:icoTool

korrigierte Grüße
Niels
Titel: Antw:DOIF: suche neuen Ansatz für meine DOIF-RG Visualisierung
Beitrag von: Spartacus am 05 Dezember 2016, 21:57:16
Hallo Niels,
so, jetzt habe ich mich damit etwas näher beschäftigt. Deine Variante kann ich in der Form nicht verwenden, da das ganze Modul deaktiviert wird und nicht nur eine Bedingung (z.B. cmd1 oder cmd2)

Ich denke, ich muss mit Setlist  arbeiten, wobei mir das mit dem Symbol besser gefällt, als die Button oder die Dropdownlist....muss ich noch mal gucken, wie ich das devStateIcon  nutze um hier bestimmte Bedingungen auszublenden.

Christian