updating configuration
This commit is contained in:
@@ -23,7 +23,7 @@ cover_action:
|
||||
- cover.curtain_mainroom_bobbinet
|
||||
open_at_sunrise:
|
||||
- cover.curtain_kitchen
|
||||
- cover.curtain_mainroom
|
||||
#- cover.curtain_mainroom
|
||||
cover_door_sensors:
|
||||
cover.curtain_bedroom:
|
||||
- binary_sensor.door_bedroom_big_window_contact
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
light_control_hall:
|
||||
module: lightcontrol
|
||||
class: LightControl
|
||||
sensor: binary_sensor.motion_sensor_hall
|
||||
control_entity: switch.plug_light_hall
|
||||
control_night_entity: light.gateway
|
||||
timeout: 240
|
||||
constraint: input_boolean.hall_light_control
|
||||
ha_panel: alarm_control_panel.ha_alarm
|
||||
vacuum: vacuum.xiaomi_vacuum_cleaner
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
light_control_kitchen:
|
||||
module: lightcontrol
|
||||
class: LightControl
|
||||
sensor: group.kitchen_motion_sensors
|
||||
control_entity: switch.light_kitchen
|
||||
timeout: 600
|
||||
constraint: input_boolean.kitchen_light_control
|
||||
ha_panel: alarm_control_panel.ha_alarm
|
||||
vacuum: vacuum.xiaomi_vacuum_cleaner
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#################################
|
||||
# CLOAKROOM LIGHT #
|
||||
#################################
|
||||
light_control_cloakroom:
|
||||
module: lightcontrol
|
||||
class: LightControl
|
||||
sensor: binary_sensor.motion_cloakroom_occupancy
|
||||
control_entity: light.light_cloakroom
|
||||
timeout: 300
|
||||
global_dependencies:
|
||||
- globals
|
||||
@@ -0,0 +1,75 @@
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
import globals
|
||||
|
||||
#
|
||||
# Turn on entry light when the lock is opened (coming home).
|
||||
# Listens for 'door_opened' event, turns on control_entity and keeps it on
|
||||
# for 'timeout' seconds after the last event.
|
||||
#
|
||||
# Args:
|
||||
# control_entity = entity that will be turned on (example: light.light_hall_long)
|
||||
# timeout = seconds to keep the light on after the last door opening
|
||||
# events (optionally) = list of event names to listen to (default: ['door_opened'])
|
||||
# constraint = you can define constraint (input_boolean), that will turn on and off this app.
|
||||
#
|
||||
# Release Notes
|
||||
#
|
||||
# Version 1.0:
|
||||
# Initial Version
|
||||
|
||||
class LightControlEntry(hass.Hass):
|
||||
timer = None
|
||||
|
||||
def initialize(self):
|
||||
if not globals.check_args(self, ["control_entity", "timeout"]):
|
||||
return
|
||||
self.listen_event_handle_list = []
|
||||
for event in self.args.get('events', ['door_opened']):
|
||||
self.listen_event_handle_list.append(self.listen_event(self.event_trigger, event))
|
||||
|
||||
def event_trigger(self, event_name, data, kwargs):
|
||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||
return
|
||||
#turn on control entity and keep it on for 'timeout' seconds after last event.
|
||||
self.control_entity_on()
|
||||
self.run_timer()
|
||||
|
||||
def terminate(self):
|
||||
if self.listen_event_handle_list != None:
|
||||
for listen_event_handle in self.listen_event_handle_list:
|
||||
self.cancel_listen_event(listen_event_handle)
|
||||
|
||||
############ TIMER ########################
|
||||
def run_timer(self):
|
||||
if self.timer != None:
|
||||
self.stop_timer()
|
||||
self.timer = self.run_in(self.control_entity_off, self.args['timeout'])
|
||||
|
||||
def control_entity_on(self):
|
||||
#if 'constraint' is off - we dont need to do anything
|
||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||
return
|
||||
|
||||
entity = self.args['control_entity']
|
||||
state = self.get_state(entity)
|
||||
|
||||
self.turn_on(entity)
|
||||
self.log("Light on ({}).".format(entity))
|
||||
|
||||
def control_entity_off(self, kwargs):
|
||||
#if 'constraint' is off - we dont need to do anything
|
||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||
return
|
||||
|
||||
entity = self.args['control_entity']
|
||||
state = self.get_state(entity)
|
||||
self.turn_off(entity)
|
||||
self.log("Light off ({}).".format(entity))
|
||||
self.stop_timer()
|
||||
|
||||
def stop_timer(self):
|
||||
if (self.timer == None):
|
||||
return
|
||||
self.log('stopping timer.')
|
||||
self.cancel_timer(self.timer)
|
||||
self.timer = None
|
||||
@@ -0,0 +1,13 @@
|
||||
#################################
|
||||
# ENTRY LIGHT #
|
||||
#################################
|
||||
light_control_entry:
|
||||
module: lightcontrol_entry
|
||||
class: LightControlEntry
|
||||
events:
|
||||
- door_opened
|
||||
control_entity: light.light_hall_small
|
||||
timeout: 120
|
||||
constraint: input_boolean.locker_light_control
|
||||
global_dependencies:
|
||||
- globals
|
||||
@@ -34,9 +34,6 @@ class LightControlHall(hass.Hass):
|
||||
for sensor in self.args['motion_sensors']:
|
||||
self.listen_event_handle_list.append(self.listen_state(self.motion_trigger, sensor))
|
||||
|
||||
for event in self.args['events']:
|
||||
self.listen_event(self.event_trigger, event)
|
||||
|
||||
|
||||
def motion_trigger(self, entity, attribute, old, new, kwargs):
|
||||
#sensor is off
|
||||
@@ -59,15 +56,6 @@ class LightControlHall(hass.Hass):
|
||||
self.turn_on_by_door = True
|
||||
self.stop_timer()
|
||||
|
||||
def event_trigger(self, event_name, data, kwargs):
|
||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||
return
|
||||
#turnin on control entity and wait while sensor will be off, than run timer.
|
||||
self.control_entity_on()
|
||||
self.turn_on_by_door = True
|
||||
self.stop_timer()
|
||||
self.run_timer()
|
||||
|
||||
def terminate(self):
|
||||
if self.listen_event_handle_list != None:
|
||||
for listen_event_handle in self.listen_event_handle_list:
|
||||
|
||||
@@ -9,10 +9,22 @@ light_control_hall:
|
||||
- binary_sensor.door_locker_hall_left_contact
|
||||
- binary_sensor.door_locker2_hall_left_contact
|
||||
- binary_sensor.door_locker2_hall_right_contact
|
||||
events:
|
||||
- door_opened
|
||||
control_entity: light.light_hall_long
|
||||
timeout: 120
|
||||
constraint: input_boolean.locker_light_control
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
light_control_hall_small:
|
||||
module: lightcontrol_hall
|
||||
class: LightControlHall
|
||||
motion_sensors:
|
||||
- binary_sensor.motion_hall_small_occupancy
|
||||
door_sensors:
|
||||
- binary_sensor.door_locker3_hall_left_contact
|
||||
- binary_sensor.door_locker3_hall_right_contact
|
||||
control_entity: light.light_hall_small
|
||||
timeout: 120
|
||||
constraint: input_boolean.locker_light_control
|
||||
global_dependencies:
|
||||
- globals
|
||||
@@ -33,6 +33,8 @@ entities_action:
|
||||
- light.light_shower_shelf_light
|
||||
# hall
|
||||
- light.light_hall_long
|
||||
- light.light_hall_small
|
||||
- light.light_cloakroom
|
||||
# childroom
|
||||
- light.light_childroom_main
|
||||
- light.light_childroom_spotlights
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#################################
|
||||
# HOME PRESENSE #
|
||||
#################################
|
||||
entities_action:
|
||||
module: entities_action
|
||||
class: EntitiesByPresence
|
||||
away_entities:
|
||||
# air conditioners
|
||||
- climate.ac_bedroom
|
||||
- climate.ac_childroom
|
||||
- climate.ac_kitchen
|
||||
- climate.ac_mainroom
|
||||
|
||||
# din rail lights
|
||||
- light.light_mainroom_mainlamp
|
||||
- light.light_mainroom_spotlights
|
||||
- light.light_mainroom_pc_spotlight
|
||||
# balcony
|
||||
- light.light_balcony_spotlight
|
||||
# bedroom
|
||||
- light.light_bedroom_spotlights
|
||||
- light.light_bedroom_nightlight_left
|
||||
- light.light_bedroom_nightlight_right
|
||||
- light.light_bedroom_pc_spotlight
|
||||
- light.light_bedroom_mainlight
|
||||
- light.light_bedroom_pc_nightlight
|
||||
# bath
|
||||
- light.light_bath
|
||||
- light.light_bath_shelf
|
||||
# shower
|
||||
- light.light_shower_main_spotlights
|
||||
- light.light_shower_shower_spotlights
|
||||
- light.light_shower_shelf_light
|
||||
# hall
|
||||
- light.light_hall_long
|
||||
# childroom
|
||||
- light.light_childroom_main
|
||||
- light.light_childroom_spotlights
|
||||
- light.light_childroom_bed
|
||||
# kitchen
|
||||
- light.light_kitchen_spotlights
|
||||
- light.light_kitchen_table_lamp
|
||||
- light.light_kitchen_bar_lamp
|
||||
- light.light_kitchen_set
|
||||
|
||||
# ventilation
|
||||
- fan.ventilation_shower
|
||||
- fan.ventilation_bath
|
||||
|
||||
# bedside lamps
|
||||
- light.danil_bedside_lamp_rgbww_light
|
||||
- light.svetlana_bedside_lamp_rgbww_light
|
||||
|
||||
# mirrors and heaters
|
||||
- switch.shower_mirror
|
||||
- switch.switch_mirror_shower_heater
|
||||
- switch.light_bath_mirror
|
||||
- switch.switch_mirror_bath_heater
|
||||
|
||||
# media
|
||||
- media_player.bedroom_tv
|
||||
- media_player.kitchen_tv
|
||||
- media_player.mainroom_tv
|
||||
|
||||
# alice
|
||||
- media_player.yandex_station_m00r46000m53db
|
||||
- media_player.yandex_station_m00fhe2003seqr
|
||||
- media_player.yandex_station_ly00000000000008674600007209d3f5
|
||||
- media_player.yandex_station_ff98f029ab48468d28c557be
|
||||
- media_player.yandex_station_u003jc100phn9k
|
||||
return_entities:
|
||||
# - light.light_kitchen_set
|
||||
|
||||
thremostats:
|
||||
- climate.radiator_childroom
|
||||
- climate.radiator_mainroom
|
||||
- climate.radiator_kitchen
|
||||
- climate.radiator_bedroom
|
||||
- climate.radiator_bedroom_balcony
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
Reference in New Issue
Block a user