For a while, I get the following error message in my logs:
Error during the execution of rule Pool_Solar_Steuerung: org.eclipse.smarthome.core.library.types.DecimalType
After a while (a few hours), I don’t get MQTT values anymore - it seems, the steady error makes the system unstable.
I searched a lot and I know where the problem occurs, but don’t know how to handle it. Maybe someone can help me…
Here are the relevant items:
DateTime PoolTempLastUpdated "Letztes Update [%1$td.%1$tm.%1$ty, %1$tH:%1$tM:%1$tS]" <lastupdate>
String PoolSolarStatus "Status Pool-Sensoren [%s]" <status2> {mqtt="<[mqtt_broker:poolsolar/status:state:default]"}
Number PoolSolarTempSkimmer "Skimmer [%.1f °C]" <skimmer_temp> (gPoolSolar) {mqtt="<[mqtt_broker:poolsolar/temp_skimmer:state:default]"}
Number PoolSolarTempPumpe "Pumpe [%.1f °C]" <pump_temp> (gPoolSolar) {mqtt="<[mqtt_broker:poolsolar/temp_pumpe:state:default]"}
Number PoolSolarTempDach "Kollektor [%.1f °C]" <kollektor_temp> (gPoolSolar) {mqtt="<[mqtt_broker:poolsolar/temp_dach:state:default]"}
Number PoolSolarMode "Solar-Modus" <ac_mode>
Number PoolSolarRelais "Pool-Relais" {mqtt=">[mqtt_broker:poolsolar/relais:command:ON:1],>[mqtt_broker:poolsolar/relais:command:OFF:0]"}
String PoolSolarRelaisStatus "Solar-Relais ein? [%s]" <status>
Number PoolSolarTempDiff "Temperaturdifferenz [%.0f °C]" <temperature>
And here is the rule which throws the exception:
rule Pool_Solar_Steuerung
when
// Bei Betätigung des Schaltes oder jede Minute
Item PoolSolarMode received command or
Time cron "0 0/1 * * * ?"
then
// Durchschnitt aus Skimmer- und Pumpen-Temperatur berechnen
val Number PoolTempDS = ((PoolSolarTempSkimmer.state as DecimalType + PoolSolarTempPumpe.state as DecimalType)/2)
// Temperaturdiffernz von Dachtemperatur abziehen (für den einfacheren Vergleich)
val Number PoolTempDachDiff = (PoolSolarTempDach.state as DecimalType - PoolSolarTempDiff.state as DecimalType)
switch (PoolSolarMode.state)
{
// Wenn "AUTO" gewählt ist, dann abhängig von der Temperaturdifferenz schalten
case 2: if ( PoolTempDS < PoolTempDachDiff)
{
sendCommand(PoolSolarRelais, 1)
logInfo("RULE", "PoolSolarMode AUTO: ON (Pool=" + PoolTempDS +"°, Dach=" + PoolTempDachDiff + "°)")
} else
{
sendCommand(PoolSolarRelais, 0)
logInfo("RULE", "PoolSolarMode AUTO: OFF (Pool=" + PoolTempDS +"°, Dach=" + PoolTempDachDiff + "°)")
}
// "OFF" (manuell)
case 0: {
sendCommand(PoolSolarRelais, 0)
logInfo("RULE", "PoolSolarMode MANUAL: OFF")
}
// "ON" (manuell)
case 1: {
sendCommand(PoolSolarRelais, 1)
logInfo("RULE", "PoolSolarMode MANUAL: ON")
}
}
end
The error seems to happen here:
// Durchschnitt aus Skimmer- und Pumpen-Temperatur berechnen
val Number PoolTempDS = ((PoolSolarTempSkimmer.state as DecimalType + PoolSolarTempPumpe.state as DecimalType)/2)
// Temperaturdiffernz von Dachtemperatur abziehen (für den einfacheren Vergleich)
val Number PoolTempDachDiff = (PoolSolarTempDach.state as DecimalType - PoolSolarTempDiff.state as DecimalType)
Seems like a conversion problem between decimal and string, but all items I calculate with are defined as number and in the app or on the webinterface, they look like figures - I can even draw charts (which is only possible with numeric values).
The question is: Where is my mistake?
Thanks!