Fibaro dimmer 2 lost its dimming function recently

I have successfully been using this device for a few weeks now with the device type created by rajjiv and the parameters modified to use a toggle switch, dimmer mode and calibrate on first power up. The light being controlled in the kitchen is 5x 35W incandescent bulbs. Nothing has been changed other than ST updating the software. However, it has just started to function as on/off at full brightness. I checked the code in the ‘my devices’ and it’s still the same. Reset the switch to factory default and added it back in to the network but still only works as on/off. The Fibaro device dims as this is carried out during the calibration, so I have no reason to suspect it has developed a fault. Any suggestions please?

Can you dim from the software?

I had a working kitchen light that could dim and was turned on via a motion sensor. I could also set the amount of dimming manually from the app. As I said this was working well for a while but something has changed recently and the Fibaro device only switches on and off now. Looking at the log, the level of dimming appears to be sent but the device reports back always at 99%.

In my code I’ve set the switch to work as on/off since I don’t have momentary switches. Only toggle on/off. However, I can dim from the app. If you want to dim from the switch, you will need to make changes to the code accordingly.

Rajiv, may I ask if you can still dim from the software? This stopped working for me about a week ago (with the last update I think).

Yes… Using the latest code and regular on/off switches and in both single way and two way setup.

Did you try recalibration? Press the B button for some time and it detects the kind of light bulb you have.

I’ve not yet tried a recalibration, however I don’t think that’s necessary as I’ve installed 5 new 212s since the problem has been around, and all of them calibrated when they first went in.

Dimming is fine from the switch, and it is also fine with the default item type which ST assigns to the 212. It’s only the custom device type which doesn’t dim, and only for the past week (this is the case for a total of 18 modules I have).

I do wonder if I have the latest version? I can’t see anyone else still has this problem.

I changed the device type back to the ST assigned device (Z wave multichannel), recalibrated and the Fibaro dimmer 2 dims via software. However, although the Z wave multichannel device handler allows dimming and on/off switching, it can be a bit erratic. As soon as I change to the Fibaro dimmer 2 custom device handler, it reverts back to an on/off switch. I know I’ve had the Fibaro dimmer 2 working with the custom device handler but something has changed in ST to prevent it from operating correctly and it has happened recently.
Until the Fibaro dimmer 2 is officially supported, so that local processing works, it seems pointless investing in any more modules. I intend to remove it from the circuit and replace it with an Aeon module. The LAP dimmable LED gu10 bulbs from Screwfix seem to work with any dimmer type so the Aeon module is supported and will operate as intended with LED bulbs.

I’m not alone then! Unfortunately swapping out all of my modules isn’t an option. I think the dimmer 2 is fab, and I can’t wait for it to be properly supported.

The default device type (z-wave multichannel) is ok, but it never reports the current status correctly (on when off). @rmbhatia had a great script, but because it’s custom it will always fall outside of the scope of support when it goes wrong :frowning:

Ok, fixed it!

I have no idea why or how, but lines 225 and 226 were commented out of my code:

zwave.meterV2.meterReset()
//zwave.meterV2.meterGet(scale: 0),
//zwave.meterV2.meterGet(scale: 2)

I’ve removed the comment lines and put the comma back in after 224, and all now works perfectly:

zwave.meterV2.meterReset(),
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)

1 Like

The code you have shown is at lines 212 to 214 in my version. Perhaps I have something missing?

Well, this is the code as I have it. I know I tinkered with it when I got it to make it work with retractive switches, so you might need to re-tweak for your own purposes. I think I just commented out the parameter changes, as the defaults are fine for me:

/**

  • Copyright 2015 SmartThings
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  •  http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

*/
metadata {
definition (name: “Fibaro Dimmer 2 UK”, namespace: “smartthings”, author: “rajiv”) {
capability "Energy Meter"
capability "Actuator"
capability "Switch"
capability "Power Meter"
capability "Polling"
capability "Refresh"
capability "Sensor"
capability "Configuration"
capability “Switch Level”

	command "reset"
    command "configureAfterSecure"

    fingerprint deviceId: "0x1001", inClusters: "0x5E, 0x20, 0x86, 0x72, 0x26, 0x5A, 0x59, 0x85, 0x73, 0x98, 0x7A, 0x56, 0x70, 0x31, 0x32, 0x8E, 0x60, 0x75, 0x71, 0x27, 0x22, 0xEF, 0x2B"
}

// simulator metadata
simulator {
	status "on":  "command: 2003, payload: FF"
	status "off": "command: 2003, payload: 00"
	status "09%": "command: 2003, payload: 09"
	status "10%": "command: 2003, payload: 0A"
	status "33%": "command: 2003, payload: 21"
	status "66%": "command: 2003, payload: 42"
	status "99%": "command: 2003, payload: 63"

	for (int i = 0; i <= 10000; i += 1000) {
		status "power  ${i} W": new physicalgraph.zwave.Zwave().meterV3.meterReport(
			scaledMeterValue: i, precision: 3, meterType: 4, scale: 2, size: 4).incomingMessage()
	}
	for (int i = 0; i <= 100; i += 10) {
		status "energy  ${i} kWh": new physicalgraph.zwave.Zwave().meterV3.meterReport(
			scaledMeterValue: i, precision: 3, meterType: 0, scale: 0, size: 4).incomingMessage()
	}
    
    ["FF", "00", "09", "0A", "21", "42", "63"].each { val ->
		reply "2001$val,delay 100,2602": "command: 2603, payload: $val"
	}
}

// tile definitions

tiles(scale: 2) {
	multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
		tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
			attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
			attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
			attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#79b821", nextState:"turningOff"
			attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
		}
		tileAttribute ("device.level", key: "SLIDER_CONTROL") {
			attributeState "level", action:"switch level.setLevel"
		}
	}
	valueTile("power", "device.power", decoration: "flat", width: 2, height: 2) {
		state "default", label:'${currentValue} W'
	}
	valueTile("energy", "device.energy", decoration: "flat", width: 2, height: 2) {
		state "default", label:'${currentValue} kWh'
	}
	standardTile("reset", "device.energy", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
		state "default", label:'reset kWh', action:"reset"
	}    
	standardTile("configureAfterSecure", "device.configure", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
		state "configure", label:'', action:"configureAfterSecure", icon:"st.secondary.configure"
	}
	standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
		state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
	}

	main(["switch","power","energy"])
	details(["switch","power","energy","configureAfterSecure","refresh","reset"])
}

}

def parse(String description) {
log.trace(description)
def result = null

if (description != "updated") {
	def cmd = zwave.parse(description, [0x20: 1, 0x26: 3, 0x32: 3, 0x25: 1, 0x98: 1, 0x70: 1, 0x85: 2, 0x9B: 1, 0x90: 1, 0x73: 1, 0x30: 1, 0x28: 1, 0x72: 1])
	if (cmd) {
		result = zwaveEvent(cmd)
	}
}
log.debug "Parsed '${description}' to ${result.inspect()}"
return result

}

// Devices that support the Security command class can send messages in an encrypted form;
// they arrive wrapped in a SecurityMessageEncapsulation command and must be unencapsulated
def zwaveEvent(physicalgraph.zwave.commands.securityv1.SecurityMessageEncapsulation cmd) {
log.trace(cmd)
def encapsulatedCommand = cmd.encapsulatedCommand([0x20: 1, 0x26: 3, 0x32: 3, 0x25: 1, 0x98: 1, 0x70: 1, 0x85: 2, 0x9B: 1, 0x90: 1, 0x73: 1, 0x30: 1, 0x28: 1, 0x72: 1]) // can specify command class versions here like in zwave.parse
if (encapsulatedCommand) {
return zwaveEvent(encapsulatedCommand)
} else {
log.warn "Unable to extract encapsulated cmd from $cmd"
createEvent(descriptionText: cmd.toString())
}
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}
def zwaveEvent(physicalgraph.zwave.commands.switchmultilevelv3.SwitchMultilevelReport cmd) {
log.trace(cmd)
dimmerEvents(cmd)
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd)
{
log.trace(cmd)
dimmerEvents(cmd)
}

def dimmerEvents(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
def result = []
def value = (cmd.value ? “on” : “off”)
def switchEvent = createEvent(name: “switch”, value: value, descriptionText: “$device.displayName was turned $value”)
result << switchEvent
if (cmd.value) {
result << createEvent(name: “level”, value: cmd.value, unit: “%”)
}
if (switchEvent.isStateChange) {
result << response([“delay 3000”, zwave.meterV2.meterGet(scale: 2).format()])
}
return result
}

def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd) {
log.trace(cmd)
if (cmd.meterType == 1) {
if (cmd.scale == 0) {
return createEvent(name: “energy”, value: cmd.scaledMeterValue, unit: “kWh”)
} else if (cmd.scale == 1) {
return createEvent(name: “energy”, value: cmd.scaledMeterValue, unit: “kVAh”)
} else if (cmd.scale == 2) {
return createEvent(name: “power”, value: Math.round(cmd.scaledMeterValue), unit: “W”)
} else {
return createEvent(name: “electric”, value: cmd.scaledMeterValue, unit: [“pulses”, “V”, “A”, “R/Z”, “”][cmd.scale - 3])
}
}
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
log.debug “No handler for $cmd”
// Handles all Z-Wave commands we aren’t interested in
createEvent(descriptionText: cmd.toString(), isStateChange: false)
}

def on() {
log.trace(“on”)
secureSequence([
zwave.basicV1.basicSet(value: 0xFF),
zwave.switchMultilevelV1.switchMultilevelGet()
])
}

def off() {
log.trace(“off”)
secureSequence([
zwave.basicV1.basicSet(value: 0x00),
zwave.switchMultilevelV1.switchMultilevelGet()
])
}

def poll() {
log.trace(“poll”)
secureSequence([
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
])
}

def refresh() {
log.trace(“trace”)
secureSequence([
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
])
}

def reset() {
log.trace(“reset”)
return secureSequence([
zwave.switchMultilevelV1.switchMultilevelGet(),
zwave.meterV2.meterReset(),
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
])
}

def setLevel(level) {
log.trace(“setlevel”)
if(level > 99) level = 99
secureSequence([
zwave.basicV1.basicSet(value: level),
zwave.switchMultilevelV1.switchMultilevelGet(),
zwave.meterV2.meterReset(),
zwave.meterV2.meterGet(scale: 0),
zwave.meterV2.meterGet(scale: 2)
], 5000)
}

def configureAfterSecure() {
log.debug "configureAfterSecure()"
secureSequence([
/** zwave.configurationV1.configurationSet(parameterNumber: 20, size: 1, scaledConfigurationValue: 1), // Enable Dimmer to work with Toggle Switch
zwave.configurationV1.configurationSet(parameterNumber: 26, size: 1, scaledConfigurationValue: 1), // S2 can control dimmer as well
zwave.configurationV1.configurationSet(parameterNumber: 32, size: 1, scaledConfigurationValue: 1), // On/Off Mode (0=Dimmer,1=On/Off,2=Auto)
zwave.configurationV1.configurationSet(parameterNumber: 35, size: 1, scaledConfigurationValue: 2), // Auto Calibration (0=No after Power On, 1=On First Power On, 2=On Each Power On)
*/

	// Register for Group 1
    zwave.associationV2.associationSet(groupingIdentifier:1, nodeId: [zwaveHubNodeId]),
    // Register for Group 2
    zwave.associationV2.associationSet(groupingIdentifier:2, nodeId: [zwaveHubNodeId]),
])

}

def configure() {
// Wait until after the secure exchange for this
log.debug “configure()”
}

def updated() {
log.debug "updated()"
response([“delay 2000”] + configureAfterSecure() + refresh())
}

private secure(physicalgraph.zwave.Command cmd) {
log.trace(cmd)
zwave.securityV1.securityMessageEncapsulation().encapsulate(cmd).format()
}

private secureSequence(commands, delay=200) {
log.debug "$commands"
delayBetween(commands.collect{ secure(it) }, delay)
}

Hi John,

Glad it you got it fixed. I never had it commented out in my original code, unless I’ve pasted a work in progress code in the middle somewhere. I’m still surprised how this commented out code did not affect you in the past. It’s strange.

Anyways, this is the code I am currently using and is working fine for my needs.
Fibaro 2 Dimmer Code

Could you try this code for your setup, commenting out the parameters block, and see if this works for you?

If you do need to change any of the parameters, please follow Fibaro’s Documentation Fibaro 212 Manual and set your parameters accordingly.

You need to set the parameter number, followed by the byte size (as mentioned in the documentation), followed by your value.

Hope this helps.

1 Like

Hi Rajiv,

I agree, and I certainly don’t think these lines were commented out before. I have no idea how this has happened. I’ve not touched the code for at least a couple of months. I have a feeling I’ll never know.

Anyway, it’s working now so I’m happy. Thanks again for your help.

John.

Hi Rajiv,

I used the code you have currently in the link from the above post and although I can dim from the software, some other behaviour has been introduced that was not there previously.

My kitchen light is activated from motion detection or timed events, so no wall switches. Unfortunately, when the light comes on from motion detection, it ramps up to full brightness and then back down to off. It is only a second event that switches it on to full. However, after about 4-5 seconds it then dims to a previously set level.
Like I said in another post, unless the device is supported locally it can introduce some strange latency problems. I will be removing the Fibaro 212 and replacing it with another device. The only way to ensure reliable operation of the Fibaro 212 is to buy the home centre 2 or lite version.
Lesson learned!

I have to disagree, unless you have some serious ISP issues, there is no way you should have a delay that long. Something else is going on there, you should check the parameters section of the code. Make two different device handlers if you need to, with different parameters depending on the switch.

There is obviously nothing wrong with the device handler code as other users, including yourself, are using it successfully. Also the dimmer module must be working as it dims and switches on/off. I have tried all the usual stuff of rebooting, reinstalling and recalibration but it is not behaving how it should be.
I will see if tomorrow’s update changes things.
Thanks

An example, I have momentary switches. Unless I commented out the lines in Rajiv’s code which set his custom attributes for two way switching I got exactly the behaviour you’re experiencing.

Hi Tim,

I would suggest the following steps:

  1. Recalibrate the device manually using the hardware buttons. If you change the bulbs after the first calibration, it may not detect the type of bulb you’ve added and it causes strange behaviour
  2. Set the switch as a dimmer, and not an on/off switch. On/off switch causes it to start at full brightness. This is parameter 32. Set it to 0
  3. If you do not want it at maximum brightness at all, you can set the max brightness level using parameter 2. See the fibaro documentation
  4. There is a timer parameter that turns off the device automatically after a certain period of time. If you are using it in a stairways for example. This is parameter 10,
  5. With parameter 19, you can force the brightness level on startup.

Please note with option 3,4 and 5 i suggest you create a new device type so it does not affect your other switches.

To make the parameter changes, read the available settings in the fibaro documentation. You need to make changes in the code as follows:
zwave.configurationV1.configurationSet(parameterNumber: [Enter Parameter Number], size: [Enter byte size from documentation of respective parameter number], scaledConfigurationValue: [Enter value])

You can see from the code how parameters are set. Nothing wrong with the switches. Once it’s set to your respective requirement, it should not have any hiccups. I’ve been running them for quite some time now.

Let us know if it worked, and what changes you made for other users to incorporate.

1 Like

I’m sure you’ve had a lots of beginners like me ask the same question, so sincere apologies.

Through your guidance previously I’ve successfully installed several Fibaro dimmers (thank you) but I’ve only ever been able to turn them on / off.

I changed Parameter 32 as you suggested to 0 but still i can’t get it to dim. Smartthings recent activity shows the dimmer level being set when I drag the bar but it has no effect on the lights. The Fibaro is running about 9 LEDs in my kitchen.

So any ideas what I could try?

Having changed Para 32 I didn’t re-calibrate, so wasn’t sure whether that was worth a try?

Regards

Neil