68 lines
1.3 KiB
Markdown
68 lines
1.3 KiB
Markdown
# AppDaemon Dev
|
|
|
|
## Setup
|
|
|
|
### Secrets
|
|
|
|
Needs a long-lived token for HA in `secrets.yaml`
|
|
|
|
### Debugger
|
|
|
|
Use with VSCode's debugger using a `launch.json` file.
|
|
|
|
```json
|
|
{
|
|
// Use IntelliSense to learn about possible attributes.
|
|
// Hover to view descriptions of existing attributes.
|
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
"version": "0.2.0",
|
|
"configurations": [
|
|
{
|
|
"name": "AppDaemon Dev",
|
|
"type": "debugpy",
|
|
"request": "launch",
|
|
"module": "appdaemon",
|
|
"justMyCode": true,
|
|
"args": "-c ../conf"
|
|
},
|
|
]
|
|
}
|
|
```
|
|
|
|
### Test Script
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
|
REPO_DIR=$(dirname $SCRIPT_DIR)
|
|
|
|
echo $REPO_DIR
|
|
cd $REPO_DIR
|
|
|
|
rm -rf ./dist
|
|
|
|
# isort ./appdaemon ./docs/conf.py
|
|
|
|
black ./appdaemon ./docs/conf.py
|
|
|
|
pre-commit run --all-files
|
|
|
|
python -m pytest
|
|
|
|
python -m build
|
|
|
|
docker build -t appdaemon:local-dev .
|
|
|
|
cd ../conf
|
|
docker compose run -it --rm appdaemon
|
|
```
|
|
|
|
## Reference
|
|
|
|
- [`importlib.reload(module)`](https://docs.python.org/3/library/importlib.html#importlib.reload)
|
|
- `AppManagement.check_app_updates`
|
|
- `AppManagement._load_reload_modules`
|
|
- `AppManagement._load_apps`
|
|
- `AppManagement.init_object` |