Need some help with hue sensor automation

I recently managed to add my hue motion sensor in HA and they give me info when a room is visited or not by showing detected/clear so I decided to make an automation to turn on my sonoff switches on/off problem is that they dont do that , I have to add that in hue app I didnt put my sensors to any roo so they are in but not given to any room just showing there is motion please any help will be appreciated

- id: '1577381657451'
  alias: Project "Kinisis"
  description: ''
  trigger:
  - entity_id: binary_sensor.bathroom_motion
    from: clear
    platform: state
    to: detected
  condition: []
  action:
  - data: {}
    entity_id: switch.sonoff_1000485ee8_2
    service: switch.turn_on

Try this


      entity_id: binary_sensor.bathroom_motion
      from: 'off'
      platform: state
      to: 'on'
 

Oh thank you that did worked