Enhance project structure and testing capabilities

- Updated .dockerignore to include additional logs and IDE files, improving Docker build efficiency.
- Added .eslintrc.json for TypeScript linting configuration, ensuring code quality and consistency.
- Refactored Dockerfile to streamline the build process and utilize a slimmer Node.js image.
- Introduced jest-resolver.cjs and jest.setup.js for improved Jest testing configuration and setup.
- Updated jest.config.js to support ESM and added new test patterns for better test organization.
- Enhanced TypeScript schemas to include new device types (media_player, fan, lock, vacuum, scene, script, camera) for comprehensive validation.
- Added unit tests for device schemas and Home Assistant connection, improving test coverage and reliability.
- Updated README.md with new testing instructions and device control examples, enhancing user guidance.
This commit is contained in:
jango-blockchained
2024-12-17 15:07:40 +01:00
parent 3cd1ae58a5
commit 108524c7c4
30 changed files with 2385 additions and 130 deletions

View File

@@ -128,6 +128,82 @@ npx jest --config=jest.config.js # Run tests
}
```
### Media Player Control
```json
{
"tool": "control",
"command": "media_play", // or "media_pause", "media_stop", "media_next", "media_previous"
"entity_id": "media_player.living_room",
"volume_level": 0.5,
"source": "Spotify",
"media_content_id": "spotify:playlist:xyz",
"media_content_type": "playlist"
}
```
### Fan Control
```json
{
"tool": "control",
"command": "turn_on",
"entity_id": "fan.bedroom",
"percentage": 50,
"preset_mode": "auto",
"oscillating": true,
"direction": "forward"
}
```
### Lock Control
```json
{
"tool": "control",
"command": "lock", // or "unlock"
"entity_id": "lock.front_door"
}
```
### Vacuum Control
```json
{
"tool": "control",
"command": "start", // or "pause", "stop", "return_to_base", "clean_spot"
"entity_id": "vacuum.robot",
"fan_speed": "medium"
}
```
### Scene Control
```json
{
"tool": "control",
"command": "turn_on",
"entity_id": "scene.movie_night"
}
```
### Script Control
```json
{
"tool": "control",
"command": "turn_on",
"entity_id": "script.welcome_home",
"variables": {
"brightness": 100,
"color": "red"
}
}
```
### Camera Control
```json
{
"tool": "control",
"command": "enable_motion_detection", // or "disable_motion_detection"
"entity_id": "camera.front_door"
}
```
## Natural Language Integration
### Example Commands