[SOLVED] Sending a message at a specific time

Hello. I have rule that sends the message in telegram
I have Xiaomi magnet sensor. When door is opened, openhab send message in telegram.
How can I do rule that send message at a specific time? from 18:00 to 9:00
My rule is
rule “Оповещения телеграм”
when
Item mihome_sensor_magnet*******_isOpen changed from CLOSED to OPEN
then
sendTelegram(“bot1”, “Откыта дверь в кабинете”)
end

sorry for my English

Wait, do you want the rule enabled only on that time range or you want the rule enabled but send the message at a specific time?

1 Like

enabled but send the message at a specific time.

I want to clarify
Do you want to send a message when the door is opened between 18:00 and 19:00
OR
Do you want to send a message between 18:00 and 19:00 even it the door has been opened previously?

Sorry, I first wrote wrong
I want to send a message when the door is opened between 9:00 and 18:00.

OK:

rule "Оповещения телеграм"
when
    Item mihome_sensor_magnetxxxxxxxx_isOpen changed from CLOSED to OPEN
then
    if (now.getHourOfDay >= 9 && now.getHourOfDay < 18) {
        sendTelegram("bot1", "Откыта дверь в кабинете")
    }
end
1 Like

Please tick the solution:
hc_292

And also see:

For a more generic approach

Thanks for the help, I am a new user of openhab, it will be a great lesson for me