expert import mode

This commit is contained in:
John Lancaster
2024-05-02 22:49:46 -05:00
parent aedee1ac12
commit a38341484d
10 changed files with 21 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
appdaemon: appdaemon:
import_method: expert
latitude: 30.250968 latitude: 30.250968
longitude: -97.748193 longitude: -97.748193
elevation: 150 elevation: 150

View File

@@ -1,16 +1,11 @@
import logging import logging
import sys
from enum import Enum from enum import Enum
from pathlib import Path
from typing import Literal, Optional from typing import Literal, Optional
from appdaemon.plugins.hass.hassapi import Hass from appdaemon.plugins.hass.hassapi import Hass
from appdaemon.plugins.mqtt.mqttapi import Mqtt from appdaemon.plugins.mqtt.mqttapi import Mqtt
from pydantic import BaseModel, Field, TypeAdapter, field_validator from pydantic import BaseModel, Field, TypeAdapter, field_validator
from room_control.console import setup_component_logging
rc_path = (Path(__file__).resolve().parents[1] / 'room_control').as_posix()
sys.path.insert(0, rc_path)
from console import console, setup_component_logging
class Side(int, Enum): class Side(int, Enum):
@@ -20,13 +15,10 @@ class Side(int, Enum):
front = 3 front = 3
left = 4 left = 4
bottom = 5 bottom = 5
Actions = Literal[ Actions = Literal[
'', 'wakeup', '', 'wakeup', 'slide', 'shake', 'rotate_left', 'rotate_right', 'flip180', 'flip90'
'slide', 'shake',
'rotate_left', 'rotate_right',
'flip180', 'flip90'
] ]
@@ -104,9 +96,9 @@ class AqaraCube(Hass, Mqtt):
else: else:
self.log( self.log(
f'{event_name} on [topic]{data.topic}[/], Action: "[yellow]{str(action)}[/]"', f'{event_name} on [topic]{data.topic}[/], Action: "[yellow]{str(action)}[/]"',
level='DEBUG' level='DEBUG',
) )
if (arg := self.args.get(action, False)): if arg := self.args.get(action, False):
self.action_handler(action=action, description=arg) self.action_handler(action=action, description=arg)
elif handler := getattr(self, f'handle_{action}', None): elif handler := getattr(self, f'handle_{action}', None):
handler(data.payload) handler(data.payload)

View File

@@ -35,7 +35,7 @@ bathroom:
color_temp: 250 color_temp: 250
bathroom_button: bathroom_button:
module: button module: room_control
class: Button class: Button
dependencies: dependencies:
- bathroom - bathroom
@@ -45,7 +45,7 @@ bathroom_button:
ref_entity: light.bathroom ref_entity: light.bathroom
bathroom_motion: bathroom_motion:
module: motion module: room_control
class: Motion class: Motion
dependencies: dependencies:
- bathroom - bathroom

View File

@@ -77,7 +77,7 @@ bedroom:
sleep: input_boolean.sleeping sleep: input_boolean.sleeping
bedroom_buttons: bedroom_buttons:
module: button module: room_control
class: Button class: Button
dependencies: dependencies:
- bedroom - bedroom
@@ -89,7 +89,7 @@ bedroom_buttons:
- Bedroom Button 2 - Bedroom Button 2
bedroom_motion: bedroom_motion:
module: motion module: room_control
class: Motion class: Motion
dependencies: dependencies:
- bedroom - bedroom

View File

@@ -28,7 +28,7 @@ closet:
color_temp: 400 color_temp: 400
closet_motion: closet_motion:
module: motion module: room_control
class: Motion class: Motion
dependencies: dependencies:
- closet - closet

View File

@@ -40,7 +40,7 @@ kitchen:
brightness: 25 brightness: 25
kitchen_button: kitchen_button:
module: button module: room_control
class: Button class: Button
dependencies: dependencies:
- kitchen - kitchen
@@ -50,7 +50,7 @@ kitchen_button:
ref_entity: light.kitchen ref_entity: light.kitchen
kitchen_motion: kitchen_motion:
module: motion module: room_control
class: Motion class: Motion
dependencies: dependencies:
- kitchen - kitchen

View File

@@ -28,7 +28,7 @@ laundry:
color_temp: 400 color_temp: 400
laundry_motion: laundry_motion:
module: motion module: room_control
class: Motion class: Motion
dependencies: dependencies:
- laundry - laundry

View File

@@ -69,7 +69,7 @@ living_room:
brightness: 25 brightness: 25
front_door: front_door:
module: door module: room_control
class: Door class: Door
dependencies: dependencies:
- living_room - living_room
@@ -78,7 +78,7 @@ front_door:
door: binary_sensor.front_contact door: binary_sensor.front_contact
living_room_button: living_room_button:
module: button module: room_control
class: Button class: Button
dependencies: dependencies:
- living_room - living_room
@@ -88,7 +88,7 @@ living_room_button:
ref_entity: light.living_room ref_entity: light.living_room
living_room_motion: living_room_motion:
module: motion module: room_control
class: Motion class: Motion
dependencies: dependencies:
- living_room - living_room

View File

@@ -3,4 +3,6 @@
# matplotlib --only-binary=:matplotlib: # matplotlib --only-binary=:matplotlib:
# jupyterlab --only-binary=:jupyterlab: # jupyterlab --only-binary=:jupyterlab:
rich rich
pydantic pydantic
# /conf/apps/room_control