Timeline picker to setup heating, light and so on

@opus
You have observed the CORS problematic.
Are you calling the BasicUI from a internal device or from remote?
The name

ip=myOHpi

Where is this name set?
I will look the state defaults.

MyOHpi is the local name of my Raspi3, and yes I’m using it in the local net.

CORS is a security mechanism from modern browsers and i dosent find a simple solution for this.
I think a Proxy server is to much overhead.

Maybe someone has find a working solution in conjunction with the REST interface here?

To prevent trouble in the webview, the calling ip from openhab server and the ip from the REST interface must be equal. Or the notation from @opus is right.

Hey

It works fine, The issue seems to be some small bugs.

The Transfer item is being defaulted to whatever the first item is in grey, not 0.

in my case it defaults to 0. When i turn on zones, it then changes from OFF to 1,2,3 or 4. but the defaults are still OFF.

Yesterday i went through and selected each square with a zone, then again with OFF.

Now they are all set to 0.

My current Transfer item string is

{"1":{"key":"1","value":"OFF,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,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"},"2":{"key":"2","value":",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,2,2,2,2,3,3,3,3,4,4,4,4,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"},"3":{"key":"3","value":"OFF,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,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"},"4":{"key":"4","value":"OFF,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,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"},"5":{"key":"5","value":"OFF,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,2,2,2,2,3,3,3,3,4,4,4,4,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"},"6":{"key":"6","value":"OFF,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,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"},"7":{"key":"7","value":"OFF,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,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"},"99":"OFF,Zone1,Zone2,Zone3,Zone4"}

Which is correct, But for some reason, in the string you can see the first value for each day is OFF, and the rest are 0.

There just seems some small bugs.

Also after setting the transfer item to use mapdb, this is restored on startup. so that works fine also.

Also, the issue is still there for the key value 2.

This is what key value 1 looks like, starts with OFF

{"1":{"key":"1","value":"OFF,0,

and this is key value 2, starts with a blank entry

,"2":{"key":"2","value":",0,0,0,0,0,0,0,

This would only be a problem if you have something to turn on or off from Midnight to 00:15 which i dont, but i thought you may know what this problem is.

I’m not in a position to reproduce that behavior. Perhaps you have an older version from switchPointSet.js?
But dont worry, the first entry in transferItem is never used.

In the new development version i have added an new url parameter (lang=en). So the label of y-axis is in english. :slightly_smiling_face:
Feel free to test it. https://gitlab.com/RNTs_3/openhab-timeline-picker/tree/develop
note: you must replace the index.html and the SwitchPointSet.js

For over languages of label y-axis i need help. :face_with_raised_eyebrow:

Thanks
as i said, its not an issue now, but its what was happening on my system. I was able to get around it by selecting all the off timeslots as well as the on timeslots.

I have also adjusted my file to be in english.

Hi, it looks to work fine for a lot of you guys but I have some problem to get rid of the message “error in transfer string” in the log. I guess my items file is probably not correcty configured and I do not see from the above example what I need to define exactly. Do I need to add (gTimepicker) for each item defined in the TransfertItem of the HashMap?
This may sound trivial for question but I’m new in the OpneHab world (sorry for that).
Thank you in advance for your time in answering me.

Next to my question I just have a remark:
In the example.sitemap I noticed that at the end of the URL a " is missing (between the yAxisLabel and the height which breaks openHABpanel on iOS (and not android).

1 Like

Hi,
please show your sitemap (only the webview element) and the releated item entrys.
The group gTimepickerYou must assign only the item TransferString. When you this widget more when one times used, then you will define a second and third item TransferString1, TransferString2, … . This Items must you assign gTimepicker.

Thanks for the hint.

1 Like

Hi Torsen,
My sitemap looks like this
Frame label=“Terrarium”
{
Switch item=Terrarium1
Switch item=Terrarium2
Webview url=“http://192.168.0.7:8080/static/time-line-picker/index.html?ip=192.168.0.7:8080&transferItem=TransferItem&states=OFF,ON&yAxisLabel=17” height=13
}

and in the log i got the following:
Item ‘TransferItem’ received command {“1”:{“key”:“17”,“value”:“OFF,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0”},“99”:“OFF,ON”}

My items has the following entries:
Group gTimepicker (All)
String TransferItem “[%s]” (gTimepicker)
//Terrarium
Switch Terrarium1 “Terrarium Lamp1” [ “Switchable” ] {
channel=“zwave:device:9344abd1:node6:switch_binary1” }
Switch Terrarium2 “Terrarium Lamp2” [ “Switchable” ] {
channel=“zwave:device:9344abd1:node6:switch_binary2” }

and finaly my rules contains:
val HashMap<String,ArrayList> timePicker = newHashMap(
“TransferItem” -> newArrayList(‘Terrarium1’,‘Terrarium2’))

Do you see the culprit (me of course but in the config files)?

Hi Oliver,
i mean you have an older development version and this brakes.
Please download the current development brunch on Gitlab https://gitlab.com/RNTs_3/openhab-timeline-picker/tree/develop and copy all files one more time. (index.html, switchPointSet.css, switchPointSet.js) Unfortunally you must also insert the new example.rules file an customize with your HasMap.

After this reinstall you must change the webview url one time to url=“http://192.168.0.7:8080/static/time-line-picker/index.html?ip=192.168.0.7:8080&transferItem=TransferItem&states=OFF,ON,1&yAxisLabel=17”
and accept the next question. Then save the timeline.
Now you can call your previous webviewurl (without the addional 1) and it’s dosen’t throw an error - i hope.
The last procedure clears the old data in transfer string.

In this version you can add an addional url parameter

&lang=en

for english y axis label.

Hi Torsten, Thanks for your reply. I have uploaded the latest version of index.html, switchPointSet.js, switchPointSet.css, vue-resource.js and vue.js.
I have updated my rules with your new v0.5 version but I still have the “error in transfer string”.

The logs give
Item ‘TransferItem’ received command {“1”:{“key”:“17”,“value”:[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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0]},“99”:“OFF,ON”}

Other thought?

Hi Oliver,
can you insert the following logInfo… in the rule file at this postion and post the log?

            while ((countScale < 9) && (!stopLoop)) {
                logInfo('check',String::format("%s | %s",currKey,switchPlan))   // insert this line
                if (switchPlan.contains(countScale.toString + '":')) {

You wrote:

The logs give
Item ‘TransferItem’ received command {“1”:{“key”:“17”,“value”:[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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0]},“99”:“OFF,ON”}

Have you added an additional log command or does this entry appear in the log file by itself?

Mine was doing the same thing with this error. I found that i was trying to access my timepicker HTML from an external network and it was not saving the times or updating the timepicker. Once i accessed from my local network it fixed it.

You want the timepicker to update something like this

2018-11-22 12:00:30.021 [vent.ItemStateChangedEvent] - TransferItem changed from {"1":{"key":"1","value":"OFF,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,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"},"2":{"key":"2","value":",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,2,2,2,2,3,3,3,3,4,4,4,4,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"},"3":{"key":"3","value":"OFF,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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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,0,0,0,0,0,0,0,0,0,0,0,0"},"7":{"key":"7","value":"OFF,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,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"},"99":"OFF,Zone1,Zone2,Zone3,Zone4"}

This is how mine updates. But i have mine set for every day is seperate. Not grouping them.

Hi Torsten,
The entry I was refering to was the entry found in the events.log when I save the schedule from the time-line-picker page.

I have now added the logInfo which shows the following in the openhab.log:
2018-11-23 18:30:30.032 [INFO ] [eclipse.smarthome.model.script.check] - 17 | {“1”:{“key”:“17”,“value”:[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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0]},“99”:“OFF,ON”}

2018-11-23 18:30:30.048 [INFO ] [eclipse.smarthome.model.script.check] - 17 | {“1”:{“key”:“17”,“value”:[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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,0]},“99”:“OFF,ON”}

2018-11-23 18:30:30.053 [ERROR] [se.smarthome.model.script.timepicker] - error in transfer string
I think the problem is coming from the [ and ] as delimiter of the “value” instead of ".
I will look why I get these delimiters.

Hi Oliver,
it’s realy strange. Your log looks good.
Please post your complete rule file and i will view this.

In the first you can replace currKey in the additional log line through countScale and also post the result.

logInfo('check',String::format("%s | %s",countScale,switchPlan))   // insert this line

Amazing how you are responsive Torsten :slight_smile:

Here is the result with countScale
2018-11-23 19:16:00.042 [INFO ] [eclipse.smarthome.model.script.check] - 1 | {“1”:{“key”:“17”,“value”:[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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0]},“99”:“OFF,ON”}

2018-11-23 19:16:00.069 [INFO ] [eclipse.smarthome.model.script.check] - 2 | {“1”:{“key”:“17”,“value”:[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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,0]},“99”:“OFF,ON”}

2018-11-23 19:16:00.081 [ERROR] [se.smarthome.model.script.timepicker] - error in transfer string

and my rules is pretty much coming from github version 0.5 and that is:
import org.eclipse.smarthome.model.script.ScriptServiceUtil
import java.util.HashMap
import java.util.ArrayList

val HashMap<String,ArrayList> timePicker = newHashMap(
“TransferItem” -> newArrayList(‘Terrarium1’,‘Terrarium2’)
)

rule “check switchpoints 1”
when
// Time cron “0 0/15 * 1/1 * ? *”
Time cron “0/15 * * ? * * *” // for debug, trigger eatch 15 seconds
then
var Number currTimeInterval = (now.getMinuteOfDay() / 15).intValue
var Number currDay = now.getDayOfWeek()

gTimepicker.members.forEach[ currSwitchPlan |
    if ((currSwitchPlan.state !== NULL) && (timePicker.keySet().contains(currSwitchPlan.name))) {
        var String switchPlan = (currSwitchPlan.state as StringType).toString
        var String currKey = currDay.toString

        // check the different week plans 15,17,67; e.g mo-fr, ...
        if (switchPlan.contains('"key":"17"')) currKey = "17"
        if (switchPlan.contains('"key":"15"') && (currDay > 0 && currDay < 6)) currKey = "15"
        if (switchPlan.contains('"key":"67"') && (currDay > 5 )) currKey = "67"

        // determine the scale number in transfer string
        var Number countScale = 1
        var Boolean stopLoop = false
        while ((countScale < 9) && (!stopLoop)) {
                            logInfo('check',String::format("%s | %s",countScale,switchPlan))   // for debugging
            if (switchPlan.contains(countScale.toString + '":')) {
                if (transform("JSONPATH", "$." + countScale.toString + ".key", switchPlan) == currKey) {
                    countScale = countScale -1
                    stopLoop = true
                }
                countScale = countScale + 1
            } else {
                // error in transfer string
                logError("timepicker","error in transfer string")
                countScale = (-1)
                stopLoop = true
            }
        }
        if (countScale != (-1)) {
            var String[] switchStates = (transform("JSONPATH", "$." + "99", switchPlan.toString)).split(',')
            var ArrayList<String> itemToSwitch = new ArrayList(timePicker.get(currSwitchPlan.name))

            // extract switch states of dataset; jsonpath is realy unflexible so string operation are used
            var String dataSetOfDay = (transform("JSONPATH", "$." + countScale.toString, switchPlan))
            var Number[] switchPlanOfDay = (dataSetOfDay.substring(dataSetOfDay.indexOf('value')+7,dataSetOfDay.length-2)).split(',')

            if (!(itemToSwitch.size() == 1 && "".equals(itemToSwitch.get(0)))) {
                itemToSwitch.forEach [ iTS |
                    var currItem = ScriptServiceUtil.getItemRegistry.getItem(iTS) as GenericItem
                    var newState = switchStates.get(Integer::parseInt(switchPlanOfDay.get(currTimeInterval)))
                    // send only commands when current state differenced from new state
                    if (currItem.state.toString != newState) currItem.sendCommand(newState.toString)
                ]
            }
        }
    }
]

end

I think, i have found the problem. :scream:

You see the double quotes? They are different.
I mean this is the problem.

The transfer string is transmited with your double quotes and in the rule file is my version of double quotes.
Please try ro replace the double quotes in this line of rule file with your keyboard:

if (switchPlan.contains(countScale.toString + ‘":’)) {

Then check what happens.

I have overtyped the " from the keyboard but same thing !?!?!

In the log should I get {“1”:{“key”:“17”,“value”:[0,0,… or {“1”:{“key”:“17”,“value”:"0,0,…?
because on the above examples the [ is replaced by a "

I even tried
if (switchPlan.contains(countScale.toString + ‘]:’)) {

but I get at that time only the first key.