[SOLVED] String update through rules

I’m using (since a while now) a rule to control our HVAC.
In this rule, i’m using House_Mode to check what must done (home, away, holiday…).
When I now set these values through the sitemap, it works great.

I now just introduce an automaticlly update through a rule (triggerd by a switch).
This works (for lights, audio…), and I see in my logs that the status is updated.
But my HVAC rule doesn’t notice the changes.
Any idea what I’m doing wrong?

hvac.items

String  Heating_Mode                    "Globale HVAC Mode [%s]"

hvac.sitemap

Selection item=Heating_Mode label="Modus []" icon="temperature" mappings=[
   Uit="Uit",
   Werk="Werk",
   Afwezig="Afwezig",
   Verlof="Verlof"
   ]

Part of HVAC.rule (working with sitemap)

   ...
    else if (Heating_Mode.state.toString == "Werk") {
   ...

The rule that update the Heating_Mode, but the rule above doesn’t take it into account?

   when
      Item GebouwVerlaten received update                                                                                                                                                      
   then                                                                                                                                                                                             
      logInfo("SCENARIO", "Gebouw wordt verlaten")                                                                                                                                             
      sendCommand(Sonos_Controller, PAUSE)                                                                                                                                                     
      sendCommand(TeRuMan, OFF)                                                                                                                                                                
      Heating_Mode.postUpdate("Afwezig") 

Hi, @brononius, instead of posting a state update to your Heating_Mode item, use sendCommand():

Sonos_Controller.sendCommand(PAUSE)                                                                                                                                                     
TeRuMan.sendCommand(OFF)                                                                                                                                                                
Heating_Mode.sendCommand("Afwezig")

Also, use the sendCommand() method rather than the global function in the other lines, assuming Sonos_Controller and TeRuMan are items.

1 Like

I had this one before, but was the same result.
Maybe I made a typo then, will try it again…

Same result. But maybe a stranger finding?
‘UIT’ and ‘work’ looks like working. But ‘Afwezig’ not?

A bit more details about the rule:

when
        Item SCH_BURO1_TEMP changed
then

  if (Heating_Mode.state.toString == "Uit") { //Zorgt ervoor dat alles UIT (en UIT) is
                logInfo("HVAC_Bureel", "Geen verdere actie, de HVAC-Modus is: " + Heating_Mode.state + ".")
                }                                                                                                                                                                                        
        else if (Heating_Mode.state.toString == "Werk") {                                                                                                                                                
                if ((((Bureau_TargetTemp.state as DecimalType))>(SCH_BURO1_TEMP.state as DecimalType)+1) && (Temperature.state < 20)) {                                                                  
                        //De echte temperatuur is lager dan de gewenste, en buiten is het kouder dan 20 graden, dus verwarming aan.                                                                      
                        logInfo("HVAC_Bureel", "Verwarming aan, de HVAC-Modus is: " + Heating_Mode.state + ".")                                                                                          
                        logInfo("HVAC_Bureel", "De temperatuur is lager dan gewenst [" + SCH_BURO1_TEMP.state + " < " + Bureau_TargetTemp.state as DecimalType +"]")                                     
                        HVAC_BureelVerwarming.sendCommand(ON)                                                                                                                                            
                        logInfo("HVAC_Bureel", "De verwarming is opgezet naar " + Bureau_TargetTemp.state)                                                                                               
                        }                                                                                                                                                                                
                if ((SCH_BURO1_TEMP.state as DecimalType).floatValue > ((Bureau_TargetTemp.state as DecimalType).floatValue - 0.3) &&                                                                    
                   (SCH_BURO1_TEMP.state as DecimalType).floatValue < ((Bureau_TargetTemp.state as DecimalType).floatValue + 0.3)) {                                                                     
                        logInfo("HVAC_Bureel", "Verwarming en arico uit, de HVAC-Modus is: " + Heating_Mode.state + ".")                                                                                 
                        logInfo("HVAC_Bureel", "Gewenste temperatuur is bereikt [" + SCH_BURO1_TEMP.state + " ~ " + Bureau_TargetTemp.state as DecimalType +"]")                                         
                        sendCommand( HVAC_BureelVerwarming, OFF )                                                                                                                                        
                        sendCommand( HVAC_BureelKoeling, OFF)                                                                                                                                            
                        logInfo("HVAC_Bureel", "De verwarming & Airco zijn uitgezet")                                                                                                                    
                        }                                                                                                                                                                                
                if ((((SCH_BURO1_TEMP.state as DecimalType))>(Bureau_TargetTemp.state as DecimalType)+1) && (Temperature.state > 20)) {                                                                  
                        logInfo("HVAC_Bureel", "Airco aan, de HVAC-Modus is: " + Heating_Mode.state + ".")                                                                                               
                        logInfo("HVAC_Bureel", "De temperatuur is hoger dan gewenst [" + SCH_BURO1_TEMP.state + " > " + Bureau_TargetTemp.state as DecimalType +"]")                                     
                        HVAC_BureelKoeling.sendCommand(ON)                                                                                                                                               
                        logInfo("HVAC_Bureel", "De Airco is aangezet naar " + Bureau_TargetTemp.state)                                                                                                   
                        }                                                                                                                                                                                
                }                                                                                                                                                      
        else if (Heating_Mode.state.toString == "Afwezig") {    

Hmmm, very strange.
The rule is taken into account after about 6 hours?
Nothing changes on ‘human’ side.

No idea why, so guess something else will cause the error… :blush:

I run in parallel a test script with logs, and seems that the error is somewhere else.
Nothing to do with the update from a rule… :blush:

Glad to hear you’ve made some progress in tracking down the source of your problem, Ben. If you need more assistance, don’t hesitate to ask for more help here. Please do post your findings when you have found and fixed the problem so someone else with a similar problem can learn from your experience.