Rule to help address Fibaro Dimmer Fault with Homekit

Hi,
I have a few Fibaro Dimmer 212 dimmer switches all running via Momentary switches. I have faced an issue where the switch takes about 3 attempts to turn on. Normally the first and second time it just flicks on and then back to off. I have compensated for the issue by having a rule with the changed to on command as the trigger. Now again there are other issues similar with the dimmer value. It works fine via Openhab and if i use the home kit interface on my iphone via touch. if however i try and trigger a dim value change via voice it sends a command On along with another command of 100. This causes some weird behaviour and the dim value command does not take effect
Below is my config

items file

Switch      Lou_Out             "Lounge Outside"                    <switch>                   (GrF_Lounge, sGrf)    { channel="zwave:device:b215c72c:node31:switch_dimmer1" }
Dimmer      Lou_Out_HB          "Lounge Outside"            <dimmablelight>                   (Homebridge,GrF_Lounge, gDimm)	[ "Lighting" ]    { channel="zwave:device:b215c72c:node31:switch_dimmer1" }
Number      Lou_Out_alarm       "Lounge Outside - Alarm" (gAlarm)	    { channel="zwave:device:b215c72c:node31:notification_send1" }
Number      Lou_Out_power       "Lounge Outside - current power consumption [%.2f W]"  (gEnergy)	    { channel="zwave:device:b215c72c:node31:meter_watts1" }
Number      Lou_Out_energy      "Lounge Outside - total energy use [%.2f KWh]"          (gEnergyKWh)   { channel="zwave:device:b215c72c:node31:meter_kwh1" }

Rules File


rule "Lou_Out Dimmed Light"
	when
		Item Lou_Out changed to ON
		or
		Item Lou_Out_HB changed to ON
	then
		logInfo("RULE", "--> Lounge Outside turned on")
		sendCommand(Lou_Out_HB, GroundDim_lvl)
		Thread::sleep(100)
		sendCommand(Lou_Out_HB, GroundDim_lvl)
		Thread::sleep(100)
		sendCommand(Lou_Out_HB, GroundDim_lvl)
	end

Logs as below
On Command Via Siri - No issues due to rule Lights turn on at 1% Brightness which is the Ground_dim value
2018-04-07 13:28:35.791 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command ON
2018-04-07 13:28:35.793 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 0 to 100
2018-04-07 13:28:35.793 [GroupItemStateChangedEvent] - GrF_Lounge changed from OFF to ON through Lou_Out_HB
2018-04-07 13:28:35.926 [vent.ItemStateChangedEvent] - Lou_Out changed from OFF to ON

==> /var/log/openhab2/openhab.log <==
2018-04-07 13:28:35.927 [INFO ] [.eclipse.smarthome.model.script.RULE] - --> Lounge Outside turned on

==> /var/log/openhab2/events.log <==
2018-04-07 13:28:35.927 [GroupItemStateChangedEvent] - sGrf changed from OFF to ON through Lou_Out
2018-04-07 13:28:35.927 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 100 to 1
2018-04-07 13:28:35.928 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command 1
2018-04-07 13:28:36.029 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command 1
2018-04-07 13:28:36.131 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command 1

On command via Siri - Changing Lounge outside to 15% when the light is already on. No noticeable change sometimes you can notice it before it goes back to the previous dim level

2018-04-07 13:38:02.718 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command 15
2018-04-07 13:38:02.719 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command ON
2018-04-07 13:38:02.720 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 1 to 15
2018-04-07 13:38:02.720 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 15 to 100
2018-04-07 13:38:02.877 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 100 to 1

Using Homekit app using touch changing Dim to 28% works. Using Open tab slider dim level works too without issues

2018-04-07 13:41:17.387 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command ON
2018-04-07 13:41:17.387 [ome.event.ItemCommandEvent] - Item ‘Lou_Out_HB’ received command 28
2018-04-07 13:41:17.388 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 27 to 100
2018-04-07 13:41:17.388 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 100 to 28
2018-04-07 13:41:17.945 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 28 to 1
2018-04-07 13:41:18.772 [vent.ItemStateChangedEvent] - Lou_Out_HB changed from 1 to 28

The fact that i cannot dim via siri is really getting to me. I have tried messing around with various parameters and have checked out various fibaro forums as this seems to be a known issue and firmware updates meant to fix it but it hasnt. I’m on Fibaro firmware 3.5. Openhab 2.2 Zwave 2.3 dev compiled in april 2018.

I was wondering if any other rule can be used to send the dim value a few times without creating a loop to overcome this issue. Any help is much appreciated. I have been pulling my hair out for this as the dim via siri works a few times and some other times it does not work.

Thanks again.
Snapshots from Habmin for the node below. Couldnt find ways of extracting the text so unfortunately i had to resort to screenshots

Looks like parameter 20 switch type is wrong. I think there is an option for a momentary switch.

This seems to be the option for Momentary switch. I have attached a screenshot mate

What load do you have connected? and what lights have you got?

They are all philips dimmable Leds mostly 5x3w with the Fibaro dimmer bypass module. I had to force them to leading edge although fibaro auto caliberation wanted trailing edge.

All seams ok so far, what switch are you using with these?

Hi Mick,

I have the switches below

Just thinking at a tangent…
If you take Switch Lou_Out out of your items and disable your rule, does it stop the issue with the light not turning on first time?
Just wondering if having the switch and dimmer both triggering from the same physical switch is causing the issue.
Still not sure how to address the Siri issue :frowning:

Yes. At that point the Physical switch works but the openhab switch changes do not work all the time. they briefly turn on for a fraction of a second and then turns off. I have now changed the rules slighty to try and reduce the number of rules.

Switch      Lou_Out             "Lounge Outside"                    <switch>                   (GrF_Lounge, sGrf)    { channel="zwave:device:b215c72c:node31:switch_dimmer1" }
Dimmer      Lou_Out_dim         "Lounge Outside [%d %%]"            <dimmablelight>                       { channel="zwave:device:b215c72c:node31:switch_dimmer1" }
Dimmer      Lou_Out_HB          "Lounge Outside"            <dimmablelight>                   (Homebridge,GrF_Lounge, gDimm)	[ "Lighting" ]    { channel="zwave:device:b215c72c:node31:switch_dimmer1" }

rule "Lounge Outside Dimmed Light"
	when
		Item Lou_Out_HB received command
		or
		Item Lou_Out received command
	then
		logInfo("RULE", "--> Lounge Outside Light Triggerred ")
	    if( receivedCommand == ON )
			{ 
				if ( Lou_Out.state != ON ) 
            	{
        		logInfo("RULE", "--> Lounge Outside turned on")
		        Lou_Out_dim.sendCommand(LoungeDim_lvl)
		        Thread::sleep(450)
		        Lou_Out_dim.sendCommand(LoungeDim_lvl)
	        	Thread::sleep(270)
		        Lou_Out_dim.sendCommand(LoungeDim_lvl)
				}
            }
		else if ( receivedCommand != OFF )
			{
				logInfo("RULE", "--> Lounge Outside Light Dim Value Received")
				HomeDim = receivedCommand as DecimalType
	        	Lou_Out_dim.sendCommand(HomeDim)
		        Thread::sleep(270)
	        	Lou_Out_dim.sendCommand(HomeDim)
		        Thread::sleep(270)
	        	Lou_Out_dim.sendCommand(HomeDim)
			}
	end

This kinda works. So when the lights are turned on the first time via homekit or openhab it always turns on at a preset dim level based on time of day. Following that if i ask siri or dim the light via openhab it works.

Now i have hit the issue of setting the dim level based on time of day when the light is turned on via the physical switch.

Ok… I have fixed it with a weird set of rules and attempted to reduce code size…

Switch      Lou_Out             "Lounge Outside"                    <switch>                   (GrF_Lounge, sGrf)    { channel="zwave:device:b215c72c:node31:switch_dimmer1" }
Dimmer      Lou_Out_dim         "Lounge Outside [%d %%]"            <dimmablelight>                       { channel="zwave:device:b215c72c:node31:switch_dimmer1" }
Dimmer      Lou_Out_HB          "Lounge Outside"            <dimmablelight>                   (Homebridge,GrF_Lounge, gDimm)	[ "Lighting" ]    { channel="zwave:device:b215c72c:node31:switch_dimmer1" }

var Integer loopLvl = 3
var Integer loopHK = 15
var Integer loopON = 3

rule "Lounge Outside Dimmed Light"
	when
		Item Lou_Out_HB received command
		or
		Item Lou_Out received command
	then
		logInfo("RULE", "--> Lounge Outside Light Triggerred ")
	    if( receivedCommand == ON )
			{ 
				if ( Lou_Out.state != ON ) 
            	{
        		logInfo("RULE", "--> Lounge Outside turned on")
		        (1..loopLvl).forEach[
			        Lou_Out_dim.sendCommand(LoungeDim_lvl)
			        Thread::sleep(200)
					]
				}
            }
		else if ( receivedCommand != OFF )
			{
				logInfo("RULE", "--> Lounge Outside Light Dim Value Received")
				HomeDim = receivedCommand as DecimalType
		        (1..loopHK).forEach[
		        	Lou_Out_dim.sendCommand(HomeDim)
			        Thread::sleep(300)
					]
				}
end

rule "Lounge Outside Changed"
	when
		Item Lou_Out changed to ON
	then
		logInfo("RULE", "--> Lounge Outside Light Changed to ON ")
		(1..loopON).forEach[
			Lou_Out_dim.sendCommand(LoungeDim_lvl)
			Thread::sleep(150)
			]
end

Weird set i know but finally it works while turning on via Physical, Openhab and Siri and Siri command with dim level works from off too

All of this just because of the flaky fibaro module. Atleast saved myself a couple of grand by not having to change the entire set of 25 modules. Hope it helps someone with the similar problem. Finally I can rest. This has been bugging me for a looooong time.