Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nohum/chromecast-mqtt-connector
Make your Chromecast devices discoverable and controllable via MQTT.
https://github.com/nohum/chromecast-mqtt-connector
cast chromecast chromecast-device internet-of-things mqtt mqtt-service python python3
Last synced: 3 months ago
JSON representation
Make your Chromecast devices discoverable and controllable via MQTT.
- Host: GitHub
- URL: https://github.com/nohum/chromecast-mqtt-connector
- Owner: nohum
- License: mpl-2.0
- Created: 2016-11-05T22:12:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-15T10:15:47.000Z (8 months ago)
- Last Synced: 2024-03-15T11:35:19.366Z (8 months ago)
- Topics: cast, chromecast, chromecast-device, internet-of-things, mqtt, mqtt-service, python, python3
- Language: Python
- Homepage:
- Size: 69.3 KB
- Stars: 46
- Watchers: 10
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chromecast MQTT connector
Provides status information and control capabilities of your Chromecast devices via MQTT.
## Installation requirements
* Python 3.7+
* pychromecast
* paho-mqttYou can install the requirements in their correct versions using `pip3 install -r requirements.txt`.
## Discovery and control
Using MQTT you can find the following topics. `friendly_name` is the name used to connect
to each Chromecast.```
# - read only
chromecast/friendly_name/friendly_name
chromecast/friendly_name/model_name
chromecast/friendly_name/address
chromecast/friendly_name/connection_status
chromecast/friendly_name/cast_type
chromecast/friendly_name/current_app
chromecast/friendly_name/player_duration
chromecast/friendly_name/player_position
chromecast/friendly_name/player_state
chromecast/friendly_name/volume_level
chromecast/friendly_name/volume_muted
chromecast/friendly_name/media/title
chromecast/friendly_name/media/album_name
chromecast/friendly_name/media/artist
chromecast/friendly_name/media/album_artist
chromecast/friendly_name/media/track
chromecast/friendly_name/media/images
chromecast/friendly_name/media/content_type
chromecast/friendly_name/media/content_url# - writable
chromecast/friendly_name/command/volume_level
chromecast/friendly_name/command/volume_muted
chromecast/friendly_name/command/player_position
chromecast/friendly_name/command/player_state
```Control the player by publishing values to the four topics above.
Change volume using values from `0` to `100`:
* Absolute: publish e.g. `55` to `chromecast/friendly_name/command/volume_level`
* Relative: publish e.g. `+5` or `-5` to `chromecast/friendly_name/command/volume_level`Change mute state: publish `0` or `1` to `chromecast/friendly_name/command/volume_muted`.
Play something: Publish a URL to `player_state` (just as string, not as json array, e.g.
`http://your.stream.url.here`), the application then tries to guess the required MIME type.Or you can publish a json array with two elements (content url and content type) to
`chromecast/friendly_name/command/player_state`, e.g. `["http://your.stream.url.here", "audio/mpeg"]`.Or you can publish a json object with any of the following properties, e.g.
`{"url": "http://http://your.stream.url.here", "content_type": "audio/mpeg", "enqueue": false}`.Known properties from pychromecast BaseMediaPlayer.play_media() function:
```
"url": "http://http://your.stream.url.here"
"content_type": "audio/mpeg"
"title": null
"thumb": null
"current_time": null
"autoplay": true
"stream_type": "BUFFERED"
"metadata": null
"subtitles": null
"subtitles_lang": "en-US"
"subtitles_mime": "text/vtt"
"subtitle_id": 1
"enqueue": false
```For other player controls, simply publish e.g. `RESUME`, `PAUSE`, `STOP`, `SKIP`, `REWIND`,
`PREV` or `NEXT` to `chromecast/friendly_name/command/player_state`. Attention: This is case-sensitive!