Timeline picker to setup heating, light and so on

See the first post. Spezified is mo- fr and sa-su not mo-th. Alternative one can set each day allone.
.

Hi Chod,

for sure can I share my timeLinePicker settings.
I’m using it for heating function in my living area, bathrooms and office. Therefore I have four different Transferitems active.
I can show you an example of the livingroom.

my Groups:

Group gTimepicker
Group gTimepickerObserver

Items for TimePicker rule:

String TransferItem1 “[%s]” (gTimepicker)
String TransferItem2 “[%s]” (gTimepicker)
String TransferItem3 “[%s]” (gTimepicker)
String TransferItem4 “[%s]” (gTimepicker)

Items for TimePicker Livingarea:

//TimePicker Wohnbereich
Switch vUrlaubTP “Urlaubsmodus”
String vWohnbereichTP “Wohnbereich”
String vWohnbereichState
Number Temp_Wohnbereich_Kom “Komfort [%.1f °C]” <temperature_hot>
Number Temp_Wohnbereich_Spar “Standard [%.1f °C]”
Number Temp_Wohnbereich_Nacht “Nacht [%.1f °C]” <temperature_cold>

timeLinePicker.rules (config part only, nothing else was changed):

// -------------------- part of config -----------------------------------------------------------------------
val HashMap<String,ArrayList> timePicker = newHashMap(
“TransferItem1” → newArrayList(‘vWohnbereichState’),
“TransferItem2” → newArrayList(‘vBadEGState’),
“TransferItem3” → newArrayList(‘vBueroState’),
“TransferItem4” → newArrayList(‘vBadOGState’)
//“TransferItem2” → newArrayList(‘Thermostat1’,‘Thermostat2’)
)
// -------------------- end of config ------------------------------------------------------------------------

wohnbereichTimeLinePicker.rules:

rule “Heizung Wohnzimmer”
when
Item vWohnbereichState changed
then
var Number nacht = 0
var Number standard = 0
var Number komfort = 0
nacht=(Temp_Wohnbereich_Nacht.state as DecimalType)
standard=(Temp_Wohnbereich_Spar.state as DecimalType)
komfort=(Temp_Wohnbereich_Kom.state as DecimalType)
if (vUrlaubTP.state == OFF){
// deactivate all sprinckler zones
//switch ((vWohnbereichState.type).toString) {
switch (vWohnbereichState.state) {
case “Nacht” : {
// activate Nacht
logInfo(“Heizung Wohnbereich”,“Nachtmodus”)
HeizungWohnzimmerSetpoint.sendCommand(nacht.toString)
HeizungEsszimmer.sendCommand(nacht.toString)
HeizungKueche.sendCommand(nacht.toString)
}
case “Standard” : {
// activate Standard
logInfo(“Heizung Wohnbereich”,“Standardmodus”)
HeizungWohnzimmerSetpoint.sendCommand(standard.toString)
HeizungEsszimmer.sendCommand(standard.toString)
HeizungKueche.sendCommand(standard.toString)
}
case “Komfort” : {
// activate Komfort
logInfo(“Heizung Wohnbereich”,“Komfortmodus”)
HeizungWohnzimmerSetpoint.sendCommand(komfort.toString)
HeizungEsszimmer.sendCommand(komfort.toString)
HeizungKueche.sendCommand(komfort.toString)
}
}
}
else {
logInfo(“Heizung Wohnbereich”,“Urlaubsmodus”)
}
end

timeLinePicker.sitemap:

Frame label=“HeizplĂ€ne” {
Text item=vWohnbereichTP {
Frame label=“Heizung Wohnbereich” {
Setpoint item=Temp_Wohnbereich_Kom minValue=15 maxValue=28 step=0.5
Setpoint item=Temp_Wohnbereich_Spar minValue=15 maxValue=28 step=0.5
Setpoint item=Temp_Wohnbereich_Nacht minValue=15 maxValue=28 step=0.5
Switch item=vUrlaubTP
}
Frame label=“Time Picker Wohnbereich” {
Webview url=“http://192.168.x.xx:8080/static/time-line-picker/index.html?ip=192.168.x.xx:8080&transferItem=TransferItem1&states=Nacht,Standard,Komfort&yAxisLabel=1,2,3,4,5,6,7&event=no&dark=no” icon=“calendar” height=14
}
}

3 Likes

@tose thanks for this incredible feature

i have implemented it and it works as defined.

the configuration could be simplified.

i want to turn off at 8:00 AM (even it’s already turned OFF )and and turn on at 8:00 PM (even it’s already turned ON)

I would expect to make as below this but the event parameter restore the previous state correct me if am wrong

is it possible to implement it on this way?

@nakh_Home It’s nice to hear that you can use the widget.

Is it your intention that the device is turned ON at 8:00PM and additional you want to switch off manuell after this switch point ?
This use case is not possible. The base switch condition in the event configuration is OFF. So it’s possible to define inside a timerange the device is OFFand you can turn it ON. However if you define ON and you switched manuell to OFF, the device is automaticaly turned ON .

If I understand you correct, you only want switch points. Without restoreing the previous state.
Even if one toggled the state the timeline picker will switching at the next switch point.

I think this is possible but is it realy good? The most of time the state is undefined.

You have well understood me.

Instead of range, I prefer to program events at a specific time

Okay. I will need a little bit free time and i will look.
In this context i will also look to improve the administration of the widget.

Then there are three possibilities:

  1. static conditions
  2. static conditions witch additional event (but event means, manuell events)
  3. switch point conditions
1 Like

I guess you could have a virtual switch between the timeline switcher and the manual switch and give priority in your rule to implement this

I do understand the requested functionality from @nakh_Home, however I believe it should not be (directly) build into the timeline picker.
The present functionality does check every 15 minutes if the desired state is set and commands a change if not. Such periodic check isn’t needed in the desired functionality, a check for each stored switch time would be enough!
Using the timeline picker UI for setting these switch times creates a limitation, because actually a switch time is only possible every 15 minutes. Decreasing this time would increase the period checks for the present functionality.
To conclude, I would not put that functionality into this timeline picker. Such switch times could more easily be created by something like a “tasker” .

I have one question:

For what is “gTimepickerObserver” used? It is not in the documentation but in the items file and in the rules file. It looks like it has something to do with event parameter.

Yes, this group is for restoreing in the event mode. It is only nessessary to create this group in the item file, no further configuration. The intention is a secure state restoring after an reboot.

Edit: I’m looked at the code again. This Group is used to determine if an event for the cuurent item occured.

@tose

Timeline picker to setup heating, light and so on - #149 by tose

  1. static conditions
  2. static conditions witch additional event (but event means, manuell events)
  3. switch point conditions

i am quite struggling to update the rules in order to program events at a specific time.
Please could you guide me

@Chod, not sure to understand

I guess you could have a virtual switch between the timeline switcher and the manual switch and give priority in your rule to implement this

Please show me the webview url with all parameters.
You know, the rule is updated all 15 minutes?
You must wait a little bit after an update the timepline.

Thanks

Webview url="http://192.168.1.150:8080/static/time-line-picker/index.html?ip=192.168.1.150:8080&amp;transferItem=TransferItemDummyEvent&amp;yAxisLabel=7,1,2,3,4,5,6&amp;lang=en&amp;event=yes&amp;dark=yes" height=14

You know, the rule is updated all 15 minutes?

NP, ON, will turn on , OFF will turn OFF and manuel nothing

Many thanks to the OP author for sharing its work! I am using it and it works as expected in my local network: the only problem is that the widget does not appear through the openhab website
https://home.myopenhab.org
Is it a known limitation, or is there some setting that I have to set?

@Lionello_Marrelli Yes the limition is known. It’s the CORS policy of the browser.
There are middleware e.g. express server that works as middleware and can set the flag Access-Control-Allow-Origin. But i mean a additional server for remote access is too much. :face_with_raised_eyebrow:
A possible solution is a VPN- Connection. Then it will be working.

@nakh_Home The many amp; is only through copy&past? Correct, in the original sitemap is this wrong.

What is NP ?

Manuell means you can control the item and the scheduler will not updating the state at the next switch point (each 15min)

2 Likes

Not a problem :slight_smile:

Yes, it works with VPN.

I found one problem:

Frame label="heating Example" {
    Webview url="http://ip-addr-openHAB/static/time-line-picker/index.html?ip=xx.xx.xx.xx:8080&transferItem=TransferItem1&yAxisLabel=1,2,3,4,5,6,7" height=14
}

The IP-Address cannot be localhost if you use sitemap from a different computer. It must be the real IP-Address of the OH-Server. Looks like the js.scripts are running locally not on the OH-host.

It’s not a issue. The timelinepicker works with an Webview element, it is a separat page. This page is served from your OH server.
But the logic works as javascript on your local maschine. So it’s not possible to use localhost. You must specify the ip- address.

Hello @tose good afternoon,

Thank you for sharing your fantastic work. There are many use cases on my house that I can take advantage from this TimeLinePicker. It is really straightforward to put in operation and intergrates very well with the system.

Perfect!

Two questions please.

  1. Is it possible to set periods less than 15 minutes? Does it require alot of work to change?
  2. I would like to add a language to the switchPointSet.js file. Iam not used to deal with javascript but I decided to give it a shot. After editing the required part and loading the file it seems that the old file is mantained and not the new one.

Could you please give me a hand on these subjects?

Thank you in advanced fo your work.

Best regards.