How to set a simple timer

Hi
I would like to set a simple timer
For example, switch off a few switches at a certain hour of the night and turn them on at a certain time in the morning
One day a week.
Please do not send me to read more documents I just can not get them.
Thank you very much to all the helpers
Great community

You can use these cron expressions

  • First to make off:
    “0 0 22 ? * THU *”
    which means At 22pm, on every Thursday

  • And to make on:
    “0 0 6 ? * THU *”
    which means At 6pm, on every Thursday

Little more information
I have twenty sonoff switches
Defined in ITEMS as MQTT and I can control them through UI.
I prefer to set the amount of them together to light up and shut down

What is cron expressions?
And where I define these settings

Cron expression is string used to specify schedule,

You can use cron expression in rules, as time-based trigger.

So you put it after when clause in rules syntax

rule "<RULE_NAME>"
when
    <TRIGGER_CONDITION> [or <TRIGGER_CONDITION2> [or ...]]
then
    <SCRIPT_BLOCK>
end

And you can define the needed cron expression manually (after reading about it) or by using this website (https://www.freeformatter.com/cron-expression-generator-quartz.html),

Should I install something?
I have never defined rules yet
And still did not understand where I needed to define the ITEMS and where to set the time
Could you please show me a complete example

First explain about your system hardware ?

Well
I have openhabian 2 on raspberry pi3b +
I installed MQTT BROKER on the device and set it up
I installed MQTT BINDING via ADD-ONS and defined it with the BROKER
I have several lighting switches and a sonoff company with tasmota on them
All properly configured in ITEMS and SITEMAPS and I can control them through the UI
I got stuck only on the rules

@SUGINACH

Hello, BEFORE asking all these questions YOU REALLY need to read something.
You can’t just pop in there and ask for US to make YOUR automation system.

Is not an excuse. You will not be able to understand anything of what we say as you just proved earlier if you have not read the introduction to openHAB.
Read that. Understand the concept, follow the tutorials and have a go. If it doesn’t work we will be very happy to help you understand where you went wrong. But we are not here to code for you.

So go to:


then

then

For items:

For rules:

write your .tems file content

Well
First I have read all the documents in question
Second thing The documents are indeed written very thoroughly
But you have to understand
There are several types of people
And some of them like me are unable to contain such amounts of information without specific examples
And the fact is that when I started (a week ago) I tried to read the information on how to install MQTT BROKER and how to install MQTT CLINET as well as how to configure them and how to define the products I have to work with MQTT BROKER and how to define the correct settings and commands in NQTT CLIENT
I did not understand anything
And someone nice and naively sent me to read a series of 22 articles about MQTT !!!
As if it would help if I knew who invented it
Well it did not help and I could not follow the information
But after coming across an 8-minute video that made it very clear what I wanted to know
I’m not lazy to read documents! They just do not help me! They just make me confused with unclear information.
of course
I do not require anyone to help me
I’m just asking nicely If someone can explain to me the way I understand
thanks anyway

1 Like

again
I found this video


Which is pretty clear what I should do
thanks anyway
1 Like

Like you I am not comfortable writing code, of any kind.

I muddle through where I have to, with very basic “Something happens, Do Something” type rules.

I’m totally happy with extremely complex wiring systems and anything that revolves around connecting kit together (with >25 years experience on large corporate events around the world with anything from telecoms to large power distribution), but when it comes to writing code… I’m lost.

Anyway, I stumbled across a Scheduler in the Automation section of HabPanel.

http://{Your_Machines_IP}:8080/habmin/index.html#/scheduler

I haven’t tried it yet (As Velbus holds all my automation schedules in each module), but I thought it might be of use to you.

I’d love to hear how you get on with it.