Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Exec 2.0] Not possible to only execute once #1533

Closed
chiefymuc opened this issue Dec 6, 2016 · 11 comments
Closed

[Exec 2.0] Not possible to only execute once #1533

chiefymuc opened this issue Dec 6, 2016 · 11 comments

Comments

@chiefymuc
Copy link

chiefymuc commented Dec 6, 2016

Currently it is not possible to execute a command only once.

Default: interval = 15s
When putting interval=0, the handler throws an error.

It would be a good feature if it is possible to only execute a command once!

I hope @kgoderis can help?

Thanks!

@kgoderis
Copy link
Contributor

kgoderis commented Dec 7, 2016

Ok will fix that

kgoderis added a commit to kgoderis/openhab-addons that referenced this issue Dec 7, 2016
Signed-off-by: Karel Goderis <karel.goderis@me.com>
kgoderis added a commit to kgoderis/openhab-addons that referenced this issue Dec 7, 2016
Signed-off-by: Karel Goderis <karel.goderis@me.com>
@chiefymuc
Copy link
Author

I confirm it works! Thank you!

One additional comment. I see many confused questions on the OH forums, so maybe the readme should include more information. Also I guess setting the default to 0 would probably avoid a lot of questions.

Cheers!

Jamstah pushed a commit to Jamstah/openhab-addons that referenced this issue Dec 12, 2016
Signed-off-by: Karel Goderis <karel.goderis@me.com>
@steve-bate
Copy link

I suggest that not specifying an interval should result in a one-shot execution when triggered by an input command or similar event. Using zero as a magic number for disabling the periodic execution is surprising for the user, especially since it's currently undocumented (AFAICT). An interval=0 should be an error since the user surely doesn't want the execution to run in a tight loop, which the value implies. It's also surprising that the execution runs periodically when no interval is requested or specified.

@kgoderis
Copy link
Contributor

kgoderis commented Jan 4, 2017

Using zero as a magic number for disabling the periodic execution is surprising for the user, especially since it's currently undocumented (AFAICT). An interval=0 should be an error since the user surely doesn't want the execution to run in a tight loop, which the value implies. It's also surprising that the execution runs periodically when no interval is requested or specified.

@steve-bate err.... the actual code does not show this behaviour AFAIK. When Interval is not specified, the scheduling job is not scheduled for periodic execution. I do agree that when interval=0, a warning could be thrown in the logs, but then, it depends on the time-unit used, e.g. what if we would move to milliseconds as a unit, where would you put the threshold for a "tight loop"? 150ms?...

@steve-bate
Copy link

Unless I'm mistaken, I was seeing this behavior on the master branch. When I didn't specify an interval I saw a callback once per minute which appeared to correspond to a recent change to make the default value for the interval be 60 seconds. I agree that any positive interval value is difficult to validate in a general way.

@steve-bate
Copy link

steve-bate commented Jan 6, 2017

@kgoderis, this is the configuration I saw that matched the behavior I was seeing (callback every 60 seconds without an interval specification).

thing-types.xml

           <parameter name="interval" type="integer"  required="false">
                <label>Interval</label>
                <description>Interval, in seconds, the command will be repeatedly executed</description>
                <default>60</default>
            </parameter>

@kgoderis
Copy link
Contributor

kgoderis commented Jan 6, 2017 via email

@kgoderis
Copy link
Contributor

@kaikreuzer
Copy link
Member

A default value will be used, if nothing else is specified by the user. So as it is not required, the value will be 60 - apparently not what you intended, right?

fharni pushed a commit to fharni/openhab2-addons that referenced this issue Feb 10, 2017
Signed-off-by: Karel Goderis <karel.goderis@me.com>
@mavris
Copy link

mavris commented Apr 18, 2017

Having this code Thing exec:command:switchTV [command="python /opt/BroadLink/BlackBeanControl/BlackBeanControl.py -c SwitchTV" interval=0, timeout=10, autorun=false] the command is executed each 60 secs. Any recommendations how to disable the loop?

@tavalin
Copy link

tavalin commented Apr 18, 2017

@mavris aren't you missing a comma before interval=0?

Flole998 pushed a commit to Flole998/openhab-addons that referenced this issue Dec 30, 2021
* Fix for cron scheduler handling sunday as number

Closes openhab#1532

Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
markus7017 pushed a commit to markus7017/openhab-addons that referenced this issue Aug 12, 2023
Signed-off-by: Markus Storm <markus.storm@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants