New Binding - Timer/Scheduling Binding

The argument is what is being proposed:

  • It does not solve the UI problem. You will still have to hard code the times. There is no current method to set a date time so one is still stuck with the awkward step of using separate Items for each part of the DateTime and having a separate entry on the sitemap for each.

  • Given that and given other limitations of bindings, the proposed binding would only be a minor improvement over what exists today. One that many might argue is not worth the effort. All it really buys you is the ability to create some Things and a bunch of Number Items to schedule an Event at some point in the future. It really is only a slight improvement over the Alarm Clock examples.

  • This is a feature that will be implemented into the core, hopefully soon. So any Binding that gets written along these lines will become redundant in the near future. Contributions to OH are precious and I for one hate to see effort that ultimately would be thrown away in the long run.

  • We are not arguing that the effort of creating a scheduler capability is not wanted or needed. We just think a Binding is not the best approach and would rather OP spend the time implementing it as part of the core rather than writing a band aide that will become redundant and no longer needed in the near future. In my opinion, building a binding would be wasted effort in the long run whereas OP contributing to the core would be a permanent improvement.

  • I also said, should the advice of the developers and maintainers be ignored and a binding created, I’m sure it would be welcomed as an addition to OH, at least as long as it takes for the feature to be added to the core.

The work is not pointless. It just would be far more valuable directed elsewhere.

And I agree that the core would be better than a band aid. That being said, the op said he doesn’t know code, therefore can’t help there. As it may only be a slight improvement, it’s still an improvement. Also, seems the op has already written the binding, in only a couple hours of time. It will take far longer to put this into the core.

This binding has come in very hand for controlling my Aquaponic unit pumps, fish tank lighting and bedside lamps. It was all working rather well, until I found I had a need to restart the Raspberry Pi regularly, due to some other bug in an unrelated logging application. I discovered that all the bindings settings are lost on reboot of the RasPi. I have tried to use a persistence service to retain the settings, but could not get that to work, I am not a coder, but have tried to search the forum/internet for a solution to plug into the source code that is available on the OP’s Git Hub page. But this is all very foreign to me.

Can someone please point me to where I can read up on how to ensure that a bindings settings are retained on restart?

I assume the persistence should do this. Look at mapdb (http://docs.openhab.org/addons/persistence/mapdb/readme.html)

There are details of configuration here: http://docs.openhab.org/configuration/persistence.html

I think what you need is something like this:

Strategies {
default = everyUpdate
}

Items {

  • : strategy = everyChange, restoreOnStartup
    }

Do that and see if it works for other items as well to ensure its not a binding specific issue.

Neil

It seems that Persistence does not solve the issue.

When the server is restarted, the timer binding is added., it goes from uninitialized to initializing, then persistence is added, and the settings are restored. It then goes from initializing to online. It then proceeds to set all the settings back to defaults.

I deleted all other persistence and rules just to make sure there was nothing else interfering…

Have a similar problem (managing water for the garden ) and rather new to openhab.
running openhabian on a raspberry 3.
how did you install the Timer binding ?

I downloaded the “org.openhab.binding.timer-2.1.0-SNAPSHOT.jar” from the second link in post 1, and placed it in the /usr/share/opehhab2/addons folder.
Restarted openHAB and it was available to manually add as new things. I then set up some rules to act on other item states, based on the state of the timer status item.

May you post some example rules that are working for you?

I try to learn about the use of rules and I did some experiments with my Ikea tradfri bulbs.

I got a lot of problems with the syntax and type conversions

I give you an example:
I wanted to get a value from a slider and use this to set the red part of a rgb bulb
I had to get this value (0-100) and convert it to 0-255
This is what I had to do

var Number rgb_red_slide = RGB_Lamp_01_red.state as DecimalType  // get the value of rgb_red_slider
 logInfo("RGB","slide:" + rgb_red_slide.toString)
 
 var Number rgb_red = rgb_red_slide * 2.55
 logInfo("RGB",rgb_red.toString)

 var myFloat = new Float(Float.parseFloat(rgb_red.toString))
 logInfo ("RGB","myFloat: " + myFloat.toString)

 var myIntRGB = Math.round(myFloat)
 logInfo ("RGB","myInt: " + myIntRGB.toString)

 var newColor = new Color(myIntRGB,0,0)
 logInfo("RGB","RGB Color: " + newColor.toString)



The code runs, but I have no idea why something like

var myIntRGB = Math.round(rgb_red)

does not work

but

var myFloat = new Float(Float.parseFloat(rgb_red.toString))
var myIntRGB = Math.round(myFloat)

works

I found the Class definition.
https://eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/library/types/HSBType.html
It’s a little hard to convert the types as some constructors does not exist and I had to use some static
call HSBType.fromRGB(int r, int g , int b)

var newHsb = HSBType.fromRGB(rgb_red_slide.intValue,green.intValue,blue.intValue)

Hey All,

Thank you Neil for this great job, the binding is very useful and should be officially released in OH2 official bindings.

However, i am facing a very weird issue recently occurred with no main reason. The issue is the Status of the timer keeps triggering On and Off all time when the current time passed the On and Off timers. Noting that it was working perfectly during the last month.

For example, if the On timer is 10:30 and Off timer is 10:35 while the current time is 10:36 and above.

in the logs it keeps giving frequently the below messages:

2017-12-31 10:39:11.423 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@36b50f48]

2017-12-31 10:39:11.424 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled OFF job for h[10] m[24] s[0]

2017-12-31 10:39:13.852 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@36b50f48]

2017-12-31 10:39:13.857 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled ON job for h[10] m[20] s[0]

2017-12-31 10:39:14.257 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@36b50f48]

2017-12-31 10:39:14.260 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled ON job for h[10] m[20] s[0]

2017-12-31 10:39:15.901 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@36b50f48]

2017-12-31 10:39:15.904 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled ON job for h[10] m[20] s[0]

Can please someone advise what could be the problem exactly? Actually i am relying a lot on this timer to activate many things in OH items on a specific time of the day.

Thank you in advance.

Hello,
would a new version of this binding be possible? The persistence of the data does not always seem to work. Since OH snapshot 2.3 I got a lot of this messages:


2017-12-31 19:00:38.799 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@ab2f0ffb]
2017-12-31 19:00:38.806 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled ON job for h[5] m[45] s[0]
2017-12-31 19:00:38.913 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@39487177]
2017-12-31 19:00:38.918 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled ON job for h[5] m[45] s[0]
2017-12-31 19:00:39.406 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@82518b3]
2017-12-31 19:00:39.411 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled ON job for h[17] m[15] s[0]
2017-12-31 19:00:40.080 [INFO ] [ding.timer.handler.DailyTimerHandler] - Cancelling current job [org.eclipse.smarthome.core.thing.internal.ThingImpl@82518b3]
2017-12-31 19:00:40.082 [INFO ] [ding.timer.handler.DailyTimerHandler] - Scheduled OFF job for h[17] m[30] s[0]

It’s a great extension to control timers via GUI. I do not want to miss it anymore.

Thank you very much
LukaNoah

Hello,

Today the Timer Binding is back to work again, i am not sure if it was a due to the 31th day of the month or it’s the last day of the year, i think I should wait for another month that has 31 days and I will highlight on this bug again.

Happy New Year !!

Hey.

Sorry I’ve been busy and still haven’t been progressing my adoption of openhab2 so things went a bit quite.

I think I know why the restart/persistance stuff might not work so I will have a go at fixing that as soon as I can.

I will look at the constant scheduling as well there are 31 days in January - so if it happens again then please let me know.

Neil

Ok the issue reported above with the log spamming is a bug that only happens on the last day of the year - so I’ve got 360 days to fix and upgrade :slight_smile:

Neil

1 Like

Hey Neil, I’m new on Openhab and I’m very happy founding your binding. But I’ve one problem with it. It will not be correctly initialized after backing up or restart Openhab. I’m using the 2.3. release with persisting (MySql). It will only start running, after changing all parameter like timer and switches. Where can I get a new update? I understand, that this nice binding is not in the official repository.

Hello Neil,

As you already mentioned that the bug was is the last day of the year. Did you released any new version that solved this bug ?

Thank you in advance.

gents, can someone please explain how to add the scheduler into a sitemap? I hope I can get my current ugly timer replaced with something more convenient…

how to fill the scheduler with data via the GUI?

grafik

Hello community,
I’m quite new to openHAB, but as some of You I’m struggling with scheduling of tasks.
I’ve searched a bit and for example Supla is adding this feature in next version.
Take a look at their proposed version: https://github.com/SUPLA/supla-cloud/issues/152.

I’d like to help with creating such Item, because this would allow end user (for example my wife, which isn’t a developer/coder) to reschedule tasks.

Because I’m new I’d be grateful for any information about creating custom item (I’d like to customize scheduler from Basic UI and from phone, so new Item is needed).
Any guidance or materials about that are more than welcome! (didn’t find anything in docs)

I’m a software developer, but I work mostly in C#, but having some instructions I can try creating POC, or help with existing development.

Things that I don’t know (yet) is how can I store scheduler config so it will be persistent between restarts.

Regards,
Tomasz

1 Like

Openhab needs something like that :frowning:

2 Likes

Is there actually anything happening on that scheduling topic?
I’m asking because I built a scheduler based on jcrontab (Java) for my home grown irrigation scheduler (in former times using modbus devices, now on Esp32 via mqtt). That system includes an AJAX based UI for configuring schedules, i.e. it parses cron entries (that respect certain constraints) and displays them in a web UI and it allows the user to create, modify and delete schedules.
Rather than continuing maintaining my old solution I’d rather integrate those devices into openhab but I would need a GUI that allows to configure schedules and provide an overview of active / inactive schedules etc.
I’m happy to discuss requirements, architecture and contribute but I am not terribly familiar with the openhab architecture.

Hi,

Great binding,

I used in combination with habpanel,

but i am missing some items.

I need the option that the timer works only with ON or OFF time.
When i want to reset at a item, i need only the OFF signale

Is it also posible to connect a item to the timer channel whitout using rules?

The posibility to change the MTWThVSaSu to a other langue

Habpanel example

Regards,

Ronny

1 Like