appd - Begun work on a time-of-day manager
This commit is contained in:
parent
87653e0485
commit
f3776f3f2d
22
appdaemon/apps/timeofday.py
Normal file
22
appdaemon/apps/timeofday.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import base
|
||||||
|
class TimeOfDay(base.Entities):
|
||||||
|
def initialize(self):
|
||||||
|
super().initialize()
|
||||||
|
|
||||||
|
self.run_in(self.setup_inputs, 1)
|
||||||
|
|
||||||
|
def setup_inputs(self, kwargs):
|
||||||
|
inputs = ['morning', 'day', 'evening', 'night', 'sunrise', 'sunset', 'tod', 'dark']
|
||||||
|
for i in inputs:
|
||||||
|
e = dict(self.args[i])
|
||||||
|
name = e['name']
|
||||||
|
default = e['default']
|
||||||
|
del e['name']
|
||||||
|
del e['default']
|
||||||
|
self.register_entity(i, name, True, default, e)
|
||||||
|
|
||||||
|
self.e['sunrise'].listen(self.input_listener, {'changed': "sunrise"})
|
||||||
|
|
||||||
|
|
||||||
|
def input_listener(self, kwargs):
|
||||||
|
self.log(kwargs)
|
63
appdaemon/apps/timeofday.yaml
Normal file
63
appdaemon/apps/timeofday.yaml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
timeofday:
|
||||||
|
module: timeofday
|
||||||
|
class: TimeOfDay
|
||||||
|
global_dependencies:
|
||||||
|
- base
|
||||||
|
|
||||||
|
morning:
|
||||||
|
name: input_datetime.tod_morning
|
||||||
|
default: "05:45"
|
||||||
|
has_date: False
|
||||||
|
has_time: True
|
||||||
|
friendly_name: Morning
|
||||||
|
icon: mdi:weather-sunset-up
|
||||||
|
day:
|
||||||
|
name: input_datetime.tod_day
|
||||||
|
default: "08:00"
|
||||||
|
has_date: False
|
||||||
|
has_time: True
|
||||||
|
friendly_name: Dag
|
||||||
|
icon: mdi:weather-sunny
|
||||||
|
evening:
|
||||||
|
name: input_datetime.tod_evening
|
||||||
|
default: "19:00"
|
||||||
|
has_date: False
|
||||||
|
has_time: True
|
||||||
|
friendly_name: Kväll
|
||||||
|
icon: mdi:weather-sunset-down
|
||||||
|
night:
|
||||||
|
name: input_datetime.tod_night
|
||||||
|
default: "23:00"
|
||||||
|
has_date: False
|
||||||
|
has_time: True
|
||||||
|
friendly_name: Natt
|
||||||
|
icon: mdi:minus
|
||||||
|
sunrise:
|
||||||
|
name: input_number.tod_sunrise_offset
|
||||||
|
default: 30
|
||||||
|
min: -120
|
||||||
|
max: 120
|
||||||
|
step: 5
|
||||||
|
mode: slider
|
||||||
|
sunset:
|
||||||
|
name: input_number.tod_sunset_offset
|
||||||
|
default: -30
|
||||||
|
min: -120
|
||||||
|
max: 120
|
||||||
|
step: 5
|
||||||
|
mode: slider
|
||||||
|
|
||||||
|
tod:
|
||||||
|
name: input_select.tod
|
||||||
|
default: morning
|
||||||
|
friendly_name: Time of Day
|
||||||
|
options:
|
||||||
|
- morning
|
||||||
|
- day
|
||||||
|
- evening
|
||||||
|
- night
|
||||||
|
dark:
|
||||||
|
name: switch.tod_dark
|
||||||
|
default: on
|
||||||
|
friendly_name: Sun Down
|
||||||
|
icon: mdi:weather-night
|
26
packages/appd_dummies.yaml
Normal file
26
packages/appd_dummies.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
homeassistant:
|
||||||
|
customize:
|
||||||
|
input_number.appd_dummy:
|
||||||
|
hidden: true
|
||||||
|
input_datetime.appd_dummy:
|
||||||
|
hidden: true
|
||||||
|
input_select.appd_dummy:
|
||||||
|
hidden: true
|
||||||
|
input_boolean.appd_dummy:
|
||||||
|
hidden: true
|
||||||
|
input_text.appd_dummy:
|
||||||
|
hidden: true
|
||||||
|
|
||||||
|
input_number:
|
||||||
|
appd_dummy:
|
||||||
|
min: 0
|
||||||
|
max: 10
|
||||||
|
input_datetime:
|
||||||
|
appd_dummy: {}
|
||||||
|
input_select:
|
||||||
|
appd_dummy:
|
||||||
|
options: [1]
|
||||||
|
input_boolean:
|
||||||
|
appd_dummy:
|
||||||
|
input_text:
|
||||||
|
appd_dummy: {}
|
Loading…
x
Reference in New Issue
Block a user