Bewegungsmelder: notify und at mit modify

Begonnen von Markus M., 25 Januar 2015, 01:40:26

Vorheriges Thema - Nächstes Thema

Markus M.

Ich versuche gerade mal ein neues Konzept für meine Bewegungsmelder zu basteln.
Leider funktioniert modify auf at in meinem Code nicht ganz wie erwartet.
Was an einer Stelle funktioniert, tut es an einer anderen nicht mehr.
Ein paar weitere Augenpaare sind wohl angebracht...

Hier mal der Auszug. Grün funktioniert, rot nicht (das at wird zwar aktiviert, bleibt aber auf 00:00:00 stehen d.h. das modify aus dem vorherigen at funktioniert nicht).

Übersehe ich hier irgendwas?

Zitat
# Livingroom

define motion_state_livingroom dummy
#attr motion_state_livingroom userattr time_alert,time_active,time_idle,time_normal
attr motion_state_livingroom room motion

define motion_setstate_livingroom_alert notify motion_livingroom.*:.*alert.* { \
  fhem "set motion_state_livingroom alert";; \
  fhem "attr motion_setstate_livingroom_i.* disable 1";; \
  fhem "attr motion_setstate_livingroom_n.* disable 1";; \
  fhem "attr motion_setstate_livingroom_alert disable 1";; \
  fhem "attr motion_setstate_livingroom_active disable 0";; \
}
attr motion_setstate_livingroom_alert disable 0
attr motion_setstate_livingroom_alert room motion

define motion_setstate_livingroom_timer notify motion_livingroom.*:.*alert.* { \
  fhem ("modify motion_setstate_livingroom_active *".strftime '%%H:%%M:%%S', localtime(time+180));; \
}
attr motion_setstate_livingroom_timer room motion

define motion_setstate_livingroom_active at *00:00:00 { \
  fhem "set motion_state_livingroom active";; \
  fhem "attr motion_setstate_livingroom_alert disable 0";; \
  fhem "attr motion_setstate_livingroom_active disable 1";; \
  fhem "attr motion_setstate_livingroom_i.* disable 0";; \
  fhem ("modify motion_setstate_livingroom_idle *".strftime '%%H:%%M:%%S', localtime(time+600));; \
}
attr motion_setstate_livingroom_active disable 1
attr motion_setstate_livingroom_active room motion

define motion_setstate_livingroom_idle at *00:00:00 { \
  fhem "set motion_state_livingroom idle";; \
  fhem "attr motion_setstate_livingroom_i.* disable 1";; \
  fhem "attr motion_setstate_livingroom_normal disable 0";; \
  fhem ("modify motion_setstate_livingroom_normal *".strftime '%%H:%%M:%%S', localtime(time+900));; \
}
attr motion_setstate_livingroom_idle disable 1
attr motion_setstate_livingroom_idle room motion

define motion_setstate_livingroom_inactive notify motion_livingroom.*:.*normal.* { \
  fhem "set motion_state_livingroom inactive";; \
  fhem "attr motion_setstate_livingroom_i.* disable 1";; \
  fhem "attr motion_setstate_livingroom_normal disable 0";; \
  fhem ("modify motion_setstate_livingroom_normal *".strftime '%%H:%%M:%%S', localtime(time+900));; \
}
attr motion_setstate_livingroom_inactive disable 1
attr motion_setstate_livingroom_inactive room motion

define motion_setstate_livingroom_normal at *00:00:00 { \
  fhem "set motion_state_livingroom normal";; \
  fhem "attr motion_setstate_livingroom_normal disable 1";; \
  fhem "attr motion_setstate_livingroom_none disable 0";; \
  fhem ("modify motion_setstate_livingroom_none *".strftime '%%H:%%M:%%S', localtime(time+1800));; \
}
attr motion_setstate_livingroom_normal disable 1
attr motion_setstate_livingroom_normal room motion

define motion_setstate_livingroom_none at *00:00:00 { \
  fhem "set motion_state_livingroom none";; \
  fhem "attr motion_setstate_livingroom_none disable 1";; \
}
attr motion_setstate_livingroom_none disable 1
attr motion_setstate_livingroom_none room motion

Gruss, Markus
Aktuell weder Smarthome noch FHEM vorhanden

RoBra81

Hallo,

Wenn ich das richtig durchblicke, wird das idle erst modifiziert, wenn das active ausgeführt wird. Erste Frage: wurde das active ausgeführt? Zweite Frage: das sieht mir alles recht kompliziert aus als ob es einfacher auch machbar wäre - könntest du kurz erklären, was du vor hast?

Ronny

Markus M.

Meine Bewegungsmelder senden alert und normal.
Da ich keinen Rückkanal habe kann es auch mal passieren dass normal nicht ankommt.
idle und inactive sind daher der gleiche Statustyp, nur dass eins automatisch passiert, das andere durch das normal Event des Bewegungsmelders.

Die Statusreihenfolge die ich so state-safe haben möchte ist
- alert (bei Bewegung)
- active (nach kurzer Zeit ohne Bewegung, Nachtlicht aus)
- idle/inactive (keine Bewegung, Licht aus etc.)
- normal (lange Zeit ohne Bewegung, Geräte aus)
- none (noch längere Zeit, Heizung runterregeln)

Die etwas eigenwilligen Bezeichnungen kommen daher dass ich für einen groben Statuscheck so nur auf die Anfangsbuchstaben gehen muss.

active wird ausgeführt, was ich daran sehe dass idle aktiv ist - allerdings immer noch mit 00:00:00.
Es scheint also nur das modify zu sein, das hier nicht funktioniert.

Wenn du eine Idee hast das zu vereinfachen, gerne :)
Aktuell weder Smarthome noch FHEM vorhanden