Motion sensor rules

Just migrating from Home Assistant. I have motion sensors that turn lights on when triggered via a rule, but I also have a separate rule that turns them off when no motion detected. Is there any way to streamline this into one rule? i.e:

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Pantrymotionsensor_MotionAlarm
      state: ON
    type: core.ItemStateUpdateTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      command: ON
      itemName: KitchenPantry_SwitchState
    type: core.ItemCommandAction

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Pantrymotionsensor_MotionAlarm
      state: OFF
      previousState: ON
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      command: OFF
      itemName: KitchenPantry_SwitchState
    type: core.ItemCommandAction

This is how I do my motion sensors:

I moved this to a more appropriate category. The Marketplace is exclusively for the publication of complete rule templates, not a place to ask for help.

1 Like