Timeline picker to setup heating, light and so on

you´re right, the MaterialIcons-Regular.ttf was missing.

so i opened gitlab and clicked on download as *.zip (in main window, right upper side)

again i deleted the whole html folder and installed the downloaded. see the result:

strange, now the icon is ok but again the viewing. so again i went on gitlab and opened the index.html file direct there in the browser and copied the contend to my file (and it is different to the contend that was downloaded with the zip-file what i don´t understand how this could be).

now the viewing is correct, great:

This is really odd but i found the misstake. There were two index.html files. One file in the root folder (the correct at wrong place) and another one in the html/tme-line-picker-jsr folder (old version of this file). I hope it’s done. :slightly_smiling_face: Thanks for your help.

Now we must look to the switching behaviour you are reportet. I will read again and see what happens.

thats great @tose, i like that :slight_smile:

perhaps it helps when i tell you the behaviour of my actual test-timeline:

as long as the actual time is in the area from OFF, MIN or ON i have the correct state of the switch. but in the area of manuell the switch actually changes always betwenn OFF and ON

here snippets of my log-file:

2020-12-05 19:45:00.713 [vent.ItemStateChangedEvent] - itmFilterTimer changed from ON to OFF
...
2020-12-05 20:00:00.711 [vent.ItemStateChangedEvent] - itmFilterTimer changed from OFF to ON
...
2020-12-05 20:15:00.710 [ome.event.ItemCommandEvent] - Item 'itmFilterTimer' received command OFF
...
(longer distance here because it is defined as OFF
...
2020-12-05 21:00:00.723 [ome.event.ItemCommandEvent] - Item 'itmFilterTimer' received command ON
...
2020-12-05 21:15:00.726 [ome.event.ItemCommandEvent] - Item 'itmFilterTimer' received command OFF

i added some log-lines to your code:

          itemToSwitch.forEach(function(iTS) {
            logInfo("############# itemToSwitch " + itemToSwitch + "#############");
            logInfo("############# iTS " + iTS);
            logInfo("############# previousStates[iTS] " + previousStates[iTS]);
            logInfo("############# event " + event);
            logInfo("############# newStateIndex " + newStateIndex);
            var toSend = true
            if (event) {
              if (newStateIndex == -1) {
                if ((previousStates[iTS] != undefined) && (previousStates[iTS] != -1)) {
                  newState = previousStates[iTS]
                  previousStates[iTS] = -1
                } else {
                  toSend = false
                  logInfo("############# toSend = false");
                }
              }
            }
            logInfo("############# toSend " + toSend);
            logInfo("############# newState " + newState);
            logInfo("############# getItem(iTS).state " + getItem(iTS).state);
            logInfo("############# previousStates[iTS] " + previousStates[iTS]);
            if (toSend && (newState != undefined) && (getItem(iTS).state != newState)) {
              previousStates[iTS] = getItem(iTS).state

              logInfo("############# x getItem(iTS).state " + getItem(iTS).state);
              logInfo("############# x previousStates[iTS] " + previousStates[iTS]);

              sendCommand(getItem(iTS), newState)

and have this logged:

2020-12-05 19:45:00.660 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'b27bcff9-9eac-477c-b74e-0a3cd694dded' of rule '80d230f0-8acb-44ef-9903-3d96a23e28e5' is triggered.
2020-12-05 19:45:00.668 [INFO ] [jsr223.javascript                   ] - |############# itemToSwitch itmFilterTimer#############| 
2020-12-05 19:45:00.671 [INFO ] [jsr223.javascript                   ] - |############# iTS itmFilterTimer| 
2020-12-05 19:45:00.673 [INFO ] [jsr223.javascript                   ] - |############# previousStates[iTS] OFF| 
2020-12-05 19:45:00.676 [INFO ] [jsr223.javascript                   ] - |############# event true| 
2020-12-05 19:45:00.679 [INFO ] [jsr223.javascript                   ] - |############# newStateIndex -1| 
2020-12-05 19:45:00.682 [INFO ] [jsr223.javascript                   ] - |############# toSend true| 
2020-12-05 19:45:00.685 [INFO ] [jsr223.javascript                   ] - |############# newState OFF| 
2020-12-05 19:45:00.688 [INFO ] [jsr223.javascript                   ] - |############# getItem(iTS).state ON| 
2020-12-05 19:45:00.690 [INFO ] [jsr223.javascript                   ] - |############# previousStates[iTS] -1| 
2020-12-05 19:45:00.693 [INFO ] [jsr223.javascript                   ] - |############# x getItem(iTS).state ON| 
2020-12-05 19:45:00.696 [INFO ] [jsr223.javascript                   ] - |############# x previousStates[iTS] ON| 

@bastler The problem should be solved. Can you please check the new version. You only need to exchange one file, no clearing cache.

file: RNTs-timelinePicker.js

hello @tose,
i did a lot of tests during the mornig, now no longer every 15 minutes wrong changes in times of “manual” but still sometimes wrong changes when changing the state from the actual time to undefined. cannot reproduce exactly when this happens but after a couple of changes i have this:
now it is short after 14:00 and the switch went correct to MIN

but now it is still short after 14:00 and i only remove the MIN and now it switches to OFF

not quite sure but i think the reason is on first start the now green (ON) switchtimes where red (OFF) before and the variable previousStates[iTS] still has this value.

perhaps i am wrong but i think: all the time when we are in “manual” mode there must not be a command to the switch because maybe the user wants to switch individually in this times.

so you can think about if it would be comfortable just in the one case you set the actual time from a defined state to undefined the code looks what was the last defined state (but this may be longer time ago, even possible it was the day before) and set this as actual state.

actually i completely deleted the whole part inside the if (event) { condition and for me it seems to work now.

          itemToSwitch.forEach(function(iTS) {
            if ((newState != undefined) && (getItem(iTS).state != newState)) {
              sendCommand(getItem(iTS), newState)
            }
          })

The eventmode has a characteristic which is wanted by me. After one event he is restoring the state befor the event. This means:

Each predefined switching state different from manuall state is one event. Then such an event occurs, the state befor switching will stored and is the next time the manual state occurs this state will restored.

I believe you expect that an switching event in the timeline triggert the new state and nothing is changed until the next event in the timeline is reached. This is not the implemented event mode. This could be a second event mode.

The remove of the lines code as you describ is a possible implementation of such a event mode 2.

Hello,
I hope it is the last question for me to you.
The timeline for one Thermostat1 works fine. Now I want to configre more Thermostats.
What must I config for more items?
Here my items:

Group   gTimepicker
Group   gTimepickerObserver

String  TimelineHelper "[%s]"

String  TransferItem1  "[%s]"   (gTimepicker)
Number  Thermostat1             

String  TransferItem2  "[%s]"   (gTimepicker)
Number  Thermostat2     

And here my timelinepicker.rules:

val HashMap<String,ArrayList<String>> timePicker = newHashMap(
    "TransferItem1" -> newArrayList('Thermostat1'),
    "TransferItem2" -> newArrayList('Thermostat2')
)

But in the log file I see followed:

2020-12-06 17:30:00.196 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'timeLine picker 1': The name 'TimelineHelper' cannot be resolved to an item or type; line 54, column 18, length 14

Regards

This error message say’s that TimelineHelper is not declared in the item file.
Wich branch are you using? Master?

Yes, I am using Master.
Do I have to define TimelineHelp per items file or only once in the system? I have 3 items files and only in one it is defined. Must I define in all 3 item files?

Declaring in one file is okay.
But if you say the first timeline is working well, please test this:

val HashMap<String,ArrayList<String>> timePicker = newHashMap(
    "TransferItem1" -> newArrayList('Thermostat1'),
    //"TransferItem2" -> newArrayList('Thermostat2')
)

Now you have deactivatet the second timeline and report if the error remains.

I have add

String TimelineHelper "[%s]"

in all other item files and the error is not coming.

I have no idea what is happening. I thought every element file is part of a global element definition. The rule file cannot choose between several declarations of an element with the same name.

Just found this and already love it, thank for the great work :+1:

1 Like

I’m just setting up openhab3 from scratch and I’m wondering if there is a substitution of Timeline picker in OH3 or if there is a possibility to migrate it. Suggestions?

hi, after i upgrade to OH3, im getting below issue:

2021-01-01 10:06:16.393 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'timeLinePicker-1' failed: 'getMinuteOfDay' is not a member of 'java.time.ZonedDateTime'; line 90, column 34, length 20 in timeLinePicker

im using Time picker v0.7.3, any one got the same?..

Seems it relies on JodaTime which was dropped in OH3 because Java 11 already provides all the features by itself.
The author has to update it.

thanks for the clarification… so all time picker versions are not working with OH3?

I guess so without having looked at the Code yet :blush:

what a waste of efforts so far :sweat_smile:

there is a built in schedule in OH3… have a look on it