Timeline picker to setup heating, light and so on

The missing icon is releadted to the UI. A quick workaround is

Webview icon="none" url="http://192.168.178.31:8080/static/time-line-picker/index.html?ip=192.168.178.31:8080&transferItem=TransferItem2&yAxisLabel=1,2,3,4,5,6,7" height=14

Iā€™m getting errors in vsCode for lines

Cannot refer to the non-final variable currDay inside a lambda expression

And

Type mismatch: cannot convert from Number to int

for this line:

var String newStateString = switchPlanOfDay.get(currTimeInterval)
Duplicate local variable newState

for this:

var String newState = ''

You can ignor this warning. The best way: copy the file into your rules folder, adapt the config part and when you defines all items (in your item file) everything is working :+1:

I have writen a version in javascript. Here is the link:
https://gitlab.com/RNTs_3/openhab-timeline-picker/-/tree/develop-migrationToJSR223_javascript

This version is much more clearer. Perhaps when you start with this widget you can try this version.
In this case itā€™s a good idea you have a delay befor the rule is loading when OH is starting. In my own case i use only for this behaviour a phyton script (iā€™m running OH 2.4) all over rules are javascript.

Hello! aus MĆ¼nchen :slight_smile:

My challenge is to program a ventilation device, it has to have an operating schedule so this widget (if it works for me) would be great!
Thing (Losnary 250 m3 / h - ventilation mit Enthalpie WƤrmerĆ¼ckgewinnung)
Chanell (mqtt):
ON / OFF -> switch
fanspeed -> 1,2,3,4
bypass (sommer /winter) -> switch
Ozone treatment -> switch

during the day:
turn on at 8 and turn off at 8 pm.
from 8 ~ 9 hs -> fanspeed 2 /
from 9 ~ 11 am -> fanspeed 1 /
from 11 ~ 16 hs -> fanspeed 2 /
from 16 ~ 18 hs -> fanspeed 1 /
from 18 ~ 20 hs ->fanspeed 2

overwrite all these rules if the temperature rises in the room -->fanspeed 4

in disinfection:
Ozone -> on
from 3 ~ 3: 30 pm -> fanspeed 3
ozone deactivation:
from 3: 30 ~ 4: 30 -> fanspeed 4
(ozone sensor ok then -> off)

Thank you very much to whoever can help! :slight_smile:

Hello Pablo,
yes your challenge is easy. But you have written your edge condition not your own approach. :upside_down_face:

Webview url="http://ip-addr-openHAB:8080/static/time-line-picker/index.html?ip=xx.xx.xx.xx:8080&transferItem=TransferItem1&yAxisLabel=1,2,3,4,5,6,7&lang=de&states=1,2,3,4

Now you can set each ventilation state for every day.
Perhaps it is not nessesary to define the states for each day, so you can substitute the parameter

&yAxisLabel=17

The description for the item definition is in the OP.

1 Like

Hallo Torsten,

Thank you very much for your great contribution to the community, I am going to try right away to see how ventilation behaves;)
Sincerely!
SG :),
Pablo

Hallo zusammen!:
Hi @tose,
I am trying to make the picker work but I am not able to change the states of the sample items.
I have noticed that in your last contribution the .rules file is missing. Is this okay like this? have you replaced them with RNTs-timelinepicker.js?

2020-07-18 20:06:41.358 [ome.event.ItemCommandEvent] - Item 'TransferItem1' received command {"17":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"config":{"mode":["17"],"states":["OFF","ON"],"event":false,"lastItemState":-1,"active":true}}

From event bus!

I have also noticed the following in file 00_RNTs-timelinepicker_conf.js

// timePicker {
//     "TransferItem1": {"item1,item2,..."},                          // enum all items to control
//     "TransferItem2": {"item3"}
//     ...                                                            // enum all TransferItems
//     // one can control as many widgets as needed
// }
//
//

timePicker = {
  "TransferItem1": "item1,item2", -->**Get auch ohne { }?**
  "TransferItem2": "demoItem3"
}

@pablopescador

You have the link for the Javascript version of the timelinePicker.
This version is completely working and the data structure is clearer.
The installation notes are placed here: https://gitlab.com/RNTs_3/openhab-timeline-picker/-/tree/develop-migrationToJSR223_javascript

I think you haveā€™nt clicked the link from the OP. This is the ā€œclassicā€ version for the rule DSL.

@tose
I canā€™t find this file:

load(OPENHAB_CONF + '/automation/jsr223/jslib/JSRule.js')

and for dummyā€™s als i:
==> /var/log/openhab2/openhab.log <==
2020-07-18 22:44:03.988 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename example.sitemap does not match the name demo of the sitemap - please fix this as you might see unexpected behavior otherwise.
:expressionless:

demos items do not change state!
How long is the delay until the status update?
I promise I have copied and pasted! and modified the ip of course.

Here the link again: Files Ā· develop-migrationToJSR223_javascript Ā· Torsten / openhab timeline picker Ā· GitLab

Please read the part files and location.
Download all files with the link in this chapter and unzip.
Now you can check the folders and files in the download and copy in your OH instance.

Now, you must follow the instructions in the next chapter: declare item,ā€¦

Before you use a JSR223 rule please check if the experimental rule engine activated in your OH.

Hi @tose

everything checked and it doesnā€™t work!

!!!
2020-07-19 19:06:02.824 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script ā€˜file:/etc/openhab2/automation/jsr223/RNTs-system_startUp_helper.jsā€™: TypeError: Cannot load script from /etc/openhab2/automation/jsr223/jslib/JSRule.js in at line number 3

Dokument JSRule.js lackā€“>pls. check it!

I will check and add the missing helper files today in the evening.

Hi @pablopescador,

as promised i have added in the repository the missing files.
There are newer helper files but i have never cheked the newer files and at the moment i can ot see a reason. Everything works really fine. :+1:

1 Like

Many Thankā€™sā€¦
Iā€™ll try to see how it goes :slight_smile:
Goodnight

Hi @tose :frowning:
==> /var/log/openhab2/openhab.log <==
2020-07-20 23:02:58.960 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script ā€˜file:/etc/openhab2/automation/jsr223/jslib/JSRule.jsā€™: java.lang.ClassNotFoundException: org.eclipse.smarthome.automation.core.util.RuleBuilder
2020-07-20 23:02:58.968 [INFO ] [me.core.service.AbstractWatchService] - Loading script ā€˜jslib/PersistenceExtensions.jsā€™
2020-07-20 23:02:59.223 [INFO ] [me.core.service.AbstractWatchService] - Loading script ā€˜jslib/triggersAndConditions.jsā€™
2020-07-20 23:02:59.582 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script ā€˜file:/etc/openhab2/automation/jsr223/jslib/triggersAndConditions.jsā€™: java.lang.ClassNotFoundException: org.eclipse.smarthome.automation.handler.TriggerHandler
2020-07-20 23:02:59.586 [INFO ] [me.core.service.AbstractWatchService] - Loading script ā€˜jslib/helper.jsā€™
2020-07-20 23:02:59.893 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script ā€˜file:/etc/openhab2/automation/jsr223/jslib/helper.jsā€™: java.lang.ClassNotFoundException: org.eclipse.smarthome.automation.core.util.RuleBuilder
2020-07-20 23:02:59.898 [INFO ] [me.core.service.AbstractWatchService] - Loading script ā€˜jslib/RNTs-trigger.jsā€™
2020-07-20 23:03:00.603 [INFO ] [ort.shared.ScriptedAutomationManager] - removeAll added handlers
2020-07-20 23:03:00.609 [INFO ] [me.core.service.AbstractWatchService] - Loading script ā€˜jslib/triggersAndConditions.jsā€™
2020-07-20 23:03:00.872 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script ā€˜file:/etc/openhab2/automation/jsr223/jslib/triggersAndConditions.jsā€™: java.lang.ClassNotFoundException: org.eclipse.smarthome.automation.handler.TriggerHandler

Have you installed/ activated the experimental rule engine in the paper UI?

Stop. :grimacing:
With version of OH you are using?

openHAB 2.5.6 Release Build
experimental rule engine in the paper UI? -->yes!

This is the reason. The namespace was changed from 2.4 to 2.5 and so throws an error.
Iā€™m not using 2.5.x and iā€™m not able to test with the new helper files.

There are three ways to solve this:

  1. Use the classic version with the old rules DSL, described in OP.
  2. Adapt the namespace. Here is a releated link. [SOLVED] JSR223 Javascript rule gives error after installation
    I do not know the result.
  3. Try the newer helper files and give feedback. https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/Installation.html
    (the javascript part is needed)

:crazy_face: