FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: riker1 am 15 April 2018, 14:54:37

Titel: Problem with notify and if using esp reding
Beitrag von: riker1 am 15 April 2018, 14:54:37
Hi

habe ein eps sistance reading als alert


{fhem("set dist_alert  139_Distalert lt 100 :".ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","")."!---:!--at $hms--- ");

.ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","").

bekomme ich auch die distanz. bin mir nicht sicher ob das dann eine Zahl ist.

im Notify für einen Alert:
defmod N_test_ESPEasy_ESP_Nmcu10_139_Dist_139 notify ESPEasy_ESP_Nmcu10_139_Dist_139:Dist_V:.* \
{my $sw_absent = Value("testswitch");; my $dist = ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","");;\
if ( $dist lt 60 ) \
  {fhem("set dist_alert  139_Distalert <<<< lt 60 :".ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","")."!---:!--at $hms--- ");;fhem(" set  TR_BOT message !FROM:!-ESPEasy_ESP_Nmcu10_139_Dist_139--DISTANZ-BUERO- ".$NAME."!--EV:!".$EVENT."! :!-".ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","")."!---:!--at $hms---and Acer Liquid: state:-".ReadingsVal("Acer_liquid","state","")." -------value testswitch!!".$sw_absent."!!!")}\
elsif ( $dist gt 80 && $dist lt 100)\
{fhem("set dist_alert  139_Distalert zwischen 80 und  100 !!!:".ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","")."!---:!--at $hms--- ")}\
elsif ( $dist gt 100 )\
{fhem("set dist_alert  139_Distalert >>>> gt 100 !!!:".ReadingsVal("ESPEasy_ESP_Nmcu10_139_Dist_139","Dist_V","")."!---:!--at $hms--- ")}\
}


erfolgt die Auswertung nicht korrekt.

Wie kann ich das denn berechnen?

das log sieht so aus:
2018-04-15_14:56:36 ESPEasy_ESP_Nmcu10_139_Dist_139 Dist_V: 146
2018-04-15_14:56:36 ESPEasy_ESP_Nmcu10_139_Dist_139 Dis: 146
2018-04-15_14:56:37 ESPEasy_ESP_Nmcu10_139_Dist_139 Dist_V: 146
2018-04-15_14:56:37 ESPEasy_ESP_Nmcu10_139_Dist_139 Dis: 146
2018-04-15_14:56:38 ESPEasy_ESP_Nmcu10_139_Dist_139 Dist_V: 146
2018-04-15_14:56:38 ESPEasy_ESP_Nmcu10_139_Dist_139 Dis: 146


Danke für die Hilfe

T

Titel: Antw:Problem with notify and if using esp reding
Beitrag von: CoolTux am 15 April 2018, 15:20:36
Nimm ReadingsNum dann kannst dir sicher sein.
Und zahlen mit < oder > vergleichen.
Titel: Antw:Problem with notify and if using esp reding
Beitrag von: riker1 am 16 April 2018, 07:38:30
super, danke klappt nun