# oben: kurz: orange szene # lang: helle szene # unten: kurz: off, but 1 min bedlight # lang: rollos zu: nur tagsueber wenn komplett offen @event_trigger("homematic.keypress", "name == 'schlafzimmer_deckenlampe'") def schlafzimmer_licht(channel=None, param=None, **kwargs): up = (channel == 2) down = (channel == 1) long = (param == "PRESS_LONG") short = not long log.info(f"Schlafzimmer knopf up {up}, long {long}") if up and short: scene.schlafzimmer_orange.turn_on() elif up and long: scene.schlafzimmer_ganz_hell.turn_on() elif down and short: light.turn_off(entity_id='group.bedroom') scene.schlafzimmer_bettlicht_dunkel.turn_on() task.wait_until(timeout=60) light.bett_martin.turn_off() light.bett_rebecca.turn_off() elif down and long: during_day = float(sun.sun.elevation) > 5 covers_fully_open = (int(cover.schlafzimmer_rollo_gross.current_position) > 95 or int(cover.schlafzimmer_rollo_klein.current_position) > 95) if during_day and covers_fully_open: cover.schlafzimmer_rollo_gross.close_cover() cover_half.set_half(entity_id="cover.schlafzimmer_rollo_klein")