Change item state with rules, help

I am trying to have a cycle timer be activated with a switch. Here is my rules code

 // If 1 hour switch is on door is locked for 1 hour
rule "1 Hour Lock"
when
        item doorlock received update ON
then
        channel1.sendCommand(ON)
        myTimer = createTimer(now.plusMinutes(60))[|
                 channel1.sendCommand(OFF)
               ]


        doorlock.sendCommand(OFF)
end

I’m very new to openHab

You might need to tell us what the problem is.

Guessing, but maybe Item ‘doorlock’ can get updates while the timer is running. You could kick start many off-timers in that case.

It is quite common to need to set your rule up so that only one copy of the timer is running at a time. i.e. check to see if there is already a timer before starting a new one.

See this design pattern for techniques

This is my only timer and even without the timer i can not get the doorlock update to change my items state

Add some (temporary) logging, see if your rule gets triggered

rule "1 Hour Lock"
when
        Item doorlock received update ON
then
        logInfo("my lock rule", "Rule triggered!")
        channel1.sendCommand(ON)
        myTimer = createTimer(now.plusMinutes(60))[|
                 logInfo("my lock rule", "Timer expired!")
                 channel1.sendCommand(OFF)
               ]
        doorlock.sendCommand(OFF)
end

Although now I’ve copy-pasted, I can see you need to trigger Item big-I rather than item little-i

That fixed it! Thank you so much