I’m using Hubitat to control Inovelli Blues configured as dimmers. In a Rule Machine rule, I’m trying to use the custom command “presetLevel” to set the dim level of a light bulb before the bulb is turned ON in a subsequent rule command (since the DIM command is also an ON command).
That works, but the custom command “presetLevel” seems to continue applying to the dimmer after the rule ends, causing the bulb to be set at that level the next time the dimmer is turned ON (despite another branch of the rule trying to set a different dim value).
So when I turn the dimmer OFF, I want to return “presetLevel” to it’s default state. I can’t find documentation for this custom command. I see that value 101 is a possible setting in the driver for the parameter “Preset Level”, but no explanation is given as to what that value means.
Is 101 indeed the default value for the custom command “presetLevel”, and if so, exactly what is the default state doing?
Well, after an unduly long time experimenting under the misconception that the custom command “presetLevel” in the Hubitat driver actually set the “Preset Level” of the dimmer WITHOUT turning the dimmer ON, I found out that the custom command “presetLevel” works EXACTLY like the DIM command: sets the dimmer light level AND turns the dimmer ON.
So I’m going to play with the “Set Zigbee Attribute”, try to find the parameters for “Preset Level”, and try to see if that works “correctly”, setting the dimmer light level WITHOUT turning the dimmer ON.
To be clear, in the Hubitat driver for the Blues, the Preset Level command does work correctly when manually set. This behavior differs from the behavior of the “presetLevel” custom command used in a rule.
Are you sure there isn’t another rule that is turning the light on? Looking at the code that command sets the local and remote level configuration which shouldn’t turn the light on:
def presetLevel(value) {
if (infoEnable) log.info "${device.displayName} presetLevel(${value})"
state.lastCommandSent = "presetLevel(${value})"
state.lastCommandTime = nowFormatted()
def cmds = []
Integer scaledValue = value==null?null:Math.min(Math.max(convertPercentToByte(value.toInteger()),1),255) //ZigBee levels range from 0x01-0xfe with 00 and ff = 'use previous'
cmds += setParameter(13, scaledValue)
cmds += setParameter(14, scaledValue)
if (debugEnable) log.debug "${device.displayName} preset $cmds"
return cmds
}
It essentially changes P13 and P14 which are described on the preferences page:
parameter013 : [
number: 13,
name: "Default Level (Local)",
description: "Default level for the dimmer when turned on at the switch.<br>1-100=Set Level<br>101=Use previous level.",
range: "1..101",
default: 101,
size: 8,
type: "number",
value: null
],
parameter014 : [
number: 14,
name: "Default Level (Remote)",
description: "Default level for the dimmer when turned on from the hub.<br>1-100=Set Level<br>101=Use previous level.",
range: "1..101",
default: 101,
size: 8,
type: "number",
value: null
],
No other rule is turning this dimmer on. Tapping the top paddle with the above rule installed results in the light turning ON at 30% – which is exactly what a DIM command would do.
Setting Preset Level in the UI to 30% and clicking on “Run” does NOT turn the light ON.
The only difference between the UI command and the Rule custom command line is the fact that the top paddle of the dimmer is physically tapped, as if the dimmer automatically adds an “ON” command to the rule.
Also, as you describe presetLevel, it does not do what I expected it to do, which is set the dimming level (not the default level) to a value that does not turn ON the light. When a Blue (in dimmer config) is manually set to a dimming level (e.g., 35%) and is then turned OFF, the next ON state (with out-of-the-box standard Preference settings) will turn the light ON to that level (35%). So there must be a register or memory that stores the manually set dim level, and the switch retrieves the stored value when the top paddle is tapped. So I envisioned presetLevel as just changing that stored value so that a top-paddle tap retrieves the altered value before actually turning the light ON. Hence, true “pre-staging”.
Changing the Default Levels is something entirely different to me. To me, that’s for permanently (until intentionally reprogramming) fixing a problem with a minimum dim level supported by a particular light bulb, or for setting a minimum and permanent (until intentionally reprogrammed) level for a particular room or light (e.g., a closet always set to come on at 75%).
In any event, I’m stuck with no true pre-staging with the Blues, meaning that some lights will flash brighter than intended before settling down to a new dim level set by a rule.
No, the switch is fully functional locally. To be absolutely positive, I manually set parameter 256 (Local Protection" to the default value (“Local control enable”) and re-ran the test rule posted above. Same outcome – a tap on the top paddle runs the rule and turns the light ON.
So if you push the top paddle and local control is enabled, it’s supposed to turn the light on. Pushing the top paddle turns on the wired load unless local control is disabled. It’s also sending a button event which you are using to trigger your rule, but that doesn’t override the switch from also affecting the wired load.
I don’t know of any Zigbee commands that work the way you are describing. I checked the Level Control cluster and I am not seeing anything that would be like a “staging” command.
Some people use the presetLevel custom command for that though. I have a schedule that changes the default level local to certain values based on the time of day. So when I turn the light on at the switch in the middle of the night, it is dim, but during the day it is bright.
You could disable local control (like @Bry mentioned) and your Rule will work like you are expecting, but by default pressing the up button will also turn on the load.
If you want to stage a certain level with an automation, you could set it back to 101 (previous level) when you are done having it staged to a certain level.