Timeline picker to setup heating, light and so on

Hi everyone,
i am implementing TLP on my raspberry but i have the problem that the TimelinePicker thing that is created is UNITIALIZED. In previous threads I saw that someone solved by updating OH to 3.4.1 (I have 3.4.2) and someone by installing TLP_V3.2, I installed V3.0.3, I can’t find V3.2 on gitlab.

The web object works perfectly.

Webview icon="none" url="/static/tlp-jsr/index.html?id=Sala&mode=1,2,3,4,5,6,7&token=oh.Timeline.on.xxxxxx&linkedItem=PP_Sala_TLP_Status&states=NONE,T_LOW,T_MEDIUM,T_HIGH"

I have no errors in openHAB Log Viewer (frontail) but the states are not transferred to the item.
Can anyone help me?

Hi Fabio,
the timeline picker think stays unitialized. This is not so nice but okay.
I’m not sure if is there problems with JSscripting befor OH 3.4.x. I would recommand upgrade to OH 3.4.x and everything will work as expected.

Thanks for the quick answer…
If I understand correctly, if I see UNIZIALIZED written on Things it should work anyway…
I have updated OH from V3.4.1. to V3.4.2 but the transfer of the STATUS on the ITEM does not work.
Do I need to install any addons?

Yes, of course.
JS Scripting is nessesary.

If I install Javascript Scripting in openHAB log Viewer I get this error…

2023-02-14 17:23:18.574 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error while creating ScriptEngine
org.graalvm.polyglot.PolyglotException: Error: Invalid CommonJS root folder: /etc/openhab/automation/js/node_modules
	at org.graalvm.polyglot.Context.eval(Context.java:399) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.evalInternal(GraalJSScriptEngine.java:376) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSBindings.initGlobal(GraalJSBindings.java:96) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSBindings.initContext(GraalJSBindings.java:92) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSBindings.requireContext(GraalJSBindings.java:86) ~[?:?]
	at com.oracle.truffle.js.scriptengine.GraalJSBindings.put(GraalJSBindings.java:129) ~[?:?]
	at javax.script.SimpleScriptContext.setAttribute(SimpleScriptContext.java:246) ~[java.scripting:?]
	at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.addAttributeToScriptContext(ScriptEngineManagerImpl.java:285) ~[?:?]
	at org.openhab.core.automation.module.script.internal.ScriptEngineManagerImpl.createScriptEngine(ScriptEngineManagerImpl.java:156) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.createAndLoad(AbstractScriptFileWatcher.java:272) ~[?:?]
	at org.openhab.automation.jsscripting.internal.fs.watch.JSScriptFileWatcher.createAndLoad(JSScriptFileWatcher.java:63) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.importFile(AbstractScriptFileWatcher.java:256) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.lambda$5(AbstractScriptFileWatcher.java:248) ~[?:?]
	at java.util.Optional.ifPresent(Optional.java:183) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.importFileWhenReady(AbstractScriptFileWatcher.java:246) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.importInitialResources(AbstractScriptFileWatcher.java:149) ~[?:?]
	at org.openhab.core.automation.module.script.rulesupport.loader.AbstractScriptFileWatcher.lambda$8(AbstractScriptFileWatcher.java:327) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

Do you have an idea of the reason for the error?
I try to search in the threads?

Please check the folder
/etc/openhab/automation/js/node_modules

  • exist the folder?
  • is some content in the folder?

The folder was not there and I created it.
Now I have no more JSScripting related errors.
Now every 2 minutes in openHAB log viewer I have the following warning:

2023-02-15 09:04:00.741 [WARN ] [.automation.script.file.RNTs-tlp3.js] - tlp - W002: no items defined to switch | id= Sala

items:

String		PP_Sala_TLP_Status															(PP_Sala, gTimepicker)

sitemaps:

Webview icon="none" url="/static/tlp-jsr/index.html?id=Sala&mode=1,2,3,4,5,6,7&token=oh.Timeline.on.xxxxxxxxx&states=NONE,T_LOW,T_MEDIUM,T_HIGH"

in to the file: automation/js/conf/00_RNTs-tlp3_conf.js

// timeline/ timepicker conf
// version 3.0.2
// ToSe 

/////////////////////////////////////////////////////////////////////////////////////
/*
next steps:

*/
/////////////////////////////////////////////////////////////////////////////////////

const tlp_ids = {
  'Sala': 'PP_Sala_TLP_Status'
}

module.exports = {
  tlp_ids
}

What am I doing wrong?

Is this the real line in your sitemap? I assume you have masked your token.

Check this:
Show your timeline in a browser,
Change something and save
Refresh the browser

Now you must see the timeline with your saved changes.

Yes the row in the sitemaps is different, I hid the token as xxxxxx
The timelinepitcher in the web works and is updated when I change it.
The problem is that if I configure the item from the 00_RNTs-tlp3_conf.js file the error comes out in the openHAB log viewer.

2023-02-15 10:50:00.671 [WARN ] [.automation.script.file.RNTs-tlp3.js] - tlp - W002: no items defined to switch | id= Sala

I tried now to link the item in the sitemaps file it works!
If I link it from the file 00_RNTs-tlp3_conf.js no, why?

I try to explain myself better…
There are two ways to link an Item to a TimeLine, via sitemaps by inserting “&linkedItems=PP_Sala_TLP_Status” in the webview line

Webview icon="none" url="/static/tlp-jsr/index.html?id=Sala&mode=1,2,3,4,5,6,7&states=NONE,T_LOW,T_MEDIUM,T_HIGH&linkedItems=PP_Sala_TLP_Status&token=oh.Timeline.on.xxxxxxxxxxxxx"

or by editing the “00_RNTs-tlp3_conf.js”

const tlp_ids = {
	'Sala': 'PP_Sala_TLP_Status',
}

module.exports = {
  tlp_ids
}
Webview icon="none" url="/static/tlp-jsr/index.html?id=Sala&mode=1,2,3,4,5,6,7&states=NONE,T_LOW,T_MEDIUM,T_HIGH&token=oh.Timeline.on.xxxxxxxxxxxxx"

In the first way it works perfectly, in the second way I get the warning and it doesn’t work:

2023-02-15 14:04:00.597 [WARN ] [.automation.script.file.RNTs-tlp3.js] - tlp - W002: no items defined to switch | id= Sala

I have the idea. I’m pretty sure there is no issue.

The problem is, the conf file will be read then the file RNTs-tlp3.js loaded. Every change at the conf file is ignored. So you must add a space at the end of a line in the file RNTs-tlp.js and save the file again. Now the changed conf file is also loaded and everything works as expected.

I will look for a better way, but for now this is the way it is.
Does anyone have a solution?

Ok that works perfectly!!
Thank you very much for your support.
:grinning:

I have added some test timelinepicker, using the v3 version, directly editing the sitemap file and not the configuration file, but now I would like to remove it. Is there a procedure to remove an uid? should I edit the jsondb files? what entries should I remove? in what files?

EDIT: I think I figured out. The “tlpicker:tlp:home” thing and all of the info on the various timepickers are in the org.openhab.core.thing.Thing.json file.
In order to remove everything it is simply matter of stopping openhab and removing the entire section concerning “tlpicker:tlp:home”.

@Lionello_Marrelli
Please do this!
The correct way is simple and easy.
With v3 I have introduced the admin widget. See the doc’s in OP.
You can remove any ID and you can define the items for sunrise and sunset.

Ok I implemented the admin widget in the sitemap and I was able to clean up both the thing and the trigger item. Still the RNTs-tlp3.js .rule gives every two minutes the error

2023-02-26 17:12:00.194 [ERROR] [.automation.script.file.RNTs-tlp3.js] - tlp - E001: error as calling tlp data TypeError: Cannot read property "getConfiguration" from null

This is not a big deal: if a timelinepicker is not required it is better to uninstall the rule.

Yes, removing the rule file is it. , But for the case the tlp thing doesn’t exist, i will look if it is a way to prevent this error.

This is really nicely made. Thanks for your efforts!

Just wondering if dark mode is broken or if I’m doing something wrong? I tried:
&dark (as per instructions)
&dark=yes (mentioned in earlier posts)
but I don’t see any change.

@mjptec Unfortunately the dark mode is not finished. At the moment i must do some other stuff but i will rework it.

A thought: The translations for French and Portuguese are not complete. Is someone willing to translate? It’s easy to help. Call the file behind the link Language File. Copy the releated language section and fill the blank entrys and post the part here. :grinning:

Thanks @tose. I don’t have experience with web programming, but if you point me in the right direction I might be able to contribute to the dark mode if you like.
In the mean time, I’m about to post an updated main UI wrapper widget for TLP v3. Hence the previous question. One further question is, can you point me to what condition you use to toggle the display of the zoom bar in auto mode?

@mjptec Yes, you can help without experience in web programming. The main task is the color schema. Perhaps you or someone else can post a screenshot in light mode and overlay html hexcodes for colors in darkmode.

Is this a technical question?
I use the navigator.useragent function of the WEB API.

Is it a UI Question?
You can control the mode with parameter ‘zoom’ (auto, no, force)