Hallo zusammen,
ich versuche mit einem AT zu prüfen was im Schichtkalender steht und ob im Urlaubs oder Feiertagskalender etwas steht, um so etwas zu schalten (erstmal soll ein dummy einen text bekommen um zu sehen ob es klappt).
Mein Problem ist, dass das AT gestern einmal korrekt funktioniert hat, heute aber leider in keine Verzweigung mehr rein läuft. Hier mal der Code:
*21:00 {
my $cs = ReadingsVal("cal_ShiftMKr_View", "c-tomorrow", 0);;
my $cf = ReadingsVal("cal_FlagDays_View", "c-tomorrow" , 0);;
my $cv = ReadingsVal("cal_Vacation_View", "c-tomorrow" , 0);;
my $summary = ReadingsVal("calShift_View", "tomorrow_001_summary", "");;
if ($cs == 0){
fhem("set shift_test no_shift_tomorrow")
}
elsif ($cs ==1){
if ($summary eq "Frühschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test early")
}
elsif ($summary eq "Spätschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test late")
}
elsif ($summary eq "Nachtschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test night")
}
elsif ($cf == 1 || $cv == 1){
fhem("set shift_test flagday_or_vacation")
}
elsif ($summary eq "Gleitzeit" || $summary eq "krank" || $summary eq "Kurzarbeit"){
fhem("set shift_test flexi_or_ill_or_kurz")
}
}
}
Die CalViews sehen so aus:
ShiftMKr_View c-tomorrow = 1
ShiftMKr_View tomorrow_001_summary = Frühschicht
FlagDays_View c-tomorrow = 0
Vacation_View c-tomorrow = 0
Wo liegt hier mein Fehler?
hier noch das list:
Internals:
COMMAND {
my $cs = ReadingsVal("cal_ShiftMKr_View", "c-tomorrow", 0);
my $cf = ReadingsVal("cal_FlagDays_View", "c-tomorrow" , 0);
my $cv = ReadingsVal("cal_Vacation_View", "c-tomorrow" , 0);
my $summary = ReadingsVal("calShift_View", "tomorrow_001_summary", "");
if ($cs == 0){
fhem("set shift_test no_shift_tomorrow")
}
elsif ($cs == 1){
if ($summary eq "Frühschicht"){
fhem("set shift_test early")
}
elsif ($summary eq "Spätschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test late")
}
elsif ($summary eq "Nachtschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test night")
}
elsif ($cf == 1 || $cv == 1){
fhem("set shift_test flagday_or_vacation")
}
elsif ($summary eq "Gleitzeit" || $summary eq "krank" || $summary eq "Kurzarbeit"){
fhem("set shift_test flexi_or_ill_or_kurz")
}
}
}
DEF *21:00 {
my $cs = ReadingsVal("cal_ShiftMKr_View", "c-tomorrow", 0);
my $cf = ReadingsVal("cal_FlagDays_View", "c-tomorrow" , 0);
my $cv = ReadingsVal("cal_Vacation_View", "c-tomorrow" , 0);
my $summary = ReadingsVal("calShift_View", "tomorrow_001_summary", "");
if ($cs == 0){
fhem("set shift_test no_shift_tomorrow")
}
elsif ($cs == 1){
if ($summary eq "Frühschicht"){
fhem("set shift_test early")
}
elsif ($summary eq "Spätschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test late")
}
elsif ($summary eq "Nachtschicht" && $cf == 0 && $cv == 0){
fhem("set shift_test night")
}
elsif ($cf == 1 || $cv == 1){
fhem("set shift_test flagday_or_vacation")
}
elsif ($summary eq "Gleitzeit" || $summary eq "krank" || $summary eq "Kurzarbeit"){
fhem("set shift_test flexi_or_ill_or_kurz")
}
}
}
FUUID 5ed09e45-f33f-47f9-74d9-0e3b7e31656a5162
NAME cal_test
NR 396
PERIODIC yes
RELATIVE no
REP -1
STATE Next: 21:00:00
TIMESPEC 21:00
TRIGGERTIME 1591038000
TRIGGERTIME_FMT 2020-06-01 21:00:00
TYPE at
READINGS:
2020-06-01 08:08:36 state Next: 21:00:00
Attributes:
room Steuerung->Kalender
::)
Hab es gefunden! Habe einen Fehler in:
my $summary = ReadingsVal("calShift_View", "tomorrow_001_summary", "");
Das muss natürlich so:
my $summary = ReadingsVal("cal_ShiftMKr_View", "tomorrow_001_summary", "");