i want to play music in morning or let say 7 pm in evening with volume set to 25%
for this i would like to get some volume slider working so that it can be set as initial 25% volume.
dear, thanks for guiding i am testing it
Dear, one more thing what about slider
if i want volume slider to work with my megabox and onkyorec,
i tried every thing but didnot get succeded.
can you please help me thanks in adv.
I would also like to get updated my slider in HA when i increase or decrease it using remote.
I’m leaving for the weekend so i wont be able to help until monday. In that time, please post your yaml with the correct formatting. If you don’t do that, I won’t be able to help.
Dear Petro,
I also go this way
i changed every entity id as per your post #6
i get error
I have this settings for all my media devices megabox & Samsung TV
i am getting this error
Invalid value: -100.0 (range 0.0 - 100.0)
- alias: Set Zone 1 Slider
trigger:
- platform: state
entity_id: media_player.onkyorec
condition:
- condition: template
value_template: >
{% if is_state('media_player.onkyorec','off') %}
true
{% else %}
{% if is_state_attr('media_player.onkyorec', 'volume_level', states('input_number.onkyorec') | int / 100) %}
false
{% else %}
true
{% endif %}
{% endif %}
action:
- service: input_number.set_value
entity_id: input_number.onkyorec
data_template:
value: >
{% if trigger.to_state.state == 'on' %}
{% set n = trigger.to_state.attributes.volume_level | float %}
{{ (n - 1.0)*100.0 | int }}
{% else %}
-80
{% endif %}
- alias: Set Zone 1 Volume
trigger:
- platform: state
entity_id: input_number.onkyorec
condition:
- condition: template
value_template: >
{% if is_state('media_player.onkyorec', 'on') %}
{% if not is_state_attr('media_player.onkyorec', 'volume_level', states('input_number.onkyorec') | int / 100) %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %}
action:
- service: media_player.volume_set
entity_id: media_player.onkyorec
data_template:
volume_level: >
{% set n = states('input_number.onkyorec') | float %}
{{ n / 100 + 1 }}
- alias: Set Zone 2 Slider
trigger:
- platform: state
entity_id: media_player.onkyorec_zone_2
condition:
- condition: template
value_template: >
{% if is_state('media_player.onkyorec_zone_2','off') %}
true
{% else %}
{% if is_state_attr('media_player.onkyorec_zone_2', 'volume_level', states('input_number.onkyorec_zone_2') | int / 100) %}
false
{% else %}
true
{% endif %}
{% endif %}
action:
- service: input_number.set_value
entity_id: input_number.onkyorec_zone_2
data_template:
value: >
{% if trigger.to_state.state == 'on' %}
{% set n = trigger.to_state.attributes.volume_level | float %}
{{ (n - 1.0)*100.0 | int }}
{% else %}
-80
{% endif %}
- alias: Set Zone 2 Volume
trigger:
- platform: state
entity_id: input_number.onkyorec_zone_2
condition:
- condition: template
value_template: >
{% if is_state('media_player.onkyorec_zone_2', 'on') %}
{% if not is_state_attr('media_player.onkyorec_zone_2', 'volume_level', states('input_number.onkyorec_zone_2') | int / 100) %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %}
action:
- service: media_player.volume_set
entity_id: media_player.onkyorec_zone_2
data_template:
volume_level: >
{% set n = states('input_number.onkyorec_zone_2') | float %}
{{ (n / 100.0) + 1.0 }}
Invalid service data for media_player.volume_set: value must be at most 1 for dictionary value @ data[‘volume_level’]. Got 35
Invalid service data for media_player.volume_set: value must be at most 1 for dictionary value @ data[‘volume_level’]. Got 5
value got 5 and 35 are my default value in automation which start my media players in morning
With this or with any of above,
I tried my, volume doesn’t sets,
Now leaving any hope of getting it work.
So thank you for your example
thanks for your support
I already tried it by changing to .05 and .35 with input_number as min 0 max 77 and 100 with intial .35 and .05.
But it didn’t work,
I think,
I am not getting biome slider working with my settings ( I can’t change volume with above settings).
So I have to work for input numbers to work for me
a input_number has any range that you set. You need to link the 2 together if you want to use the input slider. When setting the volume_level, you need to use between 0 and 1. That’s it. Change those in your yaml and that automation will work and those errors will be removed.
The
error is because you are using my configuration which is in decibels. For some reason, my receiver’s volume goes from -100 db to 0.
You need to come up with the conversion for YOUR receiver. You can’t just use mine and think it will work.
These are the sections that needs to change.
It’s most likely going to be {{ n / 100 }} for the first and {{ n * 100 | int }} and 0 for the second.
Dear,
Thank for your guidance,
Now all errors are gone
but still i cant make my onkyo rec / megabox 's volume as stated on automated startup.
and i cant make volume change with my slider, (may be because i am using broadlink rm mini3 to control all my media devices)
can you please suggest what should i do to control volume with slider or how to use commands volume + and volume -
Please can you guide me with slider?
thanks in adv
Hello @petro , i am trying the same thing as savage87 but i don’t get how it works in order to modify the automation. I have the script for volume UP and DOWN and is working but cannot make the trigger work. i have created the template that Petro suggested but i think i am missing something
@savage87 did this whole autmatization work only with the help suggested by Petro or did you also add the sensor settings ? Can you post the whole code ?
Yes @petro , i have set it. The media player name is: media_player.tv
trigger:
entity_id: media_player.tv
platform: state
condition:
condition: template
value_template: >
{% set from = trigger.from_state.attributes.volume_level | float%}
{% set to = trigger.to_state.attributes.volume_level | float %}
{{ to > from}}
action:
service: script.radio540
But is not triggering the script when i move up the volume from the remote