HABPanel widget: Virtual Thermostat/OnOff Appliance scheduling

Tags: #<Tag:0x00007f61710df3c0>

Great work!

I would like to use the “modified” widget from guiott, but somehow I didn’t get it to work as I want:

Topic 1

I tried to switch to german by modifing ohscheduler.js but this doesn’t change the language ?

Is there another way which I missed ?

Topic 2
There is only the button AGGIUNGI and not two, corresponding to ADD/DELETE

One Problem solved! I’ve to clear the browser cache :slight_smile:

now it looks fine:

Still missing the “button” for update/delete

any ideas, where to look ?

Hello everyone! For the past couple of months I had no spare time to continue the work on this widget or to assist those in need. Things will not change anytime soon, therefore you will have to rely on self study/trial and error.

@ All sorry for the delayed reply. I assume that most of you have already figured everything out until now.

@pmbsa The values appear in reverse because they are below the minimum value (18 if IIRC).

@Foxejoe The target temperature value will not change when the mode changes. The rule file initiates the target temperature (looks at the previous scheduled value) in the case it is not yet set. You have to change the rule in order to achieve what you desire. Look for “// [fail-safe] Init target temperature if not set” and change the condition in the if statement or add the below block after it (haven’t tested this, but it should work, unless there is something wrong in the syntax).

if (prevVal !== null && HVAC_Mode.state == 'AUTO') {
    logInfo('temperature-control.rules', 'Target temperature for item ' + targetItem.name + ' set to : ' + prevVal)

@MDAR The Modes switch allows you how to run the automation (e.g. use a schedule to control the temperature or when to start some appliance for a defined amount of time). What you want to achieve implies lots of changes in all the files (widget and rules) because you need a 3rd mode (currently this widget supports OnOff appliances and Thermostat schedules) that will allow you to set additional “variables” in your schedule item (e.g. something similar to OnOff mode, but with another option to set the intensity/color).

@tarabas the Update/Delete option appears when you edit items from your schedule (double click on the values from Zeitplan tab). For this you will need to first add something in the schedule.

PS1: haven’t tested this with OH 2.4, hence I cannot guarantee it will work without some code changes.

PS2: I have posted the code to GitHub, hoping there will be someone more experienced to continue the work on this widget.

1 Like

Hi -maybe somebody can help wih that:
Schedule is not working and there is erroe in log:
2019-03-17 21:40:00.353 [INFO ] [ome.model.script.onoff-control.rules] - OnOff Appliances control error: java.lang.ArrayIndexOutOfBoundsException: 1

Any Idea with this issue?

Just tested and it seems working like a charme …

Hello all, and THANK YOU @nepotu for developing this!

I feel like this could become something really important for the OH community(it certainly feels a void for me,I even considered nodeRED + bigtimer as i don’t use google calendar and hence caldav doesn’t suit me + well, google calendar is yet another cloud service).

I’ve installed your “widget” (it’s reductive to call it that, as there are so many components involved) and got it to work “as expected”(which is in and of itself testament to the quality of your work)

I am in the process of trying to adapt your “widget” to my needs, but i am nowehere near your level of understanding of programming, hence - I have a number of questions… and i guess some will feel funny to the more expert peeps amogst you.

-Items file: You have included["tags"] for each item, but they aren’t in the format used for alexa or google home integration. Are these tags there just as example or do they get used by some of the code i’m failing to locate (at the very least they aren’t mentioned in the rules)

-themes and colors some clever people like @guiott already had the knowledge needed to adapt the colors and themes, but I… well I’ve learned the little i know trying to use rules dsl for OH to do what i want it to do (so far with good success), while here we enter a space i’m not familiar with.
I’ve applied the Matrix Theme for HABPanel to my habpanel but your scheduler doesn’t fall in line with the rest.
Could you jot down a quick guide in regards to how to modify colors?
OR/AND Could you point me towards what resources to study in order to gain the knowledge needed to make those changes, so that maybe contribute in some way…

-VS ide with OH extension installed points to quite a high number of problems in the rules i copypasted from your github project, but then OH is able to refresh them and they work just fine.
So far i’ve made a point of not having one problem in my rules…
I’m guessing that is because you are using syntax coming from Java and not strictly xtend - is that it? or is the language service just not advanced enough for such advanced code and instead meant for beginners like myself?

Lastly, i wish this project would become a staple of OH, i feel it certainly deserves attention.
thanks again!

I have installed the software as instructed in the original post/GitHub site. Installing the files into the html, items, and rules directories.

I also installed JSONPath Transformation (using PaperUI interface).

Contents of items/OHScheduler.items:

// These are unchanged from original file
Group       grpTemp
Group       grpTargetTemp
String      HVAC_Mode              "HVAC Mode [%s]"                       <switch>                              ["HVACMode"]
String      HVAC_Schedule          "HVAC Schedule [%s]"                   <calendar>                            ["HVACSchedule"]
String      HVAC_Queue             "HVAC Queue [%s]"                                                            ["HVACQueue"]            
DateTime    HVAC_Next_Change_Time  "HVAC Next Change Time [%1$ta %1$tR]"  <calendar>                            ["HVACNextChange"]

// These items I added, because the lines are so long, I removed most of the channel details
Number      HVAC_SetpointHeating_Temp         "Setpoint Heating Temp [%.0f °F]"            <temperature> (grpTemp)               ["SPHeatTemp"]        {channel="zwave:device:..."}
Number      HVAC_SetpointHeating_Target_Temp  "Setpoint Heating Target Temp [%.0f °F]"     <temperature> (grpTemp,grpTargetTemp) ["SPHeatTargetTemp"]  {channel="zwave:device:..."}
Number      HVAC_SetpointCooling_Temp         "Setpoint Cooling Temp [%.0f °F]"            <temperature> (grpTemp)               ["SPCoolTemp"]        {channel="zwave:device:..."}
Number      HVAC_SetpointCooling_Target_Temp  "Setpoint Cooling Target Temp [%.0f °F]"     <temperature> (grpTemp,grpTargetTemp) ["SPCoolTargetTemp"]  {channel="zwave:device:..."}

Then I installed the widget on a HABPanel dashboard.

What works:

  • When I set manually set the temperature I want, ex: 77 degrees F, using the widget knob, the temperature on my thermostat changes.

What does not work:

  • When I set the schedule to change the temperature, ex: at 1200 change temp to 70 degrees F. At 1200 the knob says “Set to 70 F” but there is no change to the actualy temperature settings.

My only clue is in the event logs, which says the following.

Manually changing the temperature (works).

[ome.event.ItemCommandEvent] - Item 'HVAC_SetpointHeating_Target_Temp' received command 77
[nt.ItemStatePredictedEvent] - HVAC_SetpointHeating_Target_Temp predicted to become 77
[vent.ItemStateChangedEvent] - HVAC_SetpointHeating_Target_Temp changed from 67 to 77

Setting a schedule to change the temperature. First three lines are setting the temperature at a time X. Then time X is reached, I’ve added a comment. And the temperature is suppose to change. If it matters, the Mode is set to “Heat”.

[ome.event.ItemCommandEvent] - Item 'HVAC_Schedule' received command {"HVAC_SetpointHeating_Target_Temp":{"D5":{"T0955":70}}}
[vent.ItemStateChangedEvent] - HVAC_Schedule changed from NULL to {"HVAC_SetpointHeating_Target_Temp":{"D5":{"T0955":70}}}
[vent.ItemStateChangedEvent] - HVAC_Next_Change_Time changed from NULL to 2019-07-05T09:55:00.000-0500
// --Time X occurs here--
[vent.ItemStateChangedEvent] - HVAC_Queue changed from NULL to HVAC_SetpointHeating_Target_Temp=70
[vent.ItemStateChangedEvent] - HVAC_SetpointHeating_Target_Temp changed from 77 to 70
[vent.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_SetpointHeating_Target_Temp=70 to 
[vent.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_SetpointHeating_Target_Temp=70
[vent.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_SetpointHeating_Target_Temp=70 to 
[vent.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_SetpointHeating_Target_Temp=70
[vent.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_SetpointHeating_Target_Temp=70 to 

What I notice is that the HVAC_Queue is not correctly being set. I feel there should be something after the “to”.

Can someone help point out what is happening? And why the scheduler does not change the target temperature correctly?

Is there is a way to debug the rules file (by dumping more output to the logs)?

Edit: version of Openhab2 is 2.4.0

Solved - The problem was in the rules. The code that Geo @nepotu generously shared with us uses postUpdate() to change the temperature. I hacked the rules to use sendCommand(). I suspect this is a function of my Z-wave thermostat and how to control it. Additionally, I only have two items now: a heating and cooling setpoint. I no longer have both a ‘temperature’ and a ‘target temperature’.


Hi All

Ive configured as per the instructions but get nothing in my widget. CSS is set right, JSON path there. Rules/items are set, curly braces removed and values set to the items but nothing :frowning:

Any thoughts as to why this is so?

Console shows this:

Source map error: request failed with status 404
Resource URL:
Source Map URL: vis.map

Hello Ender, I have same problem with my devices. Are different (from Eq-3 Max), but I think the cause is identical and they needs a sendCommand() instead a postUpdate()
I’m not able with coding, so I don’t understand where and how change it.
Can you please share with us the hack you do it to the rules file?
Thank you Ender

PS: thanks also to Geo for this project!

Stefan, In the end I wound up not using this project as I could not get a stable outcome for my HVAC system. But here is the change I made

File: rules/OHSchedulerHVAC.rules, line 207

-                                targetItem.postUpdate(DecimalType.valueOf(itemsTempArray.get(j.intValue()).split('=').get(1)))
+                                targetItem.sendCommand(DecimalType.valueOf(itemsTempArray.get(j.intValue()).split('=').get(1)))

Or if you want a patch file: changetosendCommand_patch.txt (968 Bytes)

Apply the patch with:

# change directory to where your rules directory is located, e.g. /etc/openhab2/
patch --verbose -p 1 < changetosendCommand_patch.txt
1 Like

Thank You Ender.

Hi @bulletprooffool did you fix the IPhone delete bug?

Hi. I gave up on this in the end.
Simplified my HVAC schedulng to just 5 time frames:

HOME 7am - 7pm
HOME 7pm - 10pm
HOME 10pm to 7am

My schedules had been pretty much the same as this and I didn’t need more granular scheduling.

Fair enough, but how did you fix the delete bug?

I’m going to try and get someone to fix it if I cant :slight_smile: This is an awesome piece of work, it would be a shame to not get it fully functioning for everyone. Ill share what i find

1 Like

Can anyone tell me if every minute, once a schedule is set, is it meant to keep changing the thermostat?

The set point item is set correctly. Whilst I know the rule runs every minute, if the Queue is empty, why would it keep running if the set point has been set? Is this because at the end of the schedule you need to know when to delete it and without running it frequently, youll go pass the end of the schedule?

[{"setItem":"HVAC_Bed1_Target_Temp","readItem":"HVAC_Bed1_Temp","label":"Bed 1"},{"setItem":"HVAC_Bed2_Target_Temp","readItem":"HVAC_Bed2_Temp","label":"Bed 2"},{"setItem":"HVAC_Bed3_Target_Temp","readItem":"HVAC_Bed3_Temp","label":"Bed 3"}]

When I set the schedule:

08:13:53.877 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'HVAC_Schedule' received command {"HVAC_Bed2_Target_Temp":{"D1":{"T0815":18},"D4":{},"D7":{}},"HVAC_Bed3_Target_Temp":{"D1":{},"D2":{},"D5":{},"D7":{}}}
08:13:53.881 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Schedule changed from {"HVAC_Bed1__Target_Temp":{"D4":{}},"HVAC_Bed2_Target_Temp":{"D1":{},"D4":{},"D7":{}},"HVAC_Bed3_Target_Temp":{"D1":{},"D2":{},"D5":{},"D7":{}}} to {"HVAC_Bed2_Target_Temp":{"D1":{"T0815":18},"D4":{},"D7":{}},"HVAC_Bed3_Target_Temp":{"D1":{},"D2":{},"D5":{},"D7":{}}}
08:13:53.892 [INFO ] [odel.script.temperature-control.rules] - [HEAT] Next change @2019-09-16T08:15:00.000+10:00 | Changes : HVAC_Bed2_Target_Temp=18
08:13:53.894 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Next_Change_Time changed

Then it runs as per schedule:

08:15:00.003 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_Bed2_Target_Temp=18
08:15:00.006 [INFO ] [odel.script.temperature-control.rules] - Target temperature for item HVAC_Bed2_Target_Temp changed from 24.00 to 18
08:15:00.023 [INFO ] [odel.script.temperature-control.rules] - Target Temperature Queue cleaned up
08:15:00.025 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'HVAC_Bed2_Target_Temp' received command 18
08:15:00.026 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Bed2_Target_Temp changed from 24.00 to 18
08:15:00.033 [INFO ] [odel.script.temperature-control.rules] - [HEAT] Next change @2019-09-16T08:15:00.000+10:00 | Changes : HVAC_Bed2_Target_Temp=18
08:15:00.039 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_Bed2_Target_Temp=18 to
08:15:00.042 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_Bed2_Target_Temp=18
08:15:00.043 [INFO ] [odel.script.temperature-control.rules] - Target temperature for item HVAC_Bed2_Target_Temp changed from 18 to 18
08:15:00.045 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'HVAC_Bed2_Target_Temp' received command 18
08:15:00.056 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_Bed2_Target_Temp=18 to
08:15:00.055 [INFO ] [odel.script.temperature-control.rules] - Target Temperature Queue cleaned up

Then every minute after

08:16:00.014 [INFO ] [odel.script.temperature-control.rules] - [HEAT] Next change @2019-09-16T08:15:00.000+10:00 | Changes : HVAC_Bed2_Target_Temp=18
08:16:00.017 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_Bed2_Target_Temp=18
08:16:00.019 [INFO ] [odel.script.temperature-control.rules] - Target temperature for item HVAC_Bed2_Target_Temp changed from 18.00 to 18
08:16:00.020 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'HVAC_Bed2_Target_Temp' received command 18
08:16:00.023 [INFO ] [odel.script.temperature-control.rules] - Target Temperature Queue cleaned up
08:16:00.023 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_Bed2_Target_Temp=18 to**strong text**
08:17:00.014 [INFO ] [odel.script.temperature-control.rules] - [HEAT] Next change @2019-09-16T08:15:00.000+10:00 | Changes : HVAC_Bed2_Target_Temp=18
08:17:00.020 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_Bed2_Target_Temp=18
08:17:00.021 [INFO ] [odel.script.temperature-control.rules] - Target temperature for item HVAC_Bed2_Target_Temp changed from 18.00 to 18
08:17:00.023 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'HVAC_Bed2_Target_Temp' received command 18
08:17:00.024 [INFO ] [odel.script.temperature-control.rules] - Target Temperature Queue cleaned up
08:17:00.025 [INFO ] [smarthome.event.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_Bed2_Target_Temp=18 to

Is this normal?

Hi all,

thanks for the great Widget. Ist work fine for me if i want Change the temperature in the Manual Mode.

But i have Problems with the Schedule.

The Schedule is active if i Change the Mode on Auto.
The Temperature goes to the right value from the Schedule.
But 30 seconds later, the Mode Change to manuel and the Temerature Change to the last manuel Value.

I use the AVM Fritz! Binding (Link )

Temperature read, no problem.
Temperature write, with the manuel Temerature Channel ID. Works fine with manuel Mode.

But i have also channel IDs for Temperature and Datetime for the next Change. But this i cant use in the Widget. Allways i send the Temperatur i Change the Mode to manuel.

I think i can only use the Widget in manuel Mode because i need more items and other rules for the AVM Bindung?
Or where is my fault?

the log:

2019-09-28 20:59:28.551 [ome.event.ItemCommandEvent] - Item 'HVAC_Mode' received command AUTO

2019-09-28 20:59:28.572 [nt.ItemStatePredictedEvent] - HVAC_Mode predicted to become AUTO

2019-09-28 20:59:28.590 [vent.ItemStateChangedEvent] - HVAC_Mode changed from MANUAL to AUTO

2019-09-28 20:59:28.624 [ome.event.ItemCommandEvent] - Item 'HVAC_Mode' received command AUTO

2019-09-28 20:59:28.648 [nt.ItemStatePredictedEvent] - HVAC_Mode predicted to become AUTO

==> /var/log/openhab2/openhab.log <==

2019-09-28 20:59:28.965 [INFO ] [del.script.temperature-control.rules] - [AUTO] Next change @2019-09-28T10:00:00.000+02:00 | Changes : HVAC_LR_Target_Temp=21.5

==> /var/log/openhab2/events.log <==

2019-09-28 20:59:28.988 [vent.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_LR_Target_Temp=21.5

==> /var/log/openhab2/openhab.log <==

2019-09-28 20:59:29.048 [INFO ] [del.script.temperature-control.rules] - Target temperature for item HVAC_LR_Target_Temp changed from 14.5 to 21.5

==> /var/log/openhab2/events.log <==

2019-09-28 20:59:29.062 [vent.ItemStateChangedEvent] - HVAC_LR_Target_Temp changed from 14.5 to 21.5

==> /var/log/openhab2/openhab.log <==

2019-09-28 20:59:29.071 [INFO ] [del.script.temperature-control.rules] - Target Temperature Queue cleaned up

==> /var/log/openhab2/events.log <==

2019-09-28 20:59:29.076 [vent.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_LR_Target_Temp=21.5 to 

2019-09-28 20:59:38.496 [vent.ItemStateChangedEvent] - HVAC_Mode changed from AUTO to MANUAL

2019-09-28 20:59:38.507 [ome.event.ItemCommandEvent] - Item 'HVAC_Mode' received command MANUAL

2019-09-28 20:59:38.522 [vent.ItemStateChangedEvent] - HVAC_LR_Target_Temp changed from 21.5 to 14.5

2019-09-28 20:59:38.531 [nt.ItemStatePredictedEvent] - HVAC_Mode predicted to become MANUAL

I have combine the “HVAC_Mode” withe the mode channel of the binding. This is the reason why the mode change in the widget.
But i have still the same problem.


2019-09-28 22:28:00.320 [INFO ] [del.script.temperature-control.rules] - [AUTO] Next change @2019-09-28T10:00:00.000+02:00 | Changes : HVAC_LR_Target_Temp=21.5

==> /var/log/openhab2/events.log <==

2019-09-28 22:28:00.340 [vent.ItemStateChangedEvent] - HVAC_Queue changed from  to HVAC_LR_Target_Temp=21.5

==> /var/log/openhab2/openhab.log <==

2019-09-28 22:28:00.372 [INFO ] [del.script.temperature-control.rules] - Target temperature for item HVAC_LR_Target_Temp changed from 11.0 to 21.5

2019-09-28 22:28:00.386 [vent.ItemStateChangedEvent] - HVAC_LR_Target_Temp changed from 11.0 to 21.5

2019-09-28 22:28:00.390 [INFO ] [del.script.temperature-control.rules] - Target Temperature Queue cleaned up

2019-09-28 22:28:00.400 [vent.ItemStateChangedEvent] - HVAC_Queue changed from HVAC_LR_Target_Temp=21.5 to 

2019-09-28 22:28:09.482 [vent.ItemStateChangedEvent] - HVAC_LR_Target_Temp changed from 21.5 to 11.0

I dont understand why i have the last log entry. From where i get a changed of the set temperature?

I Had the same problem with the Code. I Changes the Line from Update to sendcommand.
Now it works.

Hi neputo,

Great work, thank you very much for the scheduler. It’s very usefull and i integrated it into the matrix-theme for my habpanels.
There is a little problem i cant solve. I set the step value to 0.5°C. When I load the page and the room has a temperature of e.g. 21.7 °C then 21.7 is shown in the middle of the knob. Whenever there is a change to the value, e.g. from 21.7 to 21.8 the knob is rounding up (or down) to 22.0 (which is the normal behaviour of the knob when step is 0.5). I guess it has something to do with the vm._updateKnobValue() and a different approach when initialising all the values. I would prefer to have the exact value in first place even after a value change, but I am not very familiar with javascript. Maybe you or someone could have a look at that?!?


hi, can you please explain this to me as i am new, i have done all the steps but i was not sure what to do or where to put the image files??! i am trying to control my light with habpanel with diffrent time and day using virtual widget, the github instructions not clear enough to me. my widget is available but no image