Help with an input_slider

Hello all,

I am trying to use an input_slider value to play a ringtone on my Xiamoi gateway. This works:

- service: xiaomi.play_ringtone       
  data:  
    gw_mac: 34ce008d5720      
    ringtone_vol: 6
    ringtone_id: 10038

But, this does not:

- service: xiaomi.play_ringtone       
  data:  
    gw_mac: 34ce008d5720      
    ringtone_vol: 6
    ringtone_id: '{{ states.input_slider.xiaomi_ringtone.state | int }}'

I get the following error in the log:

2017-08-16 12:38:58 ERROR (Thread-12) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py", line 1030, in execute_service
    service_handler.func(service_call)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/xiaomi.py", line 99, in play_ringtone_service
    ring_id = int(ring_id)
ValueError: invalid literal for int() with base 10: '{{ states.input_slider.xiaomi_ringtone.state }}'

This is how my slider is defined:

xiaomi_ringtone:
  name: Xiaomi ringtone
  initial: 10038
  min: 10000
  max: 10075
  step: 1

and here is what it looks like from within Home Assistant:

Any ideas on what I am doing wrong?

Thank you for any help you can provide!

Tom

data_template: maybe?

1 Like