Inovelli Switch Hold Button to Dim

I have a LZW31-SN Dimmer - Red Series (Gen 2) switch. It is controlling 2 smart lights. I am looking to improve the dimming experience with this switch. Right now I can dim with scenes. That’s easy enough, especially with the Inovelli Red Series LZW31-SN Dimmer (ZWave-JS) Blueprint by jerelabs. What I would like to do now is to dim the smart lights by holding the button down then stop dimming after the button is released. Maybe with some kind of loop? I don’t know, I have been banging my head against a wall trying to figure out the code to do it. I am hoping someone here can point me in the right direction. Thanks in advance!

Has anyone made progress on this? On/Off, and activating scenes is easy enough, but I cannot for the life of me figure out how to control a brightness value of a light group in real time with a press and hold while local control and smart bulb mode is turned on.

It’s not quite real time since it won’t set the brightness level until your hand is off the switch, but I use this automation to get my light to match the brightness level of the switch, which is an inovelli red dimmer.

alias: Light Bedroom Mirror Switch On
description: ''
trigger:
  - platform: state
    entity_id: light.bedroom_wall_switch
condition:
  - condition: template
    value_template: >-
      {{  states.light.bedroom_wall_switch.last_updated >
      states.light.bedroom_fan.last_changed }}
action:
  - service: light.turn_on
    entity_id: light.bedroom_fan
    data_template:
      brightness: >
        {{ state_attr('light.bedroom_wall_switch', 'brightness') | default(0,
        true) }}
mode: single

I tried a mirror the other way so the switch would match the level of the light, but it would create a race condition where the light kept going on and off.

2 Likes

I took this over to the Inovelli forums. This thread helped me sort everything out.

I put this together in Node Red that will brighten or dim the lights in real time, while you’re holding the switch up or down. It is using the Looptimer palette - node-red-contrib-looptimer (node) - Node-RED

You can play around with the loop delay and the steps for brightness changes in the call service nodes. Currently it’s set to increase or decrease brightness in 10% increments every half second. When the key is released, the stop command is sent to the loop to stop the dimming.

Here’s the code to import the flow

[{"id":"436f8e12e81c686b","type":"server-events","z":"43a54f4c9ef74bed","name":"Zwave Events Other","server":"","version":1,"event_type":"zwave_js_value_notification","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"},{"property":"event_type","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":290,"y":120,"wires":[["f3ac13526c281b6a"]]},{"id":"f3ac13526c281b6a","type":"switch","z":"43a54f4c9ef74bed","name":"Wall Switch","property":"payload.event.node_id","propertyType":"msg","rules":[{"t":"eq","v":"51","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":330,"y":200,"wires":[["32e14ccc433b2b8b","d1b293d9b0575c9d"]]},{"id":"32e14ccc433b2b8b","type":"switch","z":"43a54f4c9ef74bed","name":"Scene Up","property":"payload.event.property_key","propertyType":"msg","rules":[{"t":"eq","v":"002","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":540,"y":80,"wires":[["1654fde98c43f2ee"]]},{"id":"d1b293d9b0575c9d","type":"switch","z":"43a54f4c9ef74bed","name":"Scene Down","property":"payload.event.property_key","propertyType":"msg","rules":[{"t":"eq","v":"001","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":530,"y":220,"wires":[["61dfa059812973d6"]]},{"id":"1654fde98c43f2ee","type":"switch","z":"43a54f4c9ef74bed","name":"Taps?","property":"payload.event.value","propertyType":"msg","rules":[{"t":"eq","v":"KeyHeldDown","vt":"str"},{"t":"eq","v":"KeyReleased","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":140,"wires":[["f4ed23a72e1e8e26"],["76fbbeb88505ad87"]]},{"id":"61dfa059812973d6","type":"switch","z":"43a54f4c9ef74bed","name":"Taps?","property":"payload.event.value","propertyType":"msg","rules":[{"t":"eq","v":"KeyHeldDown","vt":"str"},{"t":"eq","v":"KeyReleased","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":530,"y":280,"wires":[["b3f1f40fd8ea947e"],["957b89679cedbf99"]]},{"id":"f4ed23a72e1e8e26","type":"looptimer","z":"43a54f4c9ef74bed","duration":"0.5","units":"Second","maxloops":"10","maxtimeout":"1","maxtimeoutunits":"Minute","name":"","x":750,"y":100,"wires":[["928965f1ab3f357d"],[]]},{"id":"76fbbeb88505ad87","type":"change","z":"43a54f4c9ef74bed","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":160,"wires":[["f4ed23a72e1e8e26"]]},{"id":"957b89679cedbf99","type":"change","z":"43a54f4c9ef74bed","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":340,"wires":[["b3f1f40fd8ea947e"]]},{"id":"b3f1f40fd8ea947e","type":"looptimer","z":"43a54f4c9ef74bed","duration":"0.5","units":"Second","maxloops":"10","maxtimeout":"1","maxtimeoutunits":"Minute","name":"","x":730,"y":280,"wires":[["f426986b5d9c759e"],[]]},{"id":"928965f1ab3f357d","type":"api-call-service","z":"43a54f4c9ef74bed","name":"Bedroom Light Brighter","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bedroom_fan","data":"{\"brightness_step_pct\":10}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":100,"wires":[[]]},{"id":"f426986b5d9c759e","type":"api-call-service","z":"43a54f4c9ef74bed","name":"Bedroom Light Dimmer","server":"ae531ce.a39906","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.bedroom_fan","data":"{\"brightness_step_pct\":-10}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":280,"wires":[[]]},{"id":"ae531ce.a39906","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

I played with all these approaches, and ended up settling on a scene driven approach with about 6 different steps of brightness. All the loop oriented approaches were far from feeling smooth to me, so I just let go of trying to make it smooth and used the multi-press events to move through a set of 6 different scenes, each with a 20% difference in brightness.

Based on everything I’ve read so far, the only way to get true smooth dimming with smart bulbs is if your smart bulbs are Z-Wave and you can use an association group.

Yeah when I tried that node red flow there was a bit of a “ratcheting” effect of the light stepping up, so definitely not smooth. Possibly if you set the loop interval shorter and the steps shorter, say at .2 second loop and 5% change it might seem smoother, but definitely not as smooth as if the bulb was directly connected to the switch.

Yes unfortunately I believe that is the case and I’m not aware of any other ways, and zwave bulbs are very expensive and hard to find.

I just settled on the delayed dim with the automation above. The red series dimmer has an LED bar that goes up and down as it is dimmed/brighten so that gives me an idea of where the brightness level will be when I let go of the switch and the bulb changes a moment later.

@mwav3 i no longer seem to be able to get my LED bar to go up and down. Are you running with local controll off and smart bulb mode on? Are the lights downstream from the switch smart?

Smart bulb mode is on. The switch is only hooked to the line, and no load is on it though. The light (it’s actually a zigbee fan/light control in the canopy) is hardwired to the line to just have power on all the time. Basically, the switch is bypassed.

Local control is enabled. I just tried to disable it and the led bar still changed with a zwave command level.

Maybe you need a firmware update, or some other config setting is wrong?

@mwav3 ah, I see. I think because you have local control still on. I have some of the smart lights in my room on the load side of this switch. What I’ve figured out is that when you turn off local control, so that it does not have any effect on the load side voltage, it seems to kill the internal dimming.

Once you turn on smart bulb AND turn off local control, I think you are on your own to keep the state of the dimming value updated.

If anyone knows better, correct me if I’m wrong.

There were a lot of firmware updates around smart bulb mode and the led bar. I would make sure you’re on the latest firmware.

Yea, I’m on 1.57

I only mentioned it because I thought you might have been running one of the really old pre smart bulb ones. I’m actually behind and only on 1.47 which looks like when smart bulb mode was first introduced. I was going to update my firmware but after seeing your post about losing the led bar I’m not sure if I should.

There’s two firmware files, one for the switch and one for the led bar, so not sure if something went wrong there applying them. Still odd that led bar isn’t working to show the dim level for you though.