Update cast documentation with script example (#13110)

This commit is contained in:
Fredrik Erlandsson 2020-04-21 12:19:54 +02:00 committed by GitHub
parent 88c0b9cc34
commit ac3f1af97b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,13 +14,17 @@ You can enable the Cast integration by going to the Integrations page inside the
## Home Assistant Cast
Home Assistant has its own Cast application to show the Home Assistant UI on any Chromecast device. You can use it by adding the [Cast entity row](/lovelace/entities/#cast) to your Lovelace UI, or by calling the `cast.show_lovelace_view` service. The service takes the path of a Lovelace view and an entity ID of a Cast device to show the view on. A `path` has to be defined in your Lovelace YAML for each view, as outlined in the [views documentation](/lovelace/views/#path).
Home Assistant has its own Cast application to show the Home Assistant UI on any Chromecast device. You can use it by adding the [Cast entity row](/lovelace/entities/#cast) to your Lovelace UI, or by calling the `cast.show_lovelace_view` service. The service takes the path of a Lovelace view and an entity ID of a Cast device to show the view on. A `path` has to be defined in your Lovelace YAML for each view, as outlined in the [views documentation](/lovelace/views/#path). The following is a full configuration for a script that starts casting the `downstairs` tab of the `lovelace-cast` path (note that `entity_id` is specified under `data` and not for the service call):
```json
{
"entity_id": "media_player.office_display_4",
"view_path": "lights"
}
```yaml
'cast_downstairs_on_kitchen':
alias: Show Downstairs on kitchen
sequence:
- data:
dashboard_path: lovelace-cast-
entity_id: media_player.kitchen
view_path: downstairs
service: cast.show_lovelace_view
```
Note that Home Assistant Cast requires your Home Assistant installation to be accessible via `https://`. If you're using Home Assistant Cloud, you don't need to do anything. Otherwise you must make sure that you have configured the `base_url` for [the `http` integration](/integrations/http/).