Problems with rules

rules
comfoair
oh23
Tags: #<Tag:0x00007fe052b51eb0> #<Tag:0x00007fe052b51d20> #<Tag:0x00007fe052b51398>

(Paweł S) #1

*Hi I have probles with rule which has the task of starting the recuperator’s run.The course is to change from time and humidity.
I have info in log :``2018-12-02 20:04:46.864 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Wilgotnosc & predkosc’: An error occurred during the script execution: Couldn’t invoke ‘assignValueTo’ for feature JvmVoid: (eProxyURI: predkosc.rules#|::0.2.2.2.0.0.1.0.0::0::/1) I do not know why.
My rule

import java.lang.Math
var boolean autoChangeInProgress = false

rule "Reczna interwencja"
when
    Item Lueftung_Fan_Level changed
then

    if( autoChangeInProgress ){

        autoChangeInProgress = false
    }
    else{

        postUpdate(Lueftung_Auto_Mode,0)
    }
end



rule "Predkosc"

when
    Item Lueftung_Auto_Mode changed
    or
    Time cron "0 0/1 * * * ?"
then
    if( (Lueftung_Auto_Mode.state as DecimalType) == 1 ){

        var Number day    = now.getDayOfWeek
        var Number hour   = now.getHourOfDay
        var Number minute = now.getMinuteOfHour

        var boolean isNight = false

        // Freitag
        if( day == 5 ){
            if( hour < 7 || (hour >= 23 && minute >=30) ) isNight = true
        }
        // Samstag
        else if( day == 6 ){
            if( hour < 9 || (hour >= 23 && minute >=30) ) isNight = true
        }
        // Sonntag
        else if( day == 7 ){
            if( hour < 9 || (hour >= 22 && minute >=30) || hour >= 23 ) isNight = true
        }
        else{

            if( hour < 7 || (hour >= 22 && minute >=30) || hour >= 23 ) isNight = true
        }

        var Number currentLevel = (Lueftung_Fan_Level.state as DecimalType)
        var Number newLevel = 2
        // roznica temperatur
        if( !isNight ){

            var Number raumTemperatur = (Lueftung_Ablufttemperatur.state as DecimalType)
            var Number aussenTemperatur = (Lueftung_Aussenlufttemperatur.state as DecimalType)
            var Number zielTemperatur = (Lueftung_Komfortemperatur.state as DecimalType)

            if(
                raumTemperatur >= zielTemperatur
                &&
                aussenTemperatur >= raumTemperatur
            ){

                newLevel = 1
            }
            else if(
                raumTemperatur >= zielTemperatur - 1
                &&
                aussenTemperatur >= raumTemperatur - 1
                &&
                currentLevel == 1
            ){

                newLevel = 1
            }
        }
        if( newLevel != currentLevel ){

            autoChangeInProgress=true
            sendCommand(Lueftung_Fan_Level,newLevel)
        }
    }
end

rule "Wilgotnosc & predkosc"
when
    Item wilg_lazienka changed
    or
    Item Lueftung_Fan_Level changed
then
  if ((wilg_lazienka.state > 70)) {
    Override = false

    sendCommand(Lueftung_Fan_Level, 3)
  }
  else if (((Override == false) && (wilg_lazienka.state < 58))) {
    sendCommand(Lueftung_Fan_Level, 1)
  }
  endyour code goes here

(Vincent Regaud) #2

Could you review you post with the correct codes fences
And explain what the rules are trying to achieve
Post the relevamt items too, please:
See: #5, #7, #8, #10 in:


(Rossko57) #3

That doesn’t seem to be declared anywhere


(Paweł S) #4

ok, thanks
This is it.