Add turn_on/turn_off/toggle support
- Add API_TURN_ON, API_TURN_OFF, API_TOGGLE constants - Add turn_on(), turn_off(), toggle() methods to MediaServerClient - Implement async_turn_on, async_turn_off, async_toggle in media player - Add TURN_ON and TURN_OFF to supported features - Update README with turn on/off/toggle documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
26
README.md
26
README.md
@@ -12,6 +12,7 @@ A Home Assistant custom integration that allows you to control a remote PC's med
|
||||
- Seek support with smooth timeline updates
|
||||
- Displays current track info (title, artist, album, artwork)
|
||||
- Real-time updates via WebSocket (with HTTP polling fallback)
|
||||
- **Turn on/off/toggle support** - Execute custom actions (e.g., lock screen on turn off)
|
||||
- **Script buttons** - Execute pre-defined scripts (shutdown, restart, lock, sleep, etc.)
|
||||
- Configurable via Home Assistant UI
|
||||
|
||||
@@ -69,6 +70,31 @@ A full-featured media player entity with:
|
||||
- Volume control and mute
|
||||
- Seek functionality
|
||||
- Current track information
|
||||
- Turn on/off/toggle actions (execute server-side callbacks)
|
||||
|
||||
### Turn On/Off/Toggle
|
||||
|
||||
The media player supports `media_player.turn_on`, `media_player.turn_off`, and `media_player.toggle` actions. These execute optional callbacks configured on the Media Server (e.g., lock screen on turn off).
|
||||
|
||||
Configure callbacks in Media Server's `config.yaml`:
|
||||
|
||||
```yaml
|
||||
callbacks:
|
||||
on_turn_on:
|
||||
command: "echo PC turned on"
|
||||
timeout: 10
|
||||
shell: true
|
||||
|
||||
on_turn_off:
|
||||
command: "rundll32.exe user32.dll,LockWorkStation"
|
||||
timeout: 5
|
||||
shell: true
|
||||
|
||||
on_toggle:
|
||||
command: "echo Toggle triggered"
|
||||
timeout: 10
|
||||
shell: true
|
||||
```
|
||||
|
||||
### Script Button Entities
|
||||
|
||||
|
||||
Reference in New Issue
Block a user