Compare commits

...

3 Commits

4 changed files with 52 additions and 7 deletions

View File

@@ -1,7 +1,8 @@
debugger: # I now directly run AppDaemon with debugpy in DockerStart.sh. Not sure which is best
module: debugger # debugger:
class: Debugger # module: debugger
port: 5678 # class: Debugger
# port: 5678
motion_tracker: motion_tracker:
module: motiontracker module: motiontracker

View File

@@ -17,6 +17,10 @@ from ad_toolbox.eventhandler import EventHandler
# brightness_pct_step: <int> # optional, default 5 # brightness_pct_step: <int> # optional, default 5
# Step size (% of full brightness) used by increase/decrease events. # Step size (% of full brightness) used by increase/decrease events.
# #
# brightness_step_transition: <seconds> # optional, default 0.5
# Transition duration applied to each increase/decrease brightness
# step. Smooths out the brightness change instead of jumping.
#
# increase_brightness_events: # optional # increase_brightness_events: # optional
# <EventHandler events_block> # <EventHandler events_block>
# HA events that increase brightness by brightness_pct_step. # HA events that increase brightness by brightness_pct_step.
@@ -69,6 +73,7 @@ from ad_toolbox.eventhandler import EventHandler
# entity: light.living_room # entity: light.living_room
# #
# brightness_pct_step: 10 # brightness_pct_step: 10
# brightness_step_transition: 0.5
# #
# increase_brightness_events: # increase_brightness_events:
# btn_up: # btn_up:
@@ -126,6 +131,8 @@ class SmartLight(SmartSwitch):
self.brightness_pct_step = self.args["brightness_pct_step"] self.brightness_pct_step = self.args["brightness_pct_step"]
else: self.brightness_pct_step = 5 else: self.brightness_pct_step = 5
self.brightness_step_transition = self.args.get("brightness_step_transition", 0.8)
# on_events_with_transition: one EventHandler per labelled transition # on_events_with_transition: one EventHandler per labelled transition
if "on_events_with_transition" in self.args: if "on_events_with_transition" in self.args:
for key in self.args["on_events_with_transition"]: for key in self.args["on_events_with_transition"]:
@@ -166,12 +173,12 @@ class SmartLight(SmartSwitch):
# Increase brightness by brightness_pct_step while the light is on. # Increase brightness by brightness_pct_step while the light is on.
def on_increase_brightness_event(self, event_name, data, kwargs): def on_increase_brightness_event(self, event_name, data, kwargs):
if self.get_state(self.entity_id) != 'off': if self.get_state(self.entity_id) != 'off':
self.call_service("light/turn_on", entity_id = self.entity_id, brightness_step_pct = self.brightness_pct_step) self.call_service("light/turn_on", entity_id = self.entity_id, brightness_step_pct = self.brightness_pct_step, transition = self.brightness_step_transition)
# Decrease brightness by brightness_pct_step while the light is on. # Decrease brightness by brightness_pct_step while the light is on.
def on_decrease_brightness_event(self, event_name, data, kwargs): def on_decrease_brightness_event(self, event_name, data, kwargs):
if self.get_state(self.entity_id) != 'off': if self.get_state(self.entity_id) != 'off':
self.call_service("light/turn_on", entity_id = self.entity_id, brightness_step_pct = -self.brightness_pct_step) self.call_service("light/turn_on", entity_id = self.entity_id, brightness_step_pct = -self.brightness_pct_step, transition = self.brightness_step_transition)
# EventHandler callback for on_events_with_transition. Jumps to 1 % # EventHandler callback for on_events_with_transition. Jumps to 1 %
# first so the ramp always starts from a known low level, then # first so the ramp always starts from a known low level, then

View File

@@ -26,6 +26,7 @@ light_hallway:
25: binary_sensor.day_interval_night 25: binary_sensor.day_interval_night
100: True 100: True
light_restroom: light_restroom:
module: smartlight module: smartlight
class: SmartLight class: SmartLight
@@ -39,3 +40,38 @@ light_restroom:
1: input_boolean.sleeping 1: input_boolean.sleeping
25: binary_sensor.day_interval_night 25: binary_sensor.day_interval_night
100: True 100: True
light_bedroom_nightstand:
module: smartlight
class: SmartLight
entity: light.berdroom_bedlight
toggle_events:
button_press:
event_name: zha_event
event_data:
device_name: 'bedroom_hue_remote'
args:
press_type: 'press'
button: 'off'
increase_brightness_events:
up_hold:
event_name: zha_event
event_data:
device_name: 'bedroom_hue_remote'
args:
press_type: 'hold'
button: 'up'
decrease_brightness_events:
down_hold:
event_name: zha_event
event_data:
device_name: 'bedroom_hue_remote'
args:
press_type: 'hold'
button: 'down'

1
dockerStart.sh Symbolic link
View File

@@ -0,0 +1 @@
/usr/src/app/dockerStart.sh