Skip to content

Commit 329697a

Browse files
authored
Beginnings of playground (#15)
* feat: add playground * chore: create user * chore: update readme * chore: update state
1 parent ef6d687 commit 329697a

37 files changed

+737
-1
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,20 @@ Run your automations locally
7373
yarn dev
7474
```
7575

76-
### Test
76+
## Testing
77+
78+
#### Unit tests and integration tests
7779

7880
Run all your tests
7981

8082
```bash
8183
yarn test
8284
```
8385

86+
#### End-to-end tests
87+
88+
See [./playground](./playground/README.md) folder readme.
89+
8490
## Publication
8591

8692
### Build

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"type": "module",
88
"scripts": {
99
"dev": "bun --hot --watch src/main.ts",
10+
"play": "docker-compose -f playground/docker-compose.yml up",
11+
"endplay": "docker-compose -f playground/docker-compose.yml down",
1012
"sync": "yarn up \"@digital-alchemy/*\" && bunx --env-file .env type-writer",
1113
"build": "bun --env-file .env build:docker",
1214
"build:dist": "bun build src/main.ts --compile --minify --outfile dist/server",

playground/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Automation Playground
2+
3+
This playground is intended to help you test and learn about making automations.
4+
5+
It features a Home Assistant instance that you can safely experiment with, without affecting your
6+
own home environment.
7+
8+
## Credentials
9+
10+
In the playground we'll use the following credentials:
11+
12+
Username: `digital` Password: `alchemy`
13+
14+
## Home assistant
15+
16+
Accessible at: http://localhost:8123
17+
18+
## Usage
19+
20+
#### Start playground
21+
22+
```bash
23+
yarn play
24+
```
25+
26+
#### Stop playground
27+
28+
```bash
29+
yarn endplay
30+
```

playground/docker-compose.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
services:
3+
homeassistant:
4+
image: lscr.io/linuxserver/homeassistant:latest
5+
container_name: playground-homeassistant
6+
network_mode: bridge
7+
environment:
8+
- PUID=1000
9+
- PGID=1000
10+
- TZ=Etc/UTC
11+
volumes:
12+
- ./homeassistant/config:/config
13+
ports:
14+
- 8123:8123 #optional
15+
# devices:
16+
# - /path/to/device:/path/to/device #optional
17+
restart: unless-stopped
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024.4.3
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Sensitive files
2+
passwd
3+
*.db*
4+
!*.db
5+
*.sqlite
6+
7+
# Home Assistant generated files
8+
/.cloud
9+
/backups
10+
**/*.log*
11+
temp.txt
12+
*.bolt
13+
/lsiopy
14+
tts/*
15+
16+
# Vendor files (explicitly per folder, for reinstall purposes)
17+
/custom_components/hacs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"version": 1,
3+
"minor_version": 2,
4+
"key": "assist_pipeline.pipelines",
5+
"data": {
6+
"items": [
7+
{
8+
"conversation_engine": "homeassistant",
9+
"conversation_language": "en",
10+
"id": "01hvypmpwba6n20a5a3gz0wk57",
11+
"language": "en",
12+
"name": "Home Assistant",
13+
"stt_engine": null,
14+
"stt_language": null,
15+
"tts_engine": "cloud",
16+
"tts_language": "en-US",
17+
"tts_voice": "JennyNeural",
18+
"wake_word_entity": null,
19+
"wake_word_id": null
20+
}
21+
],
22+
"preferred_item": "01hvypmpwba6n20a5a3gz0wk57"
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"version": 1,
3+
"minor_version": 1,
4+
"key": "auth",
5+
"data": {
6+
"users": [
7+
{
8+
"id": "a5e3f0338e38448a90aa4797511b5b4d",
9+
"group_ids": [
10+
"system-read-only"
11+
],
12+
"is_owner": false,
13+
"is_active": true,
14+
"name": "Home Assistant Content",
15+
"system_generated": true,
16+
"local_only": false
17+
},
18+
{
19+
"id": "5217a56b1c754713b6308e883dd5f22f",
20+
"group_ids": [
21+
"system-admin"
22+
],
23+
"is_owner": true,
24+
"is_active": true,
25+
"name": "Digital Alchemy",
26+
"system_generated": false,
27+
"local_only": false
28+
}
29+
],
30+
"groups": [
31+
{
32+
"id": "system-admin",
33+
"name": "Administrators"
34+
},
35+
{
36+
"id": "system-users",
37+
"name": "Users"
38+
},
39+
{
40+
"id": "system-read-only",
41+
"name": "Read Only"
42+
}
43+
],
44+
"credentials": [
45+
{
46+
"id": "0eb3dd17ce874321938c88bcdfdf89a6",
47+
"user_id": "5217a56b1c754713b6308e883dd5f22f",
48+
"auth_provider_type": "homeassistant",
49+
"auth_provider_id": null,
50+
"data": {
51+
"username": "digital"
52+
}
53+
}
54+
],
55+
"refresh_tokens": [
56+
{
57+
"id": "71b3f77099fa4d86b33a4acc74ed2d90",
58+
"user_id": "a5e3f0338e38448a90aa4797511b5b4d",
59+
"client_id": null,
60+
"client_name": null,
61+
"client_icon": null,
62+
"token_type": "system",
63+
"created_at": "2024-04-20T21:29:48.827488+00:00",
64+
"access_token_expiration": 1800.0,
65+
"token": "da5a2b72e294aa44a48e337fdc1403aed3193461a7ab2c8619c0a5dd0d2c3884c4678b57c365e78e73c3e48c6b40c3505f4f81ba731179adb2d1312d91976891",
66+
"jwt_key": "2f39d1c4e836a81314e3dc378feae8d1ff4d88e7651e93865c636cc355fc983144fffbc14a90da8be502b85461c3f2ea3cc7145d59e652996565b8e327a638aa",
67+
"last_used_at": null,
68+
"last_used_ip": null,
69+
"expire_at": null,
70+
"credential_id": null,
71+
"version": "2024.4.3"
72+
},
73+
{
74+
"id": "5248f6204da5445cafaf9dd7c1af0f92",
75+
"user_id": "5217a56b1c754713b6308e883dd5f22f",
76+
"client_id": "http://localhost:8123/",
77+
"client_name": null,
78+
"client_icon": null,
79+
"token_type": "normal",
80+
"created_at": "2024-04-20T21:30:45.847881+00:00",
81+
"access_token_expiration": 1800.0,
82+
"token": "75b599e455ffac0f1b2b82d27bd866ad1ca978b28900ab3e5d45653e1933d36f07499277ecb2e568338e5713947981063ee7e385500594906a3f81bfdb8f9bd0",
83+
"jwt_key": "0d16c3e597c4ddf3c82c22ae1db23f76e82147cc1c2b439bc90635f2a7c3a89a418f9cb06335d7a831a187dc514617a0d59465002ee6e983c09b3077e709a973",
84+
"last_used_at": "2024-04-20T22:27:39.538260+00:00",
85+
"last_used_ip": "172.17.0.1",
86+
"expire_at": 1721428059.53826,
87+
"credential_id": "0eb3dd17ce874321938c88bcdfdf89a6",
88+
"version": "2024.4.3"
89+
}
90+
]
91+
}
92+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"minor_version": 1,
4+
"key": "auth_provider.homeassistant",
5+
"data": {
6+
"users": [
7+
{
8+
"username": "digital",
9+
"password": "JDJiJDEyJHB3b2ZrNXZPY1RLbFU5UlRkQkpwWnVMUFZjV0pBU1FIMC5CbzZ6VlNxdWZMbks3RHFmdXdT"
10+
}
11+
]
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": 1,
3+
"minor_version": 1,
4+
"key": "bluetooth.passive_update_processor",
5+
"data": {}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": 1,
3+
"minor_version": 1,
4+
"key": "core.analytics",
5+
"data": {
6+
"onboarded": true,
7+
"preferences": {},
8+
"uuid": null
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"version": 1,
3+
"minor_version": 6,
4+
"key": "core.area_registry",
5+
"data": {
6+
"areas": [
7+
{
8+
"aliases": [],
9+
"floor_id": null,
10+
"icon": null,
11+
"id": "living_room",
12+
"labels": [],
13+
"name": "Living Room",
14+
"picture": null
15+
},
16+
{
17+
"aliases": [],
18+
"floor_id": null,
19+
"icon": null,
20+
"id": "kitchen",
21+
"labels": [],
22+
"name": "Kitchen",
23+
"picture": null
24+
},
25+
{
26+
"aliases": [],
27+
"floor_id": null,
28+
"icon": null,
29+
"id": "bedroom",
30+
"labels": [],
31+
"name": "Bedroom",
32+
"picture": null
33+
}
34+
]
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1,
3+
"minor_version": 3,
4+
"key": "core.config",
5+
"data": {
6+
"latitude": 52.3731339,
7+
"longitude": 4.8903147,
8+
"elevation": 0,
9+
"unit_system_v2": "metric",
10+
"location_name": "Home",
11+
"time_zone": "Europe/Amsterdam",
12+
"external_url": null,
13+
"internal_url": null,
14+
"currency": "EUR",
15+
"country": "NL",
16+
"language": "en-GB"
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version": 1,
3+
"minor_version": 1,
4+
"key": "core.config_entries",
5+
"data": {
6+
"entries": [
7+
{
8+
"entry_id": "665cc088f5856930ec3692b7bcebf062",
9+
"version": 1,
10+
"minor_version": 1,
11+
"domain": "sun",
12+
"title": "Sun",
13+
"data": {},
14+
"options": {},
15+
"pref_disable_new_entities": false,
16+
"pref_disable_polling": false,
17+
"source": "import",
18+
"unique_id": null,
19+
"disabled_by": null
20+
},
21+
{
22+
"entry_id": "241d4179d6b2fe8e42531678290d4b83",
23+
"version": 1,
24+
"minor_version": 1,
25+
"domain": "shopping_list",
26+
"title": "Shopping list",
27+
"data": {},
28+
"options": {},
29+
"pref_disable_new_entities": false,
30+
"pref_disable_polling": false,
31+
"source": "onboarding",
32+
"unique_id": "shopping_list",
33+
"disabled_by": null
34+
},
35+
{
36+
"entry_id": "d6f293056a7bd8817eb06ccacea4fe86",
37+
"version": 1,
38+
"minor_version": 1,
39+
"domain": "google_translate",
40+
"title": "Google Translate text-to-speech",
41+
"data": {
42+
"language": "en",
43+
"tld": "com"
44+
},
45+
"options": {},
46+
"pref_disable_new_entities": false,
47+
"pref_disable_polling": false,
48+
"source": "onboarding",
49+
"unique_id": null,
50+
"disabled_by": null
51+
},
52+
{
53+
"entry_id": "32d636dfe7fbca41a2641a4cb5554e16",
54+
"version": 1,
55+
"minor_version": 1,
56+
"domain": "radio_browser",
57+
"title": "Radio Browser",
58+
"data": {},
59+
"options": {},
60+
"pref_disable_new_entities": false,
61+
"pref_disable_polling": false,
62+
"source": "onboarding",
63+
"unique_id": null,
64+
"disabled_by": null
65+
}
66+
]
67+
}
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": 1,
3+
"minor_version": 5,
4+
"key": "core.device_registry",
5+
"data": {
6+
"devices": [
7+
{"area_id":null,"config_entries":["665cc088f5856930ec3692b7bcebf062"],"configuration_url":null,"connections":[],"disabled_by":null,"entry_type":"service","hw_version":null,"id":"a28cabc60853c3d7752bf77044425bfc","identifiers":[["sun","665cc088f5856930ec3692b7bcebf062"]],"labels":[],"manufacturer":null,"model":null,"name_by_user":null,"name":"Sun","serial_number":null,"sw_version":null,"via_device_id":null}
8+
],
9+
"deleted_devices": []
10+
}
11+
}

0 commit comments

Comments
 (0)