(Check) Rule transition help

if your Goal is to have as few lines and characters as possible:

rule	"Fibaro Button 01 Pushing"
when
	Item FibBut01_Scene received update
then
	var Number dimValue = 0
	switch (FibBut01_Scene.state) {
		case 1.0:	dimValue = 0
		case 1.1:	dimValue = 10
		case 1.2:	dimValue = 50
		case 1.3:	dimValue = 100
		case 1.4:	dimValue = 3
		case 1.5:	dimValue = 2
		case 1.6:	dimValue = 1
		default:	logInfo("FB01", "FB01 State is: " + FibBut01_Scene.state)
	}
	WDim01_Dim.sendCommand(dimValue)
end

of course you could shorten dimValue to dV and get rid of the case 1.0, since dimValue has already the default value of 0…

hint:
default: will only trigger, if no other case is met before. So, if you have some state the FibBut01_Scene item can have despite 1.0 til 1.6 only then there’s a log entry. So, especially after startup (UNDEF), the sendCommand will be 0 in my example, as no case is met and within default you only generate the log entry.

If you’d like to have as little Zwave traffic as possible, you could also Change your trigger to Item FibBut01_Scene changed

2 Likes