# My first Rule - light on and off every 10 seconds (can't make most basic rule work)

**URL:** <https://community.openhab.org/t/my-first-rule-light-on-and-off-every-10-seconds-cant-make-most-basic-rule-work/42066>\
**Category:** Installation\
**Tags:** rules\
**Created:** [March 19, 2018, 4:37am UTC](https://community.openhab.org/t/my-first-rule-light-on-and-off-every-10-seconds-cant-make-most-basic-rule-work/42066 "2018-03-19T04:37:32Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [March 19, 2018, 1:56pm UTC](https://community.openhab.org/t/my-first-rule-light-on-and-off-every-10-seconds-cant-make-most-basic-rule-work/42066/7 "2018-03-19T13:56:08Z")

</div>

I agree with Vincent. Your cron expression doesn’t do what you think it does. “0/10 0 0 ? \* \* \*” means every ten seconds starting at second 0 on minute 00 on hour 00 any day, month, or year.

So the cron expression as written will only execute six times between 00:00 and 00:01.

I highly recommend using a cron expression builder if you are not familiar with the syntax.

> **[Free Online Cron Expression Generator and Describer - FreeFormatter.com](https://www.freeformatter.com/cron-expression-generator-quartz.html)**
>
> This free online tool lets you build a Quartz Cron expression or converts one in readable text format

> [@highvoltage](#):
>
> I used the Cron builder to generate time code

I think you are missing the correct interpretation of the starting at. Starting at only applies when you have a / (e.g. 0/10 is every ten seconds starting at second 00). Since you don’t have a / for the minutes and hours you don’t have a starting at, you have a “Specific minute/hour”.

> [@highvoltage](#):
>
> I get this Log error is –\> Configuration model ‘gazebo.rules’ is either empty or cannot be parsed correctly!

That is usually caused when you edit your files over a samba share or using certain text editors. So long as you see a Loading model `gazebo.rules` following that without other errors everything is fine.

> [@highvoltage](#):
>
> How are rules activated, by restarting the server?

As soon as you see that Loading model log statement the rule is active and will run.

> [@highvoltage](#):
>
> Do I need to “import” a Cron library? (similar to Arduino “include”… ??)

No.

> [@highvoltage](#):
>
> How do I view the setup demo (rule) examples from the Standard installation???

You need to install the demo setup. I think you can do this by changing addons.cfg to use package=demo.

> [@highvoltage](#):
>
> Is there a single comprehensive programming reference manual

No. There is the [Rules docs](https://docs.openhab.org/configuration/rules-dsl.html) and [Xtend Expressions docs](http://www.eclipse.org/xtend/documentation/203_xtend_expressions.html).

Also, when you use VSCode with the openHAB extension you also get automatic completion. So you can type in the name of an object or variable and it will tell you all the methods on that object.

> [@highvoltage](#):
>
> these are just some of the strange looking (dot) word things that I am not sure if they are like functions, commands, or whatever.

This dot word thing is standard OO syntax and applies across pretty much every OO language I can think of except maybe Objective Lisp. It even applies to C++ when referencing the functions or data members of a Class or Struct.

> [@highvoltage](#):
>
> whether imports are needed to make some work

Imports are almost never needed. You only need imports if you want to use a class that is not in java.lang.\* or core openHAB classes.

> [@SkyyStorm](#):
>
> I believe it has something to do with spaces or tabs or something,

No, it has to do with the fact that when editing a file over samba two file events get generated when you save a file, one when you are about to save the file and one when saving the file is done. OH uses the file events to know when to reload the file so it gets the first event and tries to read in the file while it is being written resulting in a bad file read. Then it tries again on the second event and reads successfully.

---

_[View the full topic](https://community.openhab.org/t/my-first-rule-light-on-and-off-every-10-seconds-cant-make-most-basic-rule-work/42066)._
