Dear all
I’m using a KNX weather station for many different things, also as a time controller since it provides many functionalities out of the box. It provides time slots to steer different actions. Every time slot consists of a start time and an end time. Default values are set, e.g. start time = 20:15:00 and end time = 06:45:00.
Now I want to change that times via my sitemap with setpoint items. For that reason I have read this Link and tried to adjust it to my needs but I’m still struggeling to get it running.
My items:
DateTime Wochenschaltuhr_Zeitraum_24_ON "Wochenschaltuhr Zeitraum 24: ON [%1$tT]" <wetterstation> (gEMPTY) {knx="<10.001:7/0/92"} //KO 1303 //[10.001] 3 Byte
DateTime Wochenschaltuhr_Zeitraum_24_OFF "Wochenschaltuhr Zeitraum 24: OFF [%1$tT]" <wetterstation> (gEMPTY) {knx="<10.001:7/0/93"} //KO 1304 //[10.001] 3 Byte
Number TimeSlot24_Minutes "Verändere Zeit in Minuten"
String TimeSlot24_Time "Zeitslot 24 Zeitanzeige [%s]"
My rule
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
rule "Setpoint to change time for TimeSlot24"
when
Item TimeSlot24_Minutes received update
then
if(TimeSlot24_Minutes.state instanceof DecimalType) {
var int minutes = (TimeSlot24_Minutes.state as DecimalType).intValue
}
var DateTime Wochenschaltuhr_Zeitraum_24_ON = parse(now.getYear() + "-" + now.getMonthOfYear() + "-" + now.getDayOfMonth() + "T00:00")
// add the number of minutes selected
Wochenschaltuhr_Zeitraum_24_ON = Wochenschaltuhr_Zeitraum_24_ON.plusMinutes(minutes)
// update the alarm display time
Wochenschaltuhr_Zeitraum_24_ON.sendCommand(String::format("%02d:%02d", Wochenschaltuhr_Zeitraum_24_ON.getHourOfDay(), Wochenschaltuhr_Zeitraum_24_ON.getMinuteOfHour()))
end
My sitemap
Text item=Wochenschaltuhr_Zeitraum_24_ON
Setpoint item=TimeSlot24_Minutes minValue=0 maxValue=600 step=5
In my logfile I can see the following error when clicking on the setpoint button:
2016-12-25 18:23:19.345 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Setpoint to change time for TimeSlot24': The name '<XFeatureCallImplCustom>.plusMinutes(<XFeatureCallImplCustom>)' cannot be resolved to an item or type.
I don’t understand this error. What is wrong in my rule?
Another thing (assumption?):
When trying to change the item Wochenschaltuhr_Zeitraum_24_OFF via the KNX software (ETS4) I can see that the changed value looks like that:
2016-12-25 19:13:38 - Wochenschaltuhr_Zeitraum_24_OFF received command 1970-01-04T06:45:00
I assume now that my rule does not provide the correct format that has to be handed over to the binding.
Any ideas how I can get it running?
Thanks & regards
John