Template question - Aqara Roller Shade Driver - Slider via Restful commands

I’m trying to control my blinds using a slider that gives a Restful command to deCONZ API.
For this I’ve configured an input number entity as slider and an automation to trigger on state change.

In the restful command payload in configuration.yaml I’m trying to add in a template that gets the state of the input_number.

With the help of some very smart people in discord and looking at this topic: Topic, we came up with the following template:

 payload: "{{ {'lift': states('input_number.percentage_side_blinds') | int(0)} }}"

However, this results in a correct template that’s been accepted by the config BUT this template results in "{ 'lift' : <slider_value> }" and for the payload to be correct I need it to be '{ "lift" : <slider_value> }'

The following template results in the correct message '{ "lift" : <value> }' for the payload but this is not accepted in configuration.yaml.

'{"lift":{{ states('input_number.percentage_side_blinds')|int(0)}}}'

So, still looking for a template that will give me the correct result for the payload and is accepted in configuration.yaml.
Any help is greatly appreciated.

configuration.yaml:

input_number:
  percentage_side_blinds:
    min: 0
    max: 100
    step: 1
rest_command:
  side_blinds_slider:
    url: "http://192.168.x.x:40850/api/56474758EA/lights/26/state"
    method: put
    content_type: "application/x-www-form-urlencoded"
    payload: ?

automations.yaml:

alias: Blinds open percentage
description: ''
trigger:
  - platform: state
    entity_id: input_number.percentage_side_blinds
condition: []
action:
  - service: rest_command.side_blinds_slider
    data: {}
mode: single

Replace

'{"lift":{{ states('input_number.percentage_side_blinds')|int(0)}}}'

by this (it should be accepted)

'{"lift":{{ states("input_number.percentage_side_blinds")|int(0)}}}'
2 Likes

Amazing, thanks alot, worked flawlessly!