added support for a home assistant helper button
This commit is contained in:
@@ -110,11 +110,16 @@ Use this command from the appdaemon config directory to clone this repo as a sub
|
||||
git submodule add -b main https://github.com/jsl12/room_control ./apps/room_control
|
||||
```
|
||||
|
||||
```
|
||||
git submodule update --remote
|
||||
```
|
||||
|
||||
```shell
|
||||
./appdaemon_config
|
||||
├── apps
|
||||
│ ├── room_control
|
||||
│ └── rooms
|
||||
├── appdaemon.yaml
|
||||
├── docker-compose.yml
|
||||
└── secrets.yaml
|
||||
```
|
||||
@@ -132,7 +137,7 @@ services:
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- config:/conf
|
||||
ports:
|
||||
- 5050:5050
|
||||
- 5050:5000
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[project]
|
||||
name = 'room_control'
|
||||
version = "1.0.0"
|
||||
description = "Various utilities for a single room controlling app"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
dependencies = [
|
||||
'pvlib'
|
||||
]
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
@@ -1,5 +1,6 @@
|
||||
from copy import deepcopy
|
||||
from datetime import time, timedelta
|
||||
from gc import callbacks
|
||||
from typing import List
|
||||
|
||||
import astral
|
||||
@@ -17,12 +18,18 @@ class RoomController(Hass):
|
||||
"""
|
||||
|
||||
def initialize(self):
|
||||
self.state_change_handle = self.listen_state(self.handle_state_change, self.entity)
|
||||
self.app_entities = self.gather_app_entities()
|
||||
|
||||
self.refresh_state_times()
|
||||
self.sync_state()
|
||||
self.run_daily(callback=self.refresh_state_times, start='00:00:00')
|
||||
|
||||
self.app_entities = self.gather_app_entities()
|
||||
# sets up motion callbacks
|
||||
self.state_change_handle = self.listen_state(self.handle_state_change, self.entity)
|
||||
self.sync_state()
|
||||
|
||||
if (ha_button := self.args.get('ha_button')):
|
||||
self.log(f'Setting up input button: {self.friendly_name(ha_button)}')
|
||||
self.listen_state(callback=self.activate_any_on, entity_id=ha_button)
|
||||
|
||||
if (button := self.args.get('button')):
|
||||
if not isinstance(button, list):
|
||||
@@ -303,11 +310,11 @@ class RoomController(Hass):
|
||||
else:
|
||||
self.log(f'Skipped activating - everything is not off')
|
||||
|
||||
def activate_any_on(self, kwargs):
|
||||
def activate_any_on(self, *args, **kwargs):
|
||||
if self.any_on:
|
||||
self.activate()
|
||||
else:
|
||||
self.log(f'Skipped activating - everything is not off')
|
||||
self.log(f'Skipped activating - everything is off')
|
||||
|
||||
def deactivate(self, *args, **kwargs):
|
||||
self.log('Deactivating')
|
||||
|
||||
Reference in New Issue
Block a user