Init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
import globals
|
||||
#
|
||||
# Entity timer
|
||||
# Turn on and off this entities
|
||||
#
|
||||
# Args:
|
||||
#
|
||||
# None
|
||||
#
|
||||
# Release Notes
|
||||
#
|
||||
# Version 1.0:
|
||||
# Initial Version
|
||||
|
||||
class EntityTimer(hass.Hass):
|
||||
def initialize(self):
|
||||
if not globals.check_args(self, ["on_time", "off_time"]):
|
||||
return
|
||||
on_time = self.parse_time(self.args["on_time"])
|
||||
off_time = self.parse_time(self.args["off_time"])
|
||||
|
||||
self.on_timer = self.run_daily(self.on_timer_tick, on_time)
|
||||
self.off_timer = self.run_daily(self.off_timer_tick, off_time)
|
||||
|
||||
def on_timer_tick(self, kwargs):
|
||||
self.log('on_timer')
|
||||
if 'entity' in self.args:
|
||||
self.turn_on(self.args['entity'])
|
||||
|
||||
def off_timer_tick(self, kwargs):
|
||||
self.log('off_timer')
|
||||
if 'entity' in self.args:
|
||||
self.turn_off(self.args['entity'])
|
||||
@@ -0,0 +1,35 @@
|
||||
led_timer:
|
||||
module: entity_timer
|
||||
class: EntityTimer
|
||||
on_time: "09:00:00"
|
||||
off_time: "22:00:00"
|
||||
entity: switch.ledstrip
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
led_window_timer:
|
||||
module: entity_timer
|
||||
class: EntityTimer
|
||||
on_time: "09:00:00"
|
||||
off_time: "23:00:00"
|
||||
entity: switch.wifi_socket
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
xmas_tree_timer:
|
||||
module: entity_timer
|
||||
class: EntityTimer
|
||||
on_time: "09:00:00"
|
||||
off_time: "23:00:00"
|
||||
entity: switch.broadlink_switch
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
# tv_timer:
|
||||
# module: entity_timer
|
||||
# class: EntityTimer
|
||||
# on_time: "09:00:00"
|
||||
# off_time: "22:30:00"
|
||||
# entity: switch.plug_158d0001104a0c
|
||||
# global_dependencies:
|
||||
# - globals
|
||||
Reference in New Issue
Block a user