Thank you! That fixed it, I guess when I used the HACS auto install option it added the “…bundle.js” but left the old method in there as well.
As there was frequently the question how to change the icon color similar to the removed icon_state attribute, I’ll post here my solution based on card-mod:
style: |
ha-icon {
color:
{% if states(config.entity) == 'playing' %}
var(--accent-color)
{% else %}
var(--iron-icon-fill-color)
{% endif %}
;
}
I am still getting the error:
Cannot read property 'setConfig' of undefined
I have it installed via HACS, and I even completely uninstalled and reinstalled HACS from my Hassio instance.
This is my card configuration:
- artwork: cover
entity: media_player.living_room_tv
hide:
power_state: true
source: true
volume: false
icon: 'mdi:spotify'
type: 'custom:mini-media-player'
and this is my lovelace file module:
- type: module
url: /community_plugin/mini-media-player/mini-media-player-bundle.js
Anyone have any ideas???
EDIT: Taking everything back two spaces and getting rid of the dash at the beginning fixed it!
Hi @kalkih, do you think is it somehow easily possible to use as an option for a background image (entity-picture
) static image hosted localy or url?
It is useful e.g. when using shortcuts buttons for streaming which is not delivering that attribute. It could be e.g. one of shortcut item objects. When streaming radio you can have it logo picture in background.
Should be quite easy with card-mod, I believe it has support for conditional statements as well, so you should be able to display different backgrounds conditionally.
- type: custom:mini-media-player
entity: media_player.example
style: |
.mmp__bg {
opacity: 1 !important;
background: url("/local/img/bg.jpg") center center / cover !important;
}
Double check the spelling of platform here
@Syrius Thanks a lot for pointing that out - what a dumb errors. I updated the original post to reflect the change. Now I don’t have error message reported. But I can’t find the media_player.sonos_one in the entities (under Developer Tools tab). Anyone can share how you integrate and set up the Sonos?
Thanks a lot,
I use sonos also however I use auto discovery to populate my sonos devices into HA via the GUI integrations page rather than in configuration.yml
Are you seeing any of the three listed Sonos devices appearing? Check the logs and see if it’s attempting to connect to them.
Also might be an idea to start a different thread, just to keep this one on topic
Hi, I recently upgraded and moved over to HACS, but the group:true
option is no longer working for me. Has something changed in the syntax expectations or is this a bug?
Here’s how it used to look:
Here’s how it looks now:
The spacing is much bigger than my normal entities, whereas it used to be the same:
vs
here’s my config:
- type: entities
title: First Floor
show_header_toggle: false
entities:
- entity: media_player.living_room_airtunes_speaker
type: custom:mini-media-player
name: Living Rm
hide:
controls: true
mute: true
group: true
- entity: media_player.kitchen_airtunes_speaker
type: custom:mini-media-player
name: Kitchen Speakers
hide:
controls: true
mute: true
group: true
- entity: media_player.bathroom_1st_floor_airtunes_speaker
type: custom:mini-media-player
name: Bathroom Speakers
hide:
controls: true
mute: true
group: true
- entity: media_player.apple_tv_airtunes_speaker
type: custom:mini-media-player
name: Apple TV
hide:
controls: true
mute: true
group: true
- entity: media_player.chromecast
type: custom:mini-media-player
name: Chromecast
hide:
controls: true
mute: true
group: true
- climate.entrance
- climate.living_room
- climate.dining_room
Any idea why this is happening?
The top and bottom card paddings when used with the group options were changed a few months back in v1.4.0
Increased top/bottom card padding with group option to
10px
Was 2px
before, changed because the progress bar will otherwise overlap potential artwork & media information.
I guess the extra padding isn’t really needed when/if progress isn’t supported or visible, I’ll change this because it looks…bad
Great, thanks for an awesome card, with 12 zones of AirPlay, I couldn’t live without it!
Is it possible to hide a card on lovelace if it’s already included in a group? I would like to show the card if it’s ungrouped, and hide it if it’s grouped. At the moment I have 4 devices, which all have a card on my frontend. If I group them all, I still see 4 cards with all of them playing the same thing. I would like to only view 1 card if all are grouped. If none are grouped, I want to see 4 cards again…
Is that possible in a way?
Thanks
I’m absolutely digging this media player! Right now i’m playing with the style of the card. And alltho i’m pretty happy with it, i hope someone is able to tell me how i can style the grey buttons as you can see in the screenshot below. I’d like to give them the same opacity as the rest of the card. I think i only need to know which variables these are. Thanks!
Interesting idea, would be practical.
The conditional card does only support conditions based on states unfortunately.
I don’t own any Sonos myself so I’ve not been able test if the code below actually works but I think it should. In the example we got two sonos speakers with entity ids media_player.sonos_1
& media_player.sonos_2
.
First we need to set up a binary sensor for each sonos speaker which we’ll later use in our conditional cards. The binary sensor should flip to on
if our condition is fulfilled, the condition being:
- The entity isn’t the master speaker (the master is the first entry in the
sonos_group
attribute)
and
- The entity is in a group (
sonos_group
includes more than 1 entity)
binary_sensor:
- platform: template
sensors:
sonos_1_grouped_not_master:
value_template: >
{{ state_attr('media_player.sonos_1', 'sonos_group')[0] | string != 'media_player.sonos_1'
and state_attr('media_player.sonos_1', 'sonos_group') | length > 1 }}
sonos_2_grouped_not_master:
value_template: >
{{ state_attr('media_player.sonos_2', 'sonos_group')[0] | string != 'media_player.sonos_2'
and state_attr('media_player.sonos_2', 'sonos_group') | length > 1 }}
Then we have the actual lovelace setup, one conditional card for each Sonos, here we use the binary sensors we created earlier.
- type: conditional
conditions:
- entity: binary_sensor.sonos_1_grouped_not_master
state_not: 'on'
card:
- type: custom:mini-media-player
entity: media_player.sonos_1
- type: conditional
conditions:
- entity: binary_sensor.sonos_2_grouped_not_master
state_not: 'on'
card:
- type: custom:mini-media-player
entity: media_player.sonos_2
Change the entity names and repeat for each Sonos speaker you got.
I don’t remember the variables used but I’ll look into it when I get home and get back to you.
hey @kalkih, thanks a lot for your help! It works great, except that there seems to be something wrong with the template of the binary sensors:
binary_sensor:
- platform: template
sensors:
sonos_1_grouped_not_master:
value_template: >
{{ state_attr('media_player.sonos_1', 'sonos_group')[0] | string != 'media_player.sonos_1'
and state_attr('media_player.sonos_1', 'sonos_group') | length > 1 }}
sonos_2_grouped_not_master:
value_template: >
{{ state_attr('media_player.sonos_2', 'sonos_group')[0] | string != 'media_player.sonos_2'
and state_attr('media_player.sonos_2', 'sonos_group') | length > 1 }}
It changes to ‘on’ when I group them, but doesn’t switch back to ‘off’ when I ungroup them… Any idea on how to solve this?
Thanks a lot for your help! Really appreciate it!
Cadish
Hmm…okay.
I see there’s an option where you can specify entity id´s which the sensor should react to, if automatic updates doesn’t work.
See entity_id, but I’m not sure if it reacts to attribute changes, but might be worth a try!
So the config would be something like this.
binary_sensor:
- platform: template
sensors:
sonos_1_grouped_not_master:
entity_id:
- media_player.sonos_1
value_template: >
{{ state_attr('media_player.sonos_1', 'sonos_group')[0] | string != 'media_player.sonos_1'
and state_attr('media_player.sonos_1', 'sonos_group') | length > 1 }}
sonos_2_grouped_not_master:
entity_id:
- media_player.sonos_2
value_template: >
{{ state_attr('media_player.sonos_2', 'sonos_group')[0] | string != 'media_player.sonos_2'
and state_attr('media_player.sonos_2', 'sonos_group') | length > 1 }}
Edit: after reading this I’m pretty sure adding the above should solve it!
No, didn’t work either.
However, I’ve found that this works for me:
entity_id:
- media_player.living_room
value_template: >
{{ state_attr('media_player.living_room', 'groupName') | length > 1 }}
Really don’t know why your code is not working… (maybe because I don’t have Sonos, but Heos?)
Regards,
Cadish
Oh sorry, yes that’s probably it then haha, I took for granted you were using Sonos so the attributes and the way they function are probably different for you with HEOS.
Glad you got it working!
So HEOS exposes an attribute called groupName
? Is that the only group rrelated attribute exposed?
I guess @Cadish is still running the custom_component for HEOS with grouping, am I right? That may be why something is different?? To my knowledge there is no official support for grouping in the HEOS integration, but it seems to be working quite well with the custom integration here
I’m going to try the same as Cadish did for hiding grouped ones, think it sounds like a nice idea!