Use rest API to activate deactivate Hue sensor

I would like to the have switch to use the HUE API to activate/ deactivate my HUE sensor.

This is workinging outside Home assistant correctly

I added the below lines on my configuration.yaml

#Hue sensor action
switch hue:

The switch is there, off, if I activate is comeback off directly and doing nothing… any idea?

I actually use a command line switch for this for a very specific use case.

switch:
- platform: command_line
  switches:
    laundry_room_motion_sensor:
      command_on: curl -X PUT -d '{"on":true}' "http://10.0.1.40/api/API_KEY/sensors/55/config"
      command_off: curl -X PUT -d '{"on":false}' "http://10.0.1.40/api/API_KEY/sensors/55/config"
      command_state: curl "http://10.0.1.40/api/API_KEY/sensors/55/"
      value_template: "{{ value_json.config.on }}"
      friendly_name: Laundry room motion sensor status

Adapt to your info of course.

that make sense …
I saw it’s not working here … which log will you check to understand the issue?

The home assistant log at configuration > logs