Hi,
Just updated and for some reason my card no longer works. Has anything changed that might break this at all?
what ‘doesn’t work’?
When I click on any of the buttons, nothing turns on.
However if I turn things on manually, then I can adjust the volume using the card. (The Pioneer bit turns into a volume control)
That’s not part of this setup, is that a different lovelace card type?
It’s what I created last year and has been working great until now.
cards:
- cards:
- color: auto
color_type: card
entity: switch.chromecast
icon: ‘mdi:cast’
layout: name_state
name: Bottom Chromecast
state:
- color: red
value: ‘on’
styles:
card:
- height: 60px
icon:- height: 50px
- width: 50px
type: ‘custom:button-card’- entity: switch.xboxone
icon: ‘mdi:xbox’
layout: name_state
name: Xbox One
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: ‘custom:button-card’
type: horizontal-stack- cards:
- entity: switch.playstation_2
icon: ‘mdi:playstation’
layout: name_state
name: Playstation 3
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: ‘custom:button-card’- entity: switch.xbox360
icon: ‘mdi:xbox’
layout: name_state
name: Xbox 360
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: ‘custom:button-card’
type: horizontal-stack- cards:
- entity: media_player.pioneer
hide:
controls: true
power: true
source: true
type: ‘custom:mini-media-player’
volume_stateless: true
type: vertical-stack
title: Media
type: ‘custom:vertical-stack-in-card’
The solution in this guide doesn’t use custom cards, for a reason. It avoids them so that the thread is ‘timeless’ in regards to updates in lovelace.
You’re using alot of custom cards there, did you follow the breaking changes related to using resources in 107?
What happens if you CTRL+F5? I would expect this entire card to break (turn red) if your resources aren’t set up properly based on the new lovelace configurations.
I’ve refreshed and also restarted my HA quite a few times in the hope that may resolve it, but no joy.
The card stays the same, nothing breaks.
if the switches still work then it’s your lovelace configuration. Not sure what else to tell you. Your lovelace post is incorrectly formatted so I can’t look at the code.
Just rolled back to 0.104.3 and it seems to be working fine again.
Does this help with viewing the code any better?
cards:
- cards:
- color: auto
color_type: card
entity: switch.chromecast
icon: 'mdi:cast'
layout: name_state
name: Bottom Chromecast
state:
- color: red
value: 'on'
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: 'custom:button-card'
- entity: switch.xboxone
icon: 'mdi:xbox'
layout: name_state
name: Xbox One
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: 'custom:button-card'
type: horizontal-stack
- cards:
- entity: switch.playstation_2
icon: 'mdi:playstation'
layout: name_state
name: Playstation 3
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: 'custom:button-card'
- entity: switch.xbox360
icon: 'mdi:xbox'
layout: name_state
name: Xbox 360
styles:
card:
- height: 60px
icon:
- height: 50px
- width: 50px
type: 'custom:button-card'
type: horizontal-stack
- cards:
- entity: media_player.pioneer
hide:
controls: true
power: true
source: true
type: 'custom:mini-media-player'
volume_stateless: true
type: vertical-stack
title: Media
type: 'custom:vertical-stack-in-card'
Yes, major changes occured with lovelace between 106 and 107. I’m not sure how else I can spell this for you. I’ve mentioned lovelace changes 3 times now.
And if you came from 104, TONS of changes occurred to lovelace.
So, check for errors in your logs. Verify there are none related to the front end. When you update to 107, update all your custom cards as well. If it’s still not working, make sure you read all the changes that occurred in 105, 106, and 107 related to resources. In 105, the state of switches may not be passed visually to cards unless they are a light, im not 100% sure if switches fall in this catagory. In 106 they changed the backend, many custom cards require an update for these changes. And in 107 they enabled multiple dashboards for lovelace, changing where/how resources need to be implemented.
I’m fully aware that the upgrade broke it with the changes to lovelace. No need for initial bruntness.
However, thank you for the advice further down.
I’m sorry for being brunt, but you have to understand that this is a universal issue. The first thing you should do when you update is look over breaking changes. It’s fine if you don’t understand the ramifications of said breaking changes. That’s the perfect time to make a post. But I answered you 3 times, on the second answer you should have taken the due diligence and found out what changes occurred instead of me hand holding you by telling you each change that occurred. Hell there could have been other changes that I overlooked between those versions because I’m going off the top of my head. I won’t always be here, you’ll need to learn how to do this on your own.
Hello @petro thank you so much for posting this.
I’m TOTALLY new to HA, been using other HA - Vera/SmartThings for over 10 years. Still learning the ins and outs of HA.
I have the basic config working, i can switch on/off various entities, displaying the images as you’ve outlined.
I am having a heck of a time getting the volume working. For the life of me I can’t seem to figure it out.
I’m using Harmony Hub, Yamaha RX-A3050 (only using 1 zone). I set up everything as you displayed (modifying entity names where appropriate).
I’m running 0.107.7 in docker.
Here are my various file:
automation.yaml:
- alias: Zone 1 Volume (Media to Slider)
trigger:
- platform: state
entity_id: media_player.yamaha_receiver
condition:
- condition: template
value_template: >
# convert to decibel.
{% set converted = ( -1.0 + trigger.to_state.attributes.volume_level | float ) * 100.0 | round(0.0) %}
# Removes feedback loop
{{ converted != states('input_number.yamaha_receiver') | float }}
action:
service: input_number.set_value
data_template:
entity_id: input_number.yamaha_receiver
value: >
{{ ( ( -1.0 + trigger.to_state.attributes.volume_level | float ) * 100.0 ) | round(0.0) }}
- alias: Zone 1 Volume (Slider to Media)
trigger:
- platform: state
entity_id: input_number.yamaha_receiver
condition:
- condition: template
value_template: >
# convert from decibel.
{% set converted = (1.0 - trigger.to_state.state | float / 100.0) | round(2) %}
# Removes feedback loop
{{ converted != state_attr('media_player.yamaha_receiver','volume_level') | float }}
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.yamaha_receiver
volume_level: >
{{ (1.0 - trigger.to_state.state | float / 100.0) | round(2) }}
switch.yaml:
- platform: template
switches:
# ZONE 1 MEDIA SWITCH
zone_1:
value_template: "{{ is_state('media_player.yamaha_receiver', 'on') }}"
turn_on:
service: media_player.turn_on
entity_id: media_player.yamaha_receiver
turn_off:
service: media_player.turn_off
entity_id: media_player.yamaha_receiver
# Watch TV HARMONY Activity
watch_tv:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Watch TV') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Watch TV'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# PlayStation 4 HARMONY Activity
playstation_4:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'PlayStation 4') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PlayStation 4'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# Xbox One X HARMONY Activity
xbox_one_x:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Xbox One X') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Xbox One X'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# Nintendo Wii U HARMONY Activity
nintendo_wii_u:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Nintendo Wii U') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Nintendo Wii U'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# Nintendo Wii HARMONY Activity
nintendo_wii:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Nintendo Wii') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Nintendo Wii'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# Smart TV HARMONY Activity
smart_tv:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Smart TV') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Smart TV'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# Listen To Living Room Sonos HARMONY Activity
listen_to_living_room_sonos:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Listen to Living Room Sonos') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Listen to Living Room Sonos'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
# Emby HARMONY Activity
emby:
value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Watch Emby') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Watch Emby'
turn_off:
service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'PowerOff'
I have the sensor in configuration .yaml:
sensor:
- platform: template
sensors:
harmony_activity:
value_template: >
{% if is_state("remote.living_room", 'on') %}
{{ states.remote.living_room.attributes.current_activity }}
{% else %}
PowerOff
{% endif %}
input_number.yaml
yamaha_receiver:
name: Zone 1 Volume
icon: mdi:volume-high
initial: -40
min: -80
max: +16
step: 0.5
unit_of_measurement: dB
ui-lovelace.yaml:
- icon: mdi:television
title: Entertainment
id: entertainment
cards:
- type: vertical-stack
cards:
- type: picture-glance
title: Harmony
entities:
- switch.xbox_one_x
- switch.playstation_4
- switch.nintendo_wii_u
- switch.nintendo_wii
- switch.emby
- switch.smart_tv
- switch.watch_tv
state_image:
"PowerOff": /local/images/power_off.png
"Xbox One X": /local/images/xbox_one_logo.png
"PlayStation 4": /local/images/playstation_logo.png
"Ninetendo Wii U": /local/images/wiiu_logo.png
"Watch Emby": /local/images/emby.jpeg
"Nintendo Wii": /local/images/nintendo-wii.jpg
"Smart TV": /local/images/sony_logo.png
"Watch TV": /local/images/sony_logo.png
entity: sensor.harmony_activity
- type: vertical-stack
cards:
- type: picture-glance
title: Yamaha Receiver
entities:
- switch.zone_1
image: /local/images/yamaha3050.jpg
- type: conditional
conditions:
- entity: switch.zone_1
state: 'on'
card:
type: entities
entities:
- entity: input_number.yamaha_receiver
name: Zone 1 Volume
- type: vertical-stack
cards:
- type: media-control
title: Emby
entity: media_player.emby_shieldtv
Any assistance you can provide would be greatly appreciated.
Thank you again!
Akash
So the slider isn’t working? First, remove the comment lines in the conditions and try again.
Yes the slider is not working.
I removed the comments from the automation.yaml file:
- alias: Zone 1 Volume (Media to Slider)
trigger:
- platform: state
entity_id: media_player.yamaha_receiver
condition:
- condition: template
value_template: >-
{% set converted = ( -1.0 + trigger.to_state.attributes.volume_level | float ) * 100.0 | round(0.0) %}
{{ converted != states('input_number.yamaha_receiver') | float }}
action:
service: input_number.set_value
data_template:
entity_id: input_number.yamaha_receiver
value: >
{{ ( ( -1.0 + trigger.to_state.attributes.volume_level | float ) * 100.0 ) | round(0.0) }}
- alias: Zone 1 Volume (Slider to Media)
trigger:
- platform: state
entity_id: input_number.yamaha_receiver
condition:
- condition: template
value_template: >-
{% set converted = (1.0 - trigger.to_state.state | float / 100.0) | round(2) %}
{{ converted != state_attr('media_player.yamaha_receiver','volume_level') | float }}
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.yamaha_receiver
volume_level: >
{{ (1.0 - trigger.to_state.state | float / 100.0) | round(2) }}
Hmm…still not working, looking at other people’s configs, I see that there are three key pieces that they used: automation.yaml, input_number.yaml, and sensor.yaml.
I see all three, however in sensor.yaml I see no reference to the automation or the input_number entity. Still trying to figure all this out…I broke out the sensor from my configuration.yaml to a senors.yaml file:
- platform: template
sensors:
harmony_activity:
value_template: >-
{% if is_state("remote.living_room", 'on') %}
{{ states.remote.living_room.attributes.current_activity }}
{% else %}
PowerOff
{% endif %}
- platform: template
sensors:
yamaha_receiver:
value_template: >
{% if is_state('media_player.yamana_receiver', 'on') %}
{{ states.media_player.yamaha_receiver.attributes.volume_level }}
{% else %}
0
{% endif %}
I attempted to add a sensor for the input_number.yamaha_receiver, but that is not working either. I’m totally stumped now! DOH!
Akash
Wow I can’t believe how dumb I am! I forgot to include automation.yaml in configuration.yaml!
It’s sort of working now. I’m able to move the slider and volume changes sometimes, but not others…I’ll keep playing around. Thanks again @petro!
When I move the slider to MAX volume, the receiver complies and turns the volume to MAX (for me its 0.0).
When I move the slider down, the volume is unchanged, in fact, I cant set it to anything other than MAX. I can’t turn it down or set to Min (-80).
Strange.
Thank a lot for sharing this perfect configuration, but I still have an issue to turn off the activity I have no problem to switch between activities but unable to turn one off. Here is my switch config in case someone can be so kind to help me
listen_to_music:
value_template: >
{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Listen to Music') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.harmony_hub
activity: 'Listen to Music'
turn_off:
service: remote.turn_on
data:
entity_id: remote.harmony_hub
activity: 'PowerOff'
What does your /config/harmony_*.conf
file list as the power off activity?
-1 but you can use the word “PowerOff”
"Activities": {
"-1": "PowerOff",
"24089909": "PS4",
"24103421": "Xbox One",
"26592473": "Switch",
"30947237": "TV",
"41729161": "Roku"
},
Yes, but I thought it might be worth checking as a reason why @benn’s config wasn’t working. I couldn’t see anything else wrong with it…