Hallo zusammen,
ich habe das Modul ABFALL installiert, was auch funktioniert.
Jetzt möchte ich, dass das Icon entsprechend der zu leerenden Tonne mit einem DOIF angepasst wird:
Internals:
CHANGED
DEF (ReadingsVal("myABFALL", "next_text","") =~ "Biotonne") (attr myABFALL icon muelltonne@#8B4513) (save) DOELSEIF (ReadingsVal("myABFALL", "next_text","") =~ "Graue Tonne") (attr myABFALL icon muelltonne@#696969) (save) DOELSEIF (ReadingsVal("myABFALL", "next_text","") =~ "Gelber Sack") (attr myABFALL icon muelltonne@#f4e946) (save) DOELSEIF (ReadingsVal("myABFALL", "next_text","") =~ "Papiertonne") (attr myABFALL icon muelltonne@blue) (save)
NAME di_icon_Abfall
NR 479
NTFY_ORDER 50-di_icon_Abfall
STATE cmd_1
TYPE DOIF
Readings:
2017-03-20 11:38:46 cmd 1.2
2017-03-20 11:38:46 cmd_event set_cmd_1
2017-03-20 11:38:46 cmd_nr 1
2017-03-20 11:38:46 cmd_seqnr 2
2017-03-20 11:38:46 error save: Wrote configuration to fhem.cfg
2017-03-20 11:38:46 nx_text Biotonne
2017-03-20 11:38:46 state cmd_1
Condition:
0 ReadingsVal("myABFALL", "next_text","") =~ "Biotonne"
1 ReadingsVal("myABFALL", "next_text","") =~ "Graue Tonne"
2 ReadingsVal("myABFALL", "next_text","") =~ "Gelber Sack"
3 ReadingsVal("myABFALL", "next_text","") =~ "Papiertonne"
Devices:
Do:
0:
0 attr myABFALL icon muelltonne@#8B4513
1 save
1:
0 attr myABFALL icon muelltonne@#696969
1 save
2:
0 attr myABFALL icon muelltonne@#f4e946
1 save
3:
0 attr myABFALL icon muelltonne@blue
1 save
4:
Helper:
globalinit 1
last_timer 0
sleeptimer -1
Itimer:
Regexp:
State:
Attributes:
do always
event-on-change-reading nx_text
icon helper_doif
room Abfall
userReadings nx_text { ReadingsVal("myABFALL", "next_text", " ") }
Allerdings ändert das Icon nicht automatisch die Farbe. Rufe ich cmd_1 bzw. cmd_2 usw. manuell auf, wird die Farbe wunschgemäß geändert. Was mache ich falsch?
Gruß
Hans-Ulrich
Das ist eher ein Fall für das DOIF Forum. Ausserdem empfehle ich noch mal die Commandref zu DOIF zu lesen. ReadingsVal ist bei DOIF fehl am Platz.
Falls es jemand benötigt, so funktioniert es:
DEF ([myABFALL:next_text] =~ "Biotonne") (attr AbfallGoogleCalender icon muelltonne@#8B4513) (save) DOELSEIF ([myABFALL:next_text] =~ "Graue Tonne") (attr AbfallGoogleCalender icon muelltonne@#696969) (save) DOELSEIF ([myABFALL:next_text] =~ "Gelber Sack") (attr AbfallGoogleCalender icon muelltonne@#f4e946) (save) DOELSEIF ([myABFALL:next_text] =~ "Papiertonne") (attr AbfallGoogleCalender icon muelltonne@blue) (save)
NAME di_icon_GCal
NR 482
NTFY_ORDER 50-di_icon_GCal
STATE cmd_3
TYPE DOIF
Gruß
Hans-Ulrich