Google Cast
The Cast plugin (cast) drives Cast receivers — Chromecast, Nest speakers and displays, Cast-capable televisions — as
canonical media players over the CASTV2 protocol. LAN-local, no cloud. The source is in
reeve-iot/reeve-common-plugins.
The plugin discovers devices, translates receiver and media status into canonical media-player state, and sends canonical commands back over the same socket.
Discovery
mDNS is browsed in-process for the Cast service type. Each resolved record supplies a stable device identifier from its TXT record — the source id — and a friendly name, both falling back to the mDNS display name when absent. The port defaults to 8009 when the service record advertises zero.
On a VLAN where multicast does not propagate, discovery finds nothing. The escape hatch is a static host-and-port list; a static device's source id is its host and port, since there is no TXT identifier.
| Setting | Default | Notes |
|---|---|---|
MdnsEnabled |
true |
|
MdnsScanIntervalMinutes |
5 |
How often to re-browse for new or changed devices (1 to 1440). |
StaticDevices |
empty | Comma-separated host:port; the port defaults to 8009 when omitted. |
HeartbeatSeconds |
5 |
Ping interval (1 to 600). |
Transport
One persistent connection per device: CASTV2 over TLS on TCP 8009. Every message is a length-prefixed protobuf — a four-byte big-endian length covering the serialised bytes only, the header itself not counted — on one of four namespaces: connection, heartbeat, receiver and media.
On connect: connect and request status on the receiver namespace; when a running application appears in the receiver status, connect and request status again on the media namespace, addressed to that application's transport id.
Cast devices present self-signed certificates, so the transport accepts any certificate and there is no pinning knob. The threat model assumes a trusted LAN: on a network where an attacker can intercept traffic, interception is technically possible.
A ping goes out every heartbeat interval. If no message of any kind arrives for three intervals, the plugin declares the socket dead and reconnects with exponential backoff from one second to a thirty-second cap, with jitter.
Capabilities
| Canonical capability | Controllable | Source and command |
|---|---|---|
mediaplayer.state |
no | Derived: no running application is standby; running with no player state yet is idle; then playing, paused, buffering or idle from media status |
mediaplayer.volume |
yes | Receiver volume level scaled to a percentage; set-volume on the receiver namespace, clamped |
mediaplayer.isMuted |
yes | Receiver mute flag; set-volume on the receiver namespace |
mediaplayer.source |
yes | The running application's display name, falling back to its identifier; launch by resolved application identifier |
mediaplayer.command |
write-only | Play, pause, stop, next and previous on the media namespace, addressed to the running application's transport id |
mediaplayer.mediaTitle |
no | Media metadata title |
mediaplayer.mediaArtist |
no | Media metadata artist, falling back to subtitle |
mediaplayer.position |
yes (seek) | Current time from media status; seek on the media namespace |
mediaplayer.duration |
no | Media duration |
mediaplayer.source is an open enum: its value is free text rather than a closed list. Its allowed-value list
grows as new application names appear, and the descriptor is re-declared in full each time the set grows. A name or
application id the device has not reported fails the command, as does play, pause, stop, next, previous or seek while
the device has no active media session.
Sound mode is not declared, because CASTV2 has no such concept.
The application identifier, transport id, session id, media session id, idle reason, content id, content type and stream type are surfaced as structured unmapped properties — usable from workflows, not rendered as controls. Null values are omitted rather than carried as empty entries.
Position is a snapshot, not a running counter. It is whatever the last status push reported and does not advance between pushes.
Permissions and replicas
The Cast plugin declares no permissions. Reporting and controlling its own devices and taking the
connection-ownership lease need none. The egress address rule applies to the host-provided HTTP client and to
mqtt.outbound, not to raw sockets, so the plugin's raw TLS socket to the receiver is not gated by any manifest
declaration.
Every replica loads the plugin, so before opening a socket it takes a connection-ownership lease per device. A replica that fails to acquire it does not connect, and commands routed to a non-owning replica fail rather than silently no-op. The owner polls its lease and disposes the connection when it is lost, so a peer reclaims within one poll interval; stopping releases every lease immediately.