From a8b5c425a9e5610191cbb4dc9adb90e91d46b1b6 Mon Sep 17 00:00:00 2001 From: Martin Bauer Date: Sat, 6 Jan 2024 12:08:11 +0100 Subject: [PATCH] Config changes - kinderzimmer IR --- pyscript/ir_remote_kinderzimmer.py | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 pyscript/ir_remote_kinderzimmer.py diff --git a/pyscript/ir_remote_kinderzimmer.py b/pyscript/ir_remote_kinderzimmer.py new file mode 100644 index 0000000..1c66687 --- /dev/null +++ b/pyscript/ir_remote_kinderzimmer.py @@ -0,0 +1,44 @@ +from ir_helpers import * + +async def regal_licht_f(**kwargs): + async def f(): + await hass.services.async_call('light', 'turn_on', {'entity_id': "light.music_mouse_regal_licht", 'effect': 'static', **kwargs}) + return f + +@event_trigger("ir_command_received", "host == 'musicmouse.fritz.box' and repeat_counter == 0 and remote == 'ir_led3'") +def ir_remote_kinderzimmer(button_name=None, **kwargs): + mapping = { + 'key_on': scene_f('kinderzimmer_hell'), + 'key_off': light_f("turn_off", entity_id="group.kids_room"), + 'key_brightnessup': cover_f('open_cover', 'cover.kinderzimmer_rollo'), + 'key_brightnessdown': cover_f('close_cover', 'cover.kinderzimmer_rollo'), + 'key_white': scene_f('kinderzimmer_hell'), + 'key_red': scene_f('kinderzimmer_wickeln_nachts'), + 'key_pound': regal_licht_f(rgbw_color=[255, 30, 60, 0]), + 'key_1': regal_licht_f(rgbw_color=[255, 30, 60, 0]), + 'key_2': regal_licht_f(rgbw_color=[28, 255, 35, 0]), + 'key_3': regal_licht_f(rgbw_color=[0, 0, 255, 0]), + 'key_4': regal_licht_f(rgbw_color=[255, 156, 17, 0]), + 'key_5': regal_licht_f(rgbw_color=[12, 166, 255, 0]), + 'key_6': regal_licht_f(rgbw_color=[185, 10, 255, 0]), + 'key_7': regal_licht_f(rgbw_color=[255, 156, 17, 0], brightness=50, effect="side_0.2_inc8"), + 'key_8': regal_licht_f(rgbw_color=[0, 0, 255, 0], brightness=50, effect="side_0.2_inc8"), + 'key_9': regal_licht_f(rgbw_color=[255, 30, 60, 0], brightness=50, effect="side_0.2_inc8"), + } + if button_name in mapping: + mapping[button_name]() + elif button_name == 'key_smooth': + dimmer.dim(entity_id="light.music_mouse_regal_licht", offset=-30) + elif button_name == 'key_fade': + dimmer.dim(entity_id="light.music_mouse_regal_licht", offset=+30) + +@event_trigger("ir_command_received", "host == 'musicmouse.fritz.box' and repeat_counter == 0 and remote == 'Hauppauge'") +def ir_remote_hauppauge_kinderzimmer(button_name=None, **kwargs): + p = {'player': 'media_player.musicmouse'} + mapping = { + **default_ir_light_control('group.kids_room'), + **default_ir_cover_control('group.kids_room'), + **default_ir_music_control(**p), + } + if button_name in mapping: + mapping[button_name]() \ No newline at end of file