I often get the following error:
Error during the execution of rule 'Get Bee_Sensors': An error occurred during the script execution: Java heap space
Does anyone have any idea what the problem might be with this rule?
rule "Get Bee_Sensors"
when
Time cron "*/1 * * * * ?"
then
var response = sendHttpGetRequest(strUrlGateway + 'sensors/', 800)
var String str_state1
var String str_lastupdated
var DateTime date_lastupdated
if (response !== null) {
/* ----------------------------------Bee_Sensor_HueTap------------------------------------ */
str_state1 = transform('JSONPATH', '$.' + iBee_Sensor_HueTap + '.state.buttonevent', response)
str_lastupdated = transform('JSONPATH', '$.' + iBee_Sensor_HueTap + '.state.lastupdated', response)
// Init-Value
if (Bee_Sensor_HueTap_Last.state == null) { Bee_Sensor_HueTap_Last.sendCommand(now.toString) }
// nur, wenn Einlesen der Zeit möglich ist
if (str_lastupdated !== null) {
date_lastupdated = new DateTime(str_lastupdated, DateTimeZone.UTC);
date_lastupdated = date_lastupdated.toDateTime(DateTimeZone.forID("Europe/Berlin"))
// nur innerhalb eines Zeitfensters von 15 Sekunden und muss ungleich der Zeit des letzten Tastendrucks sein
if (date_lastupdated.isAfter(now.minusSeconds(15)) && date_lastupdated.isBefore(now) &&
(new DateTime((Bee_Sensor_HueTap_Last.state as DateTimeType).getZonedDateTime.toEpochSecond * 1000) != date_lastupdated)) {
Bee_Sensor_HueTap.sendCommand(str_state1)
Bee_Sensor_HueTap_Last.sendCommand(date_lastupdated.toString)
}
}
/* --------------------------------------------------------------------------------------- */
/* -----------------------------Bee_Sensor_HueMotionLightLevel---------------------------- */
str_state1 = transform('JSONPATH', '$.' + iBee_Sensor_HueMotionLightLevel + '.state.daylight', response)
str_lastupdated = transform('JSONPATH', '$.' + iBee_Sensor_HueMotionLightLevel + '.state.lastupdated', response)
// Init-Value
if (Bee_Sensor_HueMotionLightLevel_Last.state == null) { Bee_Sensor_HueMotionLightLevel_Last.sendCommand(now.toString) }
// nur, wenn Einlesen der Zeit möglich ist
if (str_lastupdated !== null) {
date_lastupdated = new DateTime(str_lastupdated, DateTimeZone.UTC);
date_lastupdated = date_lastupdated.toDateTime(DateTimeZone.forID("Europe/Berlin"))
// nur innerhalb eines Zeitfensters von 15 Sekunden und muss ungleich der Zeit des letzten Tastendrucks sein
if (date_lastupdated.isAfter(now.minusSeconds(15)) && date_lastupdated.isBefore(now) &&
(new DateTime((Bee_Sensor_HueMotionLightLevel_Last.state as DateTimeType).getZonedDateTime.toEpochSecond * 1000) != date_lastupdated)) {
if ((str_state1 == "true") && (Bee_Sensor_HueMotionLightLevel.state != ON)) {
Bee_Sensor_HueMotionLightLevel.sendCommand(ON)
} else if ((str_state1 == "false") && (Bee_Sensor_HueMotionLightLevel.state != OFF)) {
Bee_Sensor_HueMotionLightLevel.sendCommand(OFF)
}
Bee_Sensor_HueMotionLightLevel_Last.sendCommand(date_lastupdated.toString)
}
}
/* --------------------------------------------------------------------------------------- */
/* ------------------------------Bee_Sensor_HueMotionPresence----------------------------- */
str_state1 = transform('JSONPATH', '$.' + iBee_Sensor_HueMotionPresence + '.state.presence', response)
str_lastupdated = transform('JSONPATH', '$.' + iBee_Sensor_HueMotionPresence + '.state.lastupdated', response)
// Init-Value
if (Bee_Sensor_HueMotionPresence_Last.state == null) { Bee_Sensor_HueMotionPresence_Last.sendCommand(now.toString) }
// nur, wenn Einlesen der Zeit möglich ist
if (str_lastupdated !== null) {
date_lastupdated = new DateTime(str_lastupdated, DateTimeZone.UTC);
date_lastupdated = date_lastupdated.toDateTime(DateTimeZone.forID("Europe/Berlin"))
// nur innerhalb eines Zeitfensters von 15 Sekunden und muss ungleich der Zeit des letzten Tastendrucks sein
if (date_lastupdated.isAfter(now.minusSeconds(15)) && date_lastupdated.isBefore(now) &&
(new DateTime((Bee_Sensor_HueMotionPresence_Last.state as DateTimeType).getZonedDateTime.toEpochSecond * 1000) != date_lastupdated)) {
if ((str_state1 == "true") && (Bee_Sensor_HueMotionPresence.state != ON)) {
Bee_Sensor_HueMotionPresence.sendCommand(ON)
} else if ((str_state1 == "false") && (Bee_Sensor_HueMotionPresence.state != OFF)) {
Bee_Sensor_HueMotionPresence.sendCommand(OFF)
}
Bee_Sensor_HueMotionPresence_Last.sendCommand(date_lastupdated.toString)
}
}
/* --------------------------------------------------------------------------------------- */
}
end