Im trying to create an automation which increases the volume of my Chromecast Group when rotating to the right and decreases the volume when rotating to the left. Somehow this is not working for me:
- alias: Xiaomi Cube - Volume Rotate
trigger:
platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d000101bded
action_type: rotate
action:
- service: media_player.volume_set
data_template:
entity_id: media_player.home_group
volume_level: >
{%if trigger.event.data.action_value | float > 0 %}
{{ states.media_player.home_group.attributes.volume_level | float + 0.1 }}
{% else %}
{{ states.media_player.home_group.attributes.volume_level | float - 0.1 }}
{% endif %}
Error:
2017-11-06 20:37:46 ERROR (MainThread) [homeassistant.core] Invalid service data for media_player.volume_set: expected float for dictionary value @ data['volume_level']. Got "'0.29999997317790983'"
2017-11-06 20:37:47 ERROR (MainThread) [homeassistant.core] Invalid service data for media_player.volume_set: expected float for dictionary value @ data['volume_level']. Got "'0.29999997317790983'"
Can anyone help me out, It is expecting a float and for as far as I can see it’s getting one right?
UPDATE: Removing the quotes did the trick . I also removed them in the code above so that code is working.