Compare commits
5 Commits
61d5d99dee
...
moes-pad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ae7c2b8e9 | ||
|
|
01c6faa362 | ||
|
|
56ee0c3d3e | ||
|
|
657d01a724 | ||
|
|
e21eca4f42 |
@@ -1,6 +1,5 @@
|
|||||||
appdaemon:
|
appdaemon:
|
||||||
uvloop: True
|
uvloop: True
|
||||||
use_dictionary_unpacking: True
|
|
||||||
import_method: expert
|
import_method: expert
|
||||||
latitude: 30.250968
|
latitude: 30.250968
|
||||||
longitude: -97.748193
|
longitude: -97.748193
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
hello-world:
|
hello-world:
|
||||||
module: hello
|
module: hello
|
||||||
class: HelloWorld
|
class: HelloWorld
|
||||||
|
|
||||||
|
gone:
|
||||||
|
module: gone
|
||||||
|
class: Gone
|
||||||
|
entities:
|
||||||
|
- light.bar
|
||||||
|
- light.h6076
|
||||||
|
- light.h6076_2
|
||||||
|
|||||||
27
apps/gone.py
Normal file
27
apps/gone.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from appdaemon.plugins.hass import Hass
|
||||||
|
|
||||||
|
|
||||||
|
class Gone(Hass):
|
||||||
|
def initialize(self):
|
||||||
|
people = self.get_state('person')
|
||||||
|
# self.log(json.dumps(people, indent=2))
|
||||||
|
|
||||||
|
self.log(list(people.keys()))
|
||||||
|
for person in self.get_state('person'):
|
||||||
|
self.listen_state(self.handle_state, entity_id=person, new='not_home')
|
||||||
|
|
||||||
|
self.log(f'No one home: {self.no_one_home()}')
|
||||||
|
|
||||||
|
def no_one_home(self) -> bool:
|
||||||
|
return all(state.get('state') != 'home' for state in self.get_state('person', copy=False).values())
|
||||||
|
|
||||||
|
def handle_state(self, entity: str, attribute: str, old: Any, new: Any, **kwargs: Any) -> None:
|
||||||
|
if self.no_one_home():
|
||||||
|
for ent in self.args['entities']:
|
||||||
|
try:
|
||||||
|
self.turn_off(ent)
|
||||||
|
except Exception:
|
||||||
|
self.log(f'Failed to turn off {ent}', level='ERROR')
|
||||||
|
continue
|
||||||
@@ -2,7 +2,7 @@ bar_lights:
|
|||||||
module: light
|
module: light
|
||||||
class: StagedLight
|
class: StagedLight
|
||||||
activate-at-start: true
|
activate-at-start: true
|
||||||
transition: 3
|
# transition: 3
|
||||||
stages:
|
stages:
|
||||||
- start: '03:00 am'
|
- start: '03:00 am'
|
||||||
scene:
|
scene:
|
||||||
@@ -44,20 +44,26 @@ bar_lights:
|
|||||||
brightness: 100
|
brightness: 100
|
||||||
light.server_lamp:
|
light.server_lamp:
|
||||||
state: "on"
|
state: "on"
|
||||||
rgb_color:
|
rgb_color: [255, 112, 86]
|
||||||
- 255
|
|
||||||
- 112
|
|
||||||
- 86
|
|
||||||
brightness: 175
|
brightness: 175
|
||||||
light.h6076:
|
light.living_room_stick:
|
||||||
state: "on"
|
state: "on"
|
||||||
brightness: 50
|
brightness: 150
|
||||||
effect: sunset
|
effect: sunset
|
||||||
- start: 'sunset + 1:00'
|
- start: 'sunset + 1:00'
|
||||||
scene:
|
scene:
|
||||||
light.h6076:
|
light.bar:
|
||||||
state: on
|
state: on
|
||||||
brightness: 255
|
color_temp_kelvin: 2202
|
||||||
|
brightness: 75
|
||||||
|
light.server_lamp:
|
||||||
|
state: "on"
|
||||||
|
rgb_color: [255, 112, 86]
|
||||||
|
brightness: 175
|
||||||
|
light.living_room_stick:
|
||||||
|
state: "on"
|
||||||
|
brightness: 100
|
||||||
|
effect: sunset
|
||||||
- start: '10:00 pm'
|
- start: '10:00 pm'
|
||||||
scene:
|
scene:
|
||||||
light.bar:
|
light.bar:
|
||||||
@@ -68,9 +74,10 @@ bar_lights:
|
|||||||
state: on
|
state: on
|
||||||
rgb_color: [255, 112, 86]
|
rgb_color: [255, 112, 86]
|
||||||
brightness: 75
|
brightness: 75
|
||||||
light.h6076:
|
light.living_room_stick:
|
||||||
state: "on"
|
state: "on"
|
||||||
brightness: 175
|
brightness: 175
|
||||||
|
effect: sunset
|
||||||
- start: '11:30 pm'
|
- start: '11:30 pm'
|
||||||
scene:
|
scene:
|
||||||
light.bar:
|
light.bar:
|
||||||
@@ -78,4 +85,10 @@ bar_lights:
|
|||||||
color_temp_kelvin: 2202
|
color_temp_kelvin: 2202
|
||||||
brightness: 30
|
brightness: 30
|
||||||
light.server_lamp:
|
light.server_lamp:
|
||||||
state: off
|
state: on
|
||||||
|
rgb_color: [255, 112, 86]
|
||||||
|
brightness: 25
|
||||||
|
light.living_room_stick:
|
||||||
|
state: "on"
|
||||||
|
brightness: 75
|
||||||
|
effect: sunset
|
||||||
|
|||||||
Reference in New Issue
Block a user