From 76027f6fc5117bb3f57fbfce66efeacb83f45997 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Fri, 21 Nov 2025 21:54:54 -0600 Subject: [PATCH] created stages dir --- apps/apps.yaml | 56 ++--------------------------------- apps/hello.py | 10 ++++--- apps/stages/bar.yaml | 48 ++++++++++++++++++++++++++++++ apps/{ => stages}/light.py | 0 apps/{ => stages}/stages.py | 2 +- apps/stages/upper_stairs.yaml | 44 +++++++++++++++++++++++++++ 6 files changed, 102 insertions(+), 58 deletions(-) create mode 100644 apps/stages/bar.yaml rename apps/{ => stages}/light.py (100%) rename apps/{ => stages}/stages.py (95%) create mode 100644 apps/stages/upper_stairs.yaml diff --git a/apps/apps.yaml b/apps/apps.yaml index e87501e..98ce4cc 100644 --- a/apps/apps.yaml +++ b/apps/apps.yaml @@ -1,53 +1,3 @@ -# hello_world: -# module: hello -# class: HelloWorld - - -bar_lights: - module: light - class: StagedLight - stages: - - start: '03:00 am' - scene: - light.bar: - state: on - color_temp_kelvin: 4500 - brightness: 25 - - start: '09:00 am' - scene: - light.bar: - state: on - color_temp_kelvin: 3500 - brightness: 100 - - start: '13:00' - scene: - light.bar: - state: on - color_temp_kelvin: 2500 - brightness: 150 - - start: 'sunset' - scene: - light.bar: - state: on - color_temp_kelvin: 2202 - brightness: 100 - light.server_lamp: - state: on - rgb_color: [255, 112, 86] - brightness: 175 - - start: '10:00 pm' - scene: - light.bar: - state: on - color_temp_kelvin: 2202 - brightness: 75 - light.server_lamp: - state: on - rgb_color: [255, 112, 86] - brightness: 75 - - start: '11:30 pm' - scene: - light.bar: - state: on - color_temp_kelvin: 2202 - brightness: 30 +hello-world: + module: hello + class: HelloWorld diff --git a/apps/hello.py b/apps/hello.py index 4076766..03fa7b7 100755 --- a/apps/hello.py +++ b/apps/hello.py @@ -1,7 +1,9 @@ -from appdaemon.adapi import ADAPI +from appdaemon.plugins.hass import Hass -class HelloWorld(ADAPI): +class HelloWorld(Hass): def initialize(self): - self.log("Hello from AppDaemon") - self.log("You are now ready to run Apps!") + self.log('Hello from AppDaemon') + self.log('You are now ready to run Apps!') + + self.get_history('ball1') diff --git a/apps/stages/bar.yaml b/apps/stages/bar.yaml new file mode 100644 index 0000000..e2540b3 --- /dev/null +++ b/apps/stages/bar.yaml @@ -0,0 +1,48 @@ +bar_lights: + module: light + class: StagedLight + stages: + - start: '03:00 am' + scene: + light.bar: + state: on + color_temp_kelvin: 4500 + brightness: 25 + - start: '09:00 am' + scene: + light.bar: + state: on + color_temp_kelvin: 3500 + brightness: 100 + - start: '13:00' + scene: + light.bar: + state: on + color_temp_kelvin: 2500 + brightness: 150 + - start: 'sunset' + scene: + light.bar: + state: on + color_temp_kelvin: 2202 + brightness: 100 + light.server_lamp: + state: on + rgb_color: [255, 112, 86] + brightness: 175 + - start: '10:00 pm' + scene: + light.bar: + state: on + color_temp_kelvin: 2202 + brightness: 75 + light.server_lamp: + state: on + rgb_color: [255, 112, 86] + brightness: 75 + - start: '11:30 pm' + scene: + light.bar: + state: on + color_temp_kelvin: 2202 + brightness: 30 diff --git a/apps/light.py b/apps/stages/light.py similarity index 100% rename from apps/light.py rename to apps/stages/light.py diff --git a/apps/stages.py b/apps/stages/stages.py similarity index 95% rename from apps/stages.py rename to apps/stages/stages.py index 4374074..1fc2cdf 100644 --- a/apps/stages.py +++ b/apps/stages/stages.py @@ -6,7 +6,7 @@ from pydantic import PrivateAttr from pydantic import field_serializer -class EntityState(BaseModel): +class EntityState(BaseModel, extra='allow'): state: bool = True color_temp_kelvin: int | None = None rgb_color: list[int] | None = None diff --git a/apps/stages/upper_stairs.yaml b/apps/stages/upper_stairs.yaml new file mode 100644 index 0000000..32aacf8 --- /dev/null +++ b/apps/stages/upper_stairs.yaml @@ -0,0 +1,44 @@ +upper_stairs: + module: light + class: StagedLight + stages: + - start: '04:00' + scene: + light.bathroom_stairs: + state: "on" + color_temp_kelvin: 4000 + brightness: 30 + light.spire: + state: "on" + color_temp_kelvin: 4000 + brightness: 30 + - start: '07:00' + scene: + light.bathroom_stairs: + state: "on" + color_temp_kelvin: 4000 + brightness: 60 + light.spire: + state: "on" + color_temp_kelvin: 4000 + brightness: 60 + - start: 'sunset' + scene: + light.bathroom_stairs: + state: "on" + color_temp_kelvin: 2202 + brightness: 60 + light.spire: + state: "on" + color_temp_kelvin: 2202 + brightness: 60 + - start: '11:00' + scene: + light.bathroom_stairs: + state: "on" + color_temp_kelvin: 2202 + brightness: 40 + light.spire: + state: "on" + color_temp_kelvin: 2202 + brightness: 40