Help for "simple" rule

Hello Guys…
When my rule executes, i get following error in the OpenHab.log:

[ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Varme Soveværelse': The argument 'command' must not be null or empty.

The rule is as follows - but i can’t figure out what’s wrong?

rule "Varme Soveværelse"
	when
		Item Temp_Bedroom received update
	then
		if (Temp_Bedroom.state <= Heating_Stop.state as DecimalType &&
			Temp_Bedroom.state < (Temp_Bedroom_SP.state as DecimalType + 3.0)
		)
		{
			if (Temp_Bedroom.state < Temp_Bedroom_SP.state as DecimalType)
			{
			sendCommand(Heating_Bedroom, 100)		
			logInfo("Soveværelse", "Sætter varme ventil til 100%")
			}
			else {
				sendCommand(Heating_Bedroom, OFF_Heating_Bedroom_SP.state.toString)
				logInfo("Soveværelse", "Sætter varme ventil til OFF værdi")
			}
			}
		else {
		sendCommand(Heating_Bedroom, 0)
		logInfo("Soveværelse", "Sætter varme ventil til 0%")
		}		
end		

Could be that he doesn’t like 0 in the last sendCommand, try 1 and see if that fixes it.

Hi,

I can not see the problem - but I’ve some recommendations: Do use the designer to write your rules; has it has some nice features to detect problems like typos in item names and such.

Next I recommend to add some more info log messages to find the point where the execution of the rules stops.

Do you use OH 1, or 2? as it is also possible to read item states and test some things via console.

To analyze it may make sense to store the values to a var first; log it and then perform the operation to check if it looks as you expect.

For example

sendCommand(Heating_Bedroom, OFF_Heating_Bedroom_SP.state.toString

would change to something like:

// ...
var bedroomOffState =  OFF_Heating_Bedroom_SP.state.toString
logInfo("<your logger>", "Update state to: " + bedroomOffState
Heating_Bedroom.sendCommand(bedroomOffState)
// ...

not a solution - I know but maybe help to find the problem.
with kind regards,
Patrik

I use the OH designer, and uses OH2… The designer doesn’t ay any faults at all…

The change from 0 to 1 doesn’t do anything,

Seems like OH is missing a command somewhere - i really can’t see where

Yes, but as it seems now, the rule doesn’t even execute since it fails - nothing is written in my log… :frowning:

Tested with some even simpler - same result:

rule "Varme Soveværelse"
	when
		Item Temp_Bedroom received update
	then
	
	if (Temp_Bedroom.state <= Temp_Bedroom_SP.state as DecimalType)
		sendCommand(Heating_Bedroom, 100)
		
		else
		sendCommand(Heating_Bedroom, 0)

Found the solution, the “Heating_Bedroom” was set as a switch - changed to number, now it works :slight_smile: