Skip to content

Commit

Permalink
Merge pull request #37 from bushvin/feature/compat
Browse files Browse the repository at this point in the history
Feature/compat
  • Loading branch information
bushvin authored Oct 31, 2023
2 parents 1b04e03 + 036adac commit 58d54df
Show file tree
Hide file tree
Showing 6 changed files with 1,079 additions and 655 deletions.
44 changes: 29 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# Home Assitant integrations

Additional integrations for [Home Assistant](https://www.home-assistant.io/)

![badge_mastodon]

## Mopidy

![badge_version] ![badge_issues]

This is a platform integration for [Mopidy Music Servers](https://mopidy.com/)

### Installation

Please look at the [Mopidy installation & configuration instructions](https://docs.mopidy.com/en/latest/installation/) to set up a Mopidy Server.

#### HACS

1. Install [HACS](https://hacs.xyz)
1. Go to any of the sections (integrations, frontend, automation).
1. Click on the 3 dots in the top right corner.
Expand All @@ -19,14 +27,18 @@ Please look at the [Mopidy installation & configuration instructions](https://do
1. Restart HA

#### Manual

1. Clone this repository
2. Copy `custom_components/mopidy` to your Home Assistant insance on `<config dir>/custom_components/`

### Setup

#### zeroconf

Your Mopidy Servers can be detected and addedi to Home Assitant through zeroconf.

#### GUI

1. Go to the *Integrations* page and click **+ ADD INTEGRATION**
1. Select *Mopidy* in the list of integrations
1. Fill out the requested information. Make sure to enter your correct FQDN or IP address. Using `localhost`, `127.0.0.1`, `::1` or any other loopback address will disable Mopidy-Local artwork.
Expand All @@ -35,6 +47,7 @@ Your Mopidy Servers can be detected and addedi to Home Assitant through zeroconf
Repeat the above steps to add more Mopidy Server instances.

#### Manual Configuration

1. add a media player to your home assistant configuration (`<config dir>/configuration.yaml`):

```yaml
Expand All @@ -56,14 +69,19 @@ media_player:
```
### Services
#### Service media\_player.play\_media
The `media_content_id` needs to be formatted according to the Mopidy URI scheme. These can be easily found using the *Developer tools*.

When using the `play_media` service, the Mopidy Media Player platform will attempt to discover your URL when not properly formatted.
Currently supported for:

- Youtube


#### Service mopidy.restore

Restore a previously taken snapshot of one or more Mopidy Servers

The playing queue is snapshotted
Expand All @@ -73,6 +91,7 @@ The playing queue is snapshotted
|`entity_id`|no|String or list of `entity_id`s that should have their snapshot restored.|

#### Service mopidy.search

Search media based on keywords and add them to the queue. This service does not replace the queue, nor does it start playing the queue. This can be achieved through the use of [media\_player.clear\_playlist](https://www.home-assistant.io/integrations/media_player/) and [media\_player.media\_play](https://www.home-assistant.io/integrations/media_player/)

**Note:** One of the keyword fields **must** be used: `keyword`, `keyword_album`, `keyword_artist`, `keyword_genre` or `keyword_track_name`
Expand All @@ -89,6 +108,7 @@ Search media based on keywords and add them to the queue. This service does not
|`source`|yes|String. URI sources to search. `local`, `spotify` and `tunein` are the only supported options. Make sure to have these extensions enabled on your Mopidy Server! Separate multiple sources with a comma (,).|local,spotify|

#### Service mopidy.snapshot

Take a snapshot of what is currently playing on one or more Mopidy Servers. This service, and the following one, are useful if you want to play a doorbell or notification sound and resume playback afterwards.

**Warning:** *This service is controlled by the platform, this is not a built-in function of Mopidy Server! Restarting Home Assistant will cause the snapshot to be lost.*
Expand All @@ -99,23 +119,17 @@ Take a snapshot of what is currently playing on one or more Mopidy Servers. This


### Notes

Due to the nature of the way Mopidy provides thumbnails of the media,
proxying them through Home Assistant is very resource intensive,
proxying them through Home Assistant is very resource intensive,
causing delays. Therefore, I have decided to not proxy the art when
using the Media Library for the time being.

### Tests
Mopidy v3.2.0

Backends:
- mopidy-beets v4.0.1
- mopidy-dleyna 2.0.1
- mopidy-internetarchive v3.0.0
- mopidy-local v3.2.1
- mopidy-podcast v3.0.0
- mopidy-somafm v2.0.2
- mopidy-soundcloud v3.0.1
- mopidy-spotify v4.1.1
- mopidy-tunein v1.1.0
- mopidy-YouTube v3.2
# Testers

- [Jan Gutowski](https://github.com/Switch123456789)


[badge_version]: https://img.shields.io/github/v/tag/bushvin/hass-integrations?label=Version&style=flat-square&color=2577a1
[badge_issues]: https://img.shields.io/github/issues/bushvin/hass-integrations?style=flat-square
[badge_mastodon]: https://img.shields.io/mastodon/follow/1084764?domain=https%3A%2F%2Fmastodon.social&logo=mastodon&logoColor=white&style=flat-square&label=%40bushvin%40mastodon.social
2 changes: 1 addition & 1 deletion custom_components/mopidy/const.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Constants for the Mopidy integration."""

DOMAIN = "mopidy"
ICON = "mdi:music-note"
ICON = "mdi:speaker-wireless"
DEFAULT_NAME = "Mopidy"
DEFAULT_PORT = 6680
SERVICE_SET_CONSUME_MODE = "set_consume_mode"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mopidy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"requirements": [
"mopidyapi>=1.0.0"
],
"version": "1.5.1",
"version": "2.0.0",
"zeroconf": [
{
"type": "_mopidy-http._tcp.local."
Expand Down
Loading

0 comments on commit 58d54df

Please sign in to comment.