Wakeuplight

Aus FHEMWiki
Version vom 10. Mai 2013, 22:54 Uhr von Generix (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „Set up a wakeup light which will slowly dim-up a lamp, e.g. at your bedside, and will switch it off again after a certain time. The solution requires a dimmer …“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Set up a wakeup light which will slowly dim-up a lamp, e.g. at your bedside, and will switch it off again after a certain time. The solution requires a dimmer hardware device, e.g. FS20-di. In the example below the dimmer is named Lamp1.

Code

define wakeup at *07:00:00 {\
  if (!$we) {\
   {fhem("set Lamp1 dim100% 1280") }\
   {fhem("define wakeupOff at +00:40:00 set Lamp1 off") }\
 }\
}

Explanation:

The time indicated for wakeup (here: 7am) is the starting-time of the dim-procedure. The asterisk indicates this procedure shall be executed every day.

The program uses the variable $we (weekend), so your wakeuplight will only turn on on weekdays. If you implement holiday2we, the wakeuplight will also remain off on holidays.

The set-command 'dim100% 1280' will dim the lamp to 100% over a timespan of 1280 seconds, i.e. 21 minutes.

Finally, the off-command is scheduled for 40 minutes from wakeuptime.

Change of wakeuptime

To change the wakeuptime to e.g. 8am, type the following into the input-field on the fhem-frontend:

modify wakeup *08:00:00


Change of wakeuptime using sliders

Setting the wakeuptime using the "modify wakeup" command is inconvenient. Especially forgetting to set the asterisk (*) is a pain, as the wakeup-definition will disappear after next execution. To avoid this pitfall, there is an option to add an additional pseudo-device which offers sliders to set the wakeup time:

define wakeupChange dummy
attr wakeupChange setList state:time
attr wakeupChange webCmd state
define n_wakeupChange notify wakeupChange {fhem("modify wakeup *%");;}

Explanation: A dummy device wakeupChange is defined. It carries sliders to select the wakeuptime. Subsequently, a notify is defined, which gets triggered whenever a time is selected using the sliders. This chosen time is then used to execute the 'modify wakeup'-command for the actual wakeup-device.