Trouble getting lights to turn on when door unlocked

So I finally got my Schlage deadbolt to work thanks to some folks here, and now I’m trying to set it up to turn on the lights when the bolt unlocks. I have a rule that initiates to turn on the lights. But I can’t figure out how to “lock” it in with the deadbolt action. I’ve tried several different callouts from the lock, including:

triggers:
  - id: "2"
    configuration:
      itemName: SchlageTouchpadDeadbolt_DoorLock
      state: OFF
      previousState: ON
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      considerConditions: false
      ruleUIDs:
        - 1a3d25cc65
    type: core.RunRuleAction
triggers:
  - id: "2"
    configuration:
      state: OFF
      itemName: SchlageTouchpadDeadbolt_DoorLock
    type: core.ItemStateUpdateTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      considerConditions: false
      ruleUIDs:
        - 1a3d25cc65
    type: core.RunRuleAction
triggers:
  - id: "2"
    configuration:
      command: OFF
      itemName: SchlageTouchpadDeadbolt_DoorLock
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      considerConditions: false
      ruleUIDs:
        - 1a3d25cc65
    type: core.RunRuleAction

None seem to work. It does work if I manually initiate the command within OpenHab, just not when using the deadbolt or the lock keypad. Any thoughts on how to initiate this?

The rule I’m asking to run after the unlock is:

triggers: []
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      itemName: DiningRoomDimmerSwitch_Dimmer
      command: "100"
    type: core.ItemCommandAction
  - inputs: {}
    id: "2"
    configuration:
      itemName: FoyerLight_Switch
      command: ON
    type: core.ItemCommandAction
  - inputs: {}
    id: "3"
    configuration:
      itemName: KitchenCabinetsDimmerSwitch_Dimmer
      command: "100"
    type: core.ItemCommandAction
  - inputs: {}
    id: "4"
    configuration:
      itemName: KitchenDimmerSwitch_Dimmer
      command: "100"
    type: core.ItemCommandAction
  - inputs: {}
    id: "5"
    configuration:
      command: "100"
      itemName: LivingRoomDimmerSwitch_Dimmer
    type: core.ItemCommandAction

Verify the ID of the rule you want to run is the same as the one selected.

In the future, change the UID to something meaningful. It greatly helps understand what’s going on and interpreting the logs.

Add script action to the rules that are triggered by the door. Using Blockly to add a logging statement so you can see if the rule it running at all or if it’s failing to trigger.

Alternatively open the developer sidebar and watch the event stream for events showing your rule is triggering or not.

Alternatively, you can enable rule events to be logged to events.log by editing the log level for the rule events in $OH_USERDATA/etc/log4j2.xml.

How ever you do it you want to verify whether or not the rule is being triggered.

Simplify the trigger. Trigger the rule just on a plain old update or command or even better, for something like this a change. If that works add the state. Then add the previousState.

Finally, add some logging or otherwise verify that the second rule is in fact not being called.

I could be way off base here, but I believe you need to parse the alarm_raw channel in order to act on updates from the lock. See this post: Zwave - Yale YRD220 Lock - #5 by 5iver

This is all based on OH2 - not sure if this still applies to OH3…

It does apply to OH3, because it’s a limitation of Schlage and Yale locks (and possibly others). Manual operation is only reported via alarm_raw.

Here’s my relatively simple DSL rule, which I carried over from OH2 to OH3.

So the lock is talking to the system when it is unlocked, I have no idea what it’s telling me. The stream when I unlock the deadbolt is:

openhab/items/SchlageTouchpadDeadbolt_Alarmraw/state
ItemStateEvent
{"type":"String","value":"{\"notification\":\"ACCESS_CONTROL__MANUAL_UNLOCK\",\"level\":\"1\",\"type\":\"ACCESS_CONTROL\",\"event\":\"2\",\"status\":\"255\"}"}

openhab/items/SchlageTouchpadDeadbolt_Alarmraw/statechanged
ItemStateChangedEvent
{"type":"String","value":"{\"notification\":\"ACCESS_CONTROL__MANUAL_UNLOCK\",\"level\":\"1\",\"type\":\"ACCESS_CONTROL\",\"event\":\"2\",\"status\":\"255\"}","oldType":"String","oldValue":"{\"notification\":\"ACCESS_CONTROL__MANUAL_LOCK\",\"level\":\"1\",\"type\":\"ACCESS_CONTROL\",\"event\":\"1\",\"status\":\"255\"}"}

When it re-locks, I get this:

openhab/items/SchlageTouchpadDeadbolt_Alarmraw/state
ItemStateEvent
{"type":"String","value":"{\"notification\":\"ACCESS_CONTROL__AUTO_LOCK\",\"level\":\"1\",\"type\":\"ACCESS_CONTROL\",\"event\":\"9\",\"status\":\"255\"}"}

openhab/items/SchlageTouchpadDeadbolt_Alarmraw/statechanged
ItemStateChangedEvent
{"type":"String","value":"{\"notification\":\"ACCESS_CONTROL__AUTO_LOCK\",\"level\":\"1\",\"type\":\"ACCESS_CONTROL\",\"event\":\"9\",\"status\":\"255\"}","oldType":"String","oldValue":"{\"notification\":\"ACCESS_CONTROL__MANUAL_UNLOCK\",\"level\":\"1\",\"type\":\"ACCESS_CONTROL\",\"event\":\"2\",\"status\":\"255\"}"}

It seems that the info is coming from the Alarm Raw channel. I’m not seeing any triggering of the light (I removed the script and just put a simple light switch in for testing).

Yikes, this looks beyond my scripting ability! I’m not sure I can do this at this point in my OH cycle.

You don’t need to do any scripting. I’ve already done it for you.

  1. Install JSONPATH transformation (if you haven’t already)
  2. Make an item for your alarm_raw channel, with the JSONPATH transformation per the screenshot.
  3. Make a rule that triggers on your alarm_raw item changing.
  4. In the rule action, paste in the rule I provided as a Rules DSL script action.
  5. Change the item names in my rule (Door_Lock_Alarm_Raw and Door_Lock) to match your items.

That’s it.

1 Like

Thanks Russ. I’ll give it a shot. In for a penny, in for a pound!