FHEM Forum

FHEM => Automatisierung => DOIF => Thema gestartet von: chq am 05 März 2019, 08:42:22

Titel: isn't numeric in numeric
Beitrag von: chq am 05 März 2019, 08:42:22
Hallo,

ich bekomme in meinem Logfile bei einem meiner DOIFs folgende Fehlermeldungen:

2019.03.05 08:18:49 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27334) line 1.
2019.03.05 08:18:49 3: eval: doif_rolloWohnzimmer: warning in condition c03
2019.03.05 08:18:49 1: PERL WARNING: Argument "" isn't numeric in numeric lt (<) at (eval 27335) line 1.
2019.03.05 08:18:49 3: eval: doif_rolloWohnzimmer: warning in condition c04
2019.03.05 08:20:41 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27394) line 1.
2019.03.05 08:20:41 3: eval: doif_rolloWohnzimmer: warning in condition c02
2019.03.05 08:20:41 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27395) line 1.
2019.03.05 08:20:41 3: eval: doif_rolloWohnzimmer: warning in condition c03
2019.03.05 08:20:41 1: PERL WARNING: Argument "" isn't numeric in numeric lt (<) at (eval 27396) line 1.
2019.03.05 08:20:41 3: eval: doif_rolloWohnzimmer: warning in condition c04
2019.03.05 08:22:01 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27437) line 1.
2019.03.05 08:22:01 3: eval: doif_rolloWohnzimmer: warning in condition c02
2019.03.05 08:22:01 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27438) line 1.
2019.03.05 08:22:01 3: eval: doif_rolloWohnzimmer: warning in condition c03
2019.03.05 08:22:01 1: PERL WARNING: Argument "" isn't numeric in numeric lt (<) at (eval 27439) line 1.
2019.03.05 08:22:01 3: eval: doif_rolloWohnzimmer: warning in condition c04
2019.03.05 08:22:33 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27467) line 1.
2019.03.05 08:22:33 3: eval: doif_rolloWohnzimmer: warning in condition c02
2019.03.05 08:22:33 1: PERL WARNING: Argument "" isn't numeric in numeric ge (>=) at (eval 27468) line 1.
2019.03.05 08:22:33 3: eval: doif_rolloWohnzimmer: warning in condition c03


Müssen da bei den Zahlen evtl. die Gänsefüßchen weg?

Gruß Chris

Hier ein list des DOIFs:

Internals:
   DEF        ## ==eq !=ne <lt >gt le<= ge>=

## and [HM_markise:state] eq "closed"

([00:00]) () ## idle

DOELSEIF ([06:30-09:00] and !$we and ([Wetterstation:luminosity] > "0" or [Wetterstation:UVR] >= "2.5") and [wettervorhersage:fc1_high_c] >= "24" and [?Wetterstation:temperature] > "0") (set HM_rolloWohnzimmer pct 27)

DOELSEIF ([06:30-09:00] and !$we and ([Wetterstation:luminosity] > "0" or [Wetterstation:UVR] >= "2.5") and [wettervorhersage:fc1_high_c] >= "17" and [wettervorhersage:fc1_high_c] < "24" and [?Wetterstation:temperature] > "0") (set HM_rolloWohnzimmer pct 77)

DOELSEIF ([06:30-09:00] and !$we and ([Wetterstation:luminosity] > "0" or [Wetterstation:UVR] >= "2.5") and [wettervorhersage:fc1_high_c] < "17" and [?Wetterstation:temperature] > "0") (set HM_rolloWohnzimmer pct 100)

DOELSEIF ([07:30-09:00] and $we and ([Wetterstation:luminosity] > "0" or [Wetterstation:UVR] >= "2.5") and [wettervorhersage:fc1_high_c] >= "24" and [?Wetterstation:temperature] > "0") (set HM_rolloWohnzimmer pct 27)

DOELSEIF ([07:30-09:00] and $we and ([Wetterstation:luminosity] > "0" or [Wetterstation:UVR] >= "2.5") and [wettervorhersage:fc1_high_c] >= "17" and [wettervorhersage:fc1_high_c] < "24" and [?Wetterstation:temperature] > "0") (set HM_rolloWohnzimmer pct 77)

DOELSEIF ([07:30-09:00] and $we and ([Wetterstation:luminosity] > "0" or [Wetterstation:UVR] >= "2.5") and [wettervorhersage:fc1_high_c] < "17" and [?Wetterstation:temperature] > "0") (set HM_rolloWohnzimmer pct 100)

DOELSEIF ([{sunset("HORIZON=-2.2",0,"16:00","23:59")}-24:00] and [Wetterstation:luminosity] == "0" and [Wetterstation:UVR] <= "2.6" and [HM_rolloWohnzimmer:control] > "0") (set HM_rolloWohnzimmer pct 0)

DOELSEIF ([{sunset("HORIZON=-2.2",0,"16:00","23:59")}-24:00] and [Wetterstation:luminosity] == "0" and [Wetterstation:UVR] <= "2.6" and [HM_rolloWohnzimmer:control] == "0") () ## closed
   MODEL      FHEM
   NAME       doif_rolloWohnzimmer
   NR         63
   NTFY_ORDER 50-doif_rolloWohnzimmer
   STATE      open
   TYPE       DOIF
   READINGS:
     2019-03-05 08:37:13   Device          Wetterstation
     2019-03-05 06:48:42   cmd             4
     2019-03-05 06:48:42   cmd_event       Wetterstation
     2019-03-05 06:48:42   cmd_nr          4
     2019-03-05 06:49:23   e_HM_rolloWohnzimmer_control 100
     2019-03-05 08:36:57   e_Wetterstation_UVR 266.974414809537
     2019-03-05 08:35:21   e_Wetterstation_luminosity 4427.14779826265
     2019-03-04 18:50:29   mode            enabled
     2019-03-05 06:48:42   state           open
     2019-03-05 00:00:00   timer_01_c01    06.03.2019 00:00:00
     2019-03-04 18:50:30   timer_02_c02    05.03.2019 06:30:00
     2019-03-04 18:50:30   timer_03_c02    05.03.2019 09:00:00
     2019-03-04 18:50:30   timer_04_c03    05.03.2019 06:30:00
     2019-03-04 18:50:30   timer_05_c03    05.03.2019 09:00:00
     2019-03-04 18:50:30   timer_06_c04    05.03.2019 06:30:00
     2019-03-04 18:50:30   timer_07_c04    05.03.2019 09:00:00
     2019-03-04 18:50:30   timer_08_c05    05.03.2019 07:30:00
     2019-03-04 18:50:30   timer_09_c05    05.03.2019 09:00:00
     2019-03-04 18:50:30   timer_10_c06    05.03.2019 07:30:00
     2019-03-04 18:50:30   timer_11_c06    05.03.2019 09:00:00
     2019-03-04 18:50:30   timer_12_c07    05.03.2019 07:30:00
     2019-03-04 18:50:30   timer_13_c07    05.03.2019 09:00:00
     2019-03-05 00:00:00   timer_14_c08    05.03.2019 18:22:16
     2019-03-05 00:00:00   timer_15_c08    06.03.2019 00:00:00
     2019-03-05 00:00:00   timer_16_c09    05.03.2019 18:22:16
     2019-03-05 00:00:00   timer_17_c09    06.03.2019 00:00:00
     2019-03-05 08:36:57   warning         condition c04: Argument "" isn't numeric in numeric lt (<)

   Regex:
   attr:
     cmdState:
       0:
         idle
       1:
         27
       2:
         77
       3:
         open
       4:
         27
       5:
         77
       6:
         open
       7:
         closed
       8:
         closed
     wait:
     waitdel:
   condition:
     0          ::DOIF_time_once($hash,0,$wday)
     1          ::DOIF_time($hash,1,2,$wday,$hms) and !$we and (::ReadingValDoIf($hash,'Wetterstation','luminosity') > "0" or ::ReadingValDoIf($hash,'Wetterstation','UVR') >= "2.5") and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') >= "24" and ::ReadingValDoIf($hash,'Wetterstation','temperature') > "0"
     2          ::DOIF_time($hash,3,4,$wday,$hms) and !$we and (::ReadingValDoIf($hash,'Wetterstation','luminosity') > "0" or ::ReadingValDoIf($hash,'Wetterstation','UVR') >= "2.5") and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') >= "17" and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') < "24" and ::ReadingValDoIf($hash,'Wetterstation','temperature') > "0"
     3          ::DOIF_time($hash,5,6,$wday,$hms) and !$we and (::ReadingValDoIf($hash,'Wetterstation','luminosity') > "0" or ::ReadingValDoIf($hash,'Wetterstation','UVR') >= "2.5") and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') < "17" and ::ReadingValDoIf($hash,'Wetterstation','temperature') > "0"
     4          ::DOIF_time($hash,7,8,$wday,$hms) and $we and (::ReadingValDoIf($hash,'Wetterstation','luminosity') > "0" or ::ReadingValDoIf($hash,'Wetterstation','UVR') >= "2.5") and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') >= "24" and ::ReadingValDoIf($hash,'Wetterstation','temperature') > "0"
     5          ::DOIF_time($hash,9,10,$wday,$hms) and $we and (::ReadingValDoIf($hash,'Wetterstation','luminosity') > "0" or ::ReadingValDoIf($hash,'Wetterstation','UVR') >= "2.5") and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') >= "17" and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') < "24" and ::ReadingValDoIf($hash,'Wetterstation','temperature') > "0"
     6          ::DOIF_time($hash,11,12,$wday,$hms) and $we and (::ReadingValDoIf($hash,'Wetterstation','luminosity') > "0" or ::ReadingValDoIf($hash,'Wetterstation','UVR') >= "2.5") and ::ReadingValDoIf($hash,'wettervorhersage','fc1_high_c') < "17" and ::ReadingValDoIf($hash,'Wetterstation','temperature') > "0"
     7          ::DOIF_time($hash,13,14,$wday,$hms) and ::ReadingValDoIf($hash,'Wetterstation','luminosity') == "0" and ::ReadingValDoIf($hash,'Wetterstation','UVR') <= "2.6" and ::ReadingValDoIf($hash,'HM_rolloWohnzimmer','control') > "0"
     8          ::DOIF_time($hash,15,16,$wday,$hms) and ::ReadingValDoIf($hash,'Wetterstation','luminosity') == "0" and ::ReadingValDoIf($hash,'Wetterstation','UVR') <= "2.6" and ::ReadingValDoIf($hash,'HM_rolloWohnzimmer','control') == "0"
   days:
   devices:
     1           Wetterstation wettervorhersage
     2           Wetterstation wettervorhersage
     3           Wetterstation wettervorhersage
     4           Wetterstation wettervorhersage
     5           Wetterstation wettervorhersage
     6           Wetterstation wettervorhersage
     7           Wetterstation HM_rolloWohnzimmer
     8           Wetterstation HM_rolloWohnzimmer
     all         Wetterstation wettervorhersage HM_rolloWohnzimmer
   do:
     0:
       0         
     1:
       0          set HM_rolloWohnzimmer pct 27
     2:
       0          set HM_rolloWohnzimmer pct 77
     3:
       0          set HM_rolloWohnzimmer pct 100
     4:
       0          set HM_rolloWohnzimmer pct 27
     5:
       0          set HM_rolloWohnzimmer pct 77
     6:
       0          set HM_rolloWohnzimmer pct 100
     7:
       0          set HM_rolloWohnzimmer pct 0
     8:
       0         
     9:
   helper:
     event      wind_speed: 13.7
     globalinit 1
     last_timer 17
     sleeptimer -1
     timerdev   Wetterstation
     timerevent wind_speed: 14.8,wind_gust: 20.2,UVR: 266.974414809537
     triggerDev Wetterstation
     DOIF_eventas:
       cmd_nr: 4
       cmd: 4
       cmd_event: Wetterstation
       state: open
     timerevents:
       wind_speed: 14.8
       wind_gust: 20.2
       UVR: 266.974414809537
     timereventsState:
       wind_speed: 14.8
       wind_gust: 20.2
       UVR: 266.974414809537
     triggerEvents:
       wind_speed: 13.7
     triggerEventsState:
       wind_speed: 13.7
   internals:
   interval:
     1          -1
     10         9
     11         -1
     12         11
     13         -1
     14         13
     15         -1
     16         15
     2          1
     3          -1
     4          3
     5          -1
     6          5
     7          -1
     8          7
     9          -1
   intervalfunc:
   intervaltimer:
   itimer:
   localtime:
     0          1551826800
     1          1551763800
     10         1551772800
     11         1551767400
     12         1551772800
     13         1551806536
     14         1551826800
     15         1551806536
     16         1551826800
     2          1551772800
     3          1551763800
     4          1551772800
     5          1551763800
     6          1551772800
     7          1551767400
     8          1551772800
     9          1551767400
   readings:
     1           Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c
     2           Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c
     3           Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c
     4           Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c
     5           Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c
     6           Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c
     7           Wetterstation:luminosity Wetterstation:UVR HM_rolloWohnzimmer:control
     8           Wetterstation:luminosity Wetterstation:UVR HM_rolloWohnzimmer:control
     all         Wetterstation:luminosity Wetterstation:UVR wettervorhersage:fc1_high_c HM_rolloWohnzimmer:control
   realtime:
     0          00:00:00
     1          06:30:00
     10         09:00:00
     11         07:30:00
     12         09:00:00
     13         18:22:16
     14         00:00:00
     15         18:22:16
     16         00:00:00
     2          09:00:00
     3          06:30:00
     4          09:00:00
     5          06:30:00
     6          09:00:00
     7          07:30:00
     8          09:00:00
     9          07:30:00
   time:
     0          00:00:00
     1          06:30:00
     10         09:00:00
     11         07:30:00
     12         09:00:00
     13         {sunset("HORIZON=-2.2",0,"16:00","23:59")}
     14         24:00:00
     15         {sunset("HORIZON=-2.2",0,"16:00","23:59")}
     16         24:00:00
     2          09:00:00
     3          06:30:00
     4          09:00:00
     5          06:30:00
     6          09:00:00
     7          07:30:00
     8          09:00:00
     9          07:30:00
   timeCond:
     0          0
     1          1
     10         5
     11         6
     12         6
     13         7
     14         7
     15         8
     16         8
     2          1
     3          2
     4          2
     5          3
     6          3
     7          4
     8          4
     9          5
   timer:
     0          0
     1          0
     10         0
     11         0
     12         0
     13         0
     14         0
     15         0
     16         0
     2          0
     3          0
     4          0
     5          0
     6          0
     7          0
     8          0
     9          0
   timers:
     0           0
     1           1  2
     2           3  4
     3           5  6
     4           7  8
     5           9  10
     6           11  12
     7           13  14
     8           15  16
   trigger:
   triggertime:
     1551772800:
       localtime  1551772800
       hash:
     1551806536:
       localtime  1551806536
       hash:
     1551826800:
       localtime  1551826800
       hash:
   uiState:
   uiTable:
Attributes:
   alias      doif_Rollo Wohnzimmer
   cmdState   idle|27|77|open|27|77|open|closed|closed


Edit: Ich glaub ich hab's, bin mir jedoch (noch) nicht sicher. [wettervorhersage:fc1_high_c] >= "24" wertet nicht mehr richtig aus, da ich das UWZ-Modul ("wettervorhersage" benannt) mangels Zuverlässigkeit gelöscht habe.
Titel: Antw:isn't numeric in numeric
Beitrag von: Christoph Morrison am 05 März 2019, 09:11:21
>=, >, <, <= sind numerische Vergleichsoperatoren, die du aber auf Strings (in ") anwendest.
Es müsste reichen >= durch ge etc. zu ersetzen (der String-Vergleichsoperator steht in der Fehlermeldung hinten, ge, lt etc.).

Wenn du aber weißt, dass du ein Wert nicht mehr lesen kannst (wettervorhersage:fc1_high_c), dann solltest du die auch aus dem DOIF entfernen.
Titel: Antw:isn't numeric in numeric
Beitrag von: Ellert am 05 März 2019, 09:13:39
In verschiedenen Vergleichen wird ein leerer Wert (Argument) zurück geliefert bei den in Klammern angegebenen Verleichsoperatoren. Du könntest Ersatzwerte verwenden, s. https://commandref.fhem.de/commandref_DE.html#DOIF_Inhaltsuebersicht
Titel: Antw:isn't numeric in numeric
Beitrag von: Per am 06 März 2019, 10:42:55
Du hast sämtliche Zahlen in "" gesetzt, damit sind es Strings und werden auch als solche behandelt. Achtung: bei Strings gilt "8" gt "11"!
Titel: Antw:isn't numeric in numeric
Beitrag von: chq am 06 März 2019, 12:25:49
Sind wirklich ganz tolle Antworten zusammengekommen.
Alles hilfreich- vielen Dank!

Werd jetzt bei Zahlen immer die " weglassen und mit > usw. vergleichen. Strings dann dementsprechend immer in " und gt usw.

Die DOIFs, die ich bisher so umgebaut habe, funktionieren jedenfalls immernoch.

Gruß Chris
Titel: Antw:isn't numeric in numeric
Beitrag von: Damian am 06 März 2019, 17:30:29
hier nochmal eine Klarstellung, warum Vergleich nicht immer so funktionieren, wie man denkt: https://forum.fhem.de/index.php/topic,51661.msg915143.html#msg915143