have been using these rest_commands for a long time, and now notice they have stopped being effective, please help me out.
setting the sensitivity on a Hue motion sensor which has url:
url_set_hue_command: http://192.168.1.212/api/dredactedq/{{ type }}/{{ id }}/{{ command }}
the endpoint should be
http://192.168.1.212/api/dredactedq/sensors/22/config {{sensitivity:2}}
I use a rest_command:
rest_command:
set_hue_command: #not named sensitivy because the command can be used to set other entities/attributes also
url: !secret url_set_hue_command
method: put
payload: '{{data}}'
and script:
script:
set_hue_sensitivity:
alias: Set Hue sensitivity
mode: restart
icon: mdi:cog
sequence:
service: rest_command.set_hue_command
data:
command: config
type: sensors
data: >
{% set mapper =
{'Low':'0',
'Medium':'1',
'High':'2'} %}
{% set state = states('input_select.select_hue_sensitivity') %}
{% set sensitivity = mapper[state] if state in mapper %}
{"sensitivity": {{sensitivity}} }
id: >
{% set mapper =
{'Laundry':'22',
'Dining table':'52',
'Auditorium':'44',
'Attic':'12'} %}
{% set state = states('input_select.select_hue_motion_sensor') %}
{% set id = mapper[state] if state in mapper %}
{{id}}
and
set_hue_threshold:
alias: Set Hue threshold
mode: restart
icon: mdi:cog
sequence:
service: rest_command.set_hue_command
data:
command: config
type: sensors
data: >
{"tholddark": {{states('input_number.slide_hue_threshold')|int}} }
id: >
{% set mapper =
{'Laundry':'25',
'Dining table':'53',
'Auditorium':'45',
'Attic':'13'} %}
{% set state = states('input_select.select_hue_motion_sensor') %}
{% set id = mapper[state] if state in mapper %}
{{id}}
the template in the script is 100% correct and renders an ‘id’ and ‘sensitivity’ /‘threshold’ which are passed to the script.
in the CLIP tool:
I have set script logging to debug, and see the scripts being executed, without changing the sensitivity at all. No errors.
I also have a direct script like:
set_hue_sensitivity_direct:
alias: Set Hue sensitivity direct
mode: restart
sequence:
service: rest_command.set_hue_command
data:
command: config
type: sensors
data: >
{"sensitivity": {{sensitivity}}}
id: >
{{id}}
which I can call in automations or scripts, and that too doesn’t work any longer.
strangely enough, I use a likewise script to change the rules (time settings) on a sensor
set_hue_rule:
url: !secret url_set_hue_rule
method: put
payload: '{{data}}'
and a rather complex set of scripts (we need to set 4 id’s) and that works just fine. So I know the address is correct. And the HUE Hub is working as it should too. As is shown in the clip tool too of course.
Has something changed lately in the rest_commands I need to adapt? I did check if the change from data_template:
to data:
causes the issue, but restoring data_template:
still doesnt work.
Please have a look. Thanks!