Compare commits

..

3 Commits

4 changed files with 52 additions and 7 deletions

View File

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

View File

@@ -17,6 +17,10 @@ from ad_toolbox.eventhandler import EventHandler
# brightness_pct_step: <int> # optional, default 5
# 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
# <EventHandler events_block>
# HA events that increase brightness by brightness_pct_step.
@@ -69,6 +73,7 @@ from ad_toolbox.eventhandler import EventHandler
# entity: light.living_room
#
# brightness_pct_step: 10
# brightness_step_transition: 0.5
#
# increase_brightness_events:
# btn_up:
@@ -126,6 +131,8 @@ class SmartLight(SmartSwitch):
self.brightness_pct_step = self.args["brightness_pct_step"]
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
if "on_events_with_transition" in self.args:
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.
def on_increase_brightness_event(self, event_name, data, kwargs):
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.
def on_decrease_brightness_event(self, event_name, data, kwargs):
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 %
# first so the ramp always starts from a known low level, then

View File

@@ -25,6 +25,7 @@ light_hallway:
1: input_boolean.sleeping
25: binary_sensor.day_interval_night
100: True
light_restroom:
module: smartlight
@@ -38,4 +39,39 @@ light_restroom:
light_brightness_pct:
1: input_boolean.sleeping
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