[SmartThings Edge] Issue with the switchLevel capability

I’ve had the error below pop up a few times today when a switchMultilevel:Report comes in with a target_value of 255. The driver is using the default handler for that command class.

2022-02-01T16:58:06.919642169+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received Z-Wave command: {args={current_value=10, duration=0, target_value=255, value=10}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x0A\xFF\x00", src_channel=0, version=4}
2022-02-01T16:58:06.928869780+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T16:58:06.935731543+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"switch","component_id":"main","state":{"value":"on"},"capability_id":"switch"}
2022-02-01T16:58:06.956230787+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T16:58:06.965422714+00:00 ERROR GE Z-Wave Switch/Dimmer/Fan/Outlet  Den Lights thread encountered error: [string "st/dispatcher.lua"]:229: Error encountered while processing event for <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)>:
    arg1: {args={current_value=10, duration=0, target_value=255, value=10}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x0A\xFF\x00", src_channel=0, version=4}
[string "st/capabilities/init.lua"]:225: Value 255 is invalid for Switch Level.level

Hi, @philh30.
Can you provide more details, please?
Your device’s dimmer is currently at the 10% level, right?
The error is normal because Switch Level only accepts values from 1-100 but the issue could be that the parameter used in the capability event is target_value instead of value, that’s why I want to confirm if physically the dimmer level is low, which means 10 is the correct one.

No, the 10% was actually an intermediate level as the dimmer was ramping up from off to a higher value.

I moved this device (z-wave plus Jasco dimmer) to a driver by itself to make it easier to get a longer period of logs. Those are included at the bottom of this post. In these new logs the process is:

  • Dimmer starts from on with the dim level set to 37%
  • Turn off (Switch capability)
  • Turn on (Switch capability)

I’ve figured out that the reports that are throwing the error are ones that are generated in the middle of the dimming transition. Per the spec, a mid-transition report should give the current value (23% in the example below as it’s midway through the transition) for value and the value from the Set command (0xFF in this case) for the target_value, so the report itself seems reasonable and one that the handler should anticipate.

I’m definitely starting to wonder whether that was the right choice, even outside of this error with 0xFF values for target_value. The two parameters should give identical results for quick dimming transitions. But for longer transitions, using target_value will give a premature report that the device has finished dimming.

I have a different Jasco switch set with a 10 second dimming transition. That one is a zigbee model, and the dimming events in the app track the slow increase in the device’s actual dim level as it moves toward the target. It could be good to switch from using target_value to value just to have consistency in how the two protocols are handled.

2022-02-01T17:54:56.568012219+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received Z-Wave command: {args={current_value=37, duration=0, target_value=37, value=37}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x25\x25\x00", src_channel=0, version=4}
2022-02-01T17:54:56.585473886+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:54:56.591838886+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"switch","component_id":"main","state":{"value":"on"},"capability_id":"switch"}
2022-02-01T17:54:56.611118886+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:54:56.621899553+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"level","component_id":"main","state":{"value":37},"capability_id":"switchLevel"}
2022-02-01T17:54:56.642419553+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:54:56.648579886+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler capability
2022-02-01T17:54:56.667241886+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received command: {"positional_args":[],"command":"off","capability":"switch","args":[],"component":"main"}
2022-02-01T17:54:56.673921219+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found CapabilityCommandDispatcher handler in ge-zwave-switch
2022-02-01T17:54:56.679601553+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  SWITCH_MULTILEVEL supported.
2022-02-01T17:54:56.689363219+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> sending Z-Wave command: {args={duration=1, value="OFF_DISABLE"}, cmd_class="SWITCH_MULTILEVEL", cmd_id="SET", dst_channels={}, encap="AUTO", payload="\x00\x01", src_channel=0, version=2}
2022-02-01T17:54:56.708617886+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(5425da5a) queued for radio transmission: CC:Switch Multi-level, CID:0x01
2022-02-01T17:54:56.719088553+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:54:56.726998219+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:54:56.897514886+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(5425da5a) transmit status: TRANSMIT_COMPLETE_OK
2022-02-01T17:54:58.052976553+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler unnamed
2022-02-01T17:54:58.065206220+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received Z-Wave command: {args={value="OFF_DISABLE"}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x00", src_channel=0, version=1}
2022-02-01T17:54:58.079197220+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:54:58.086101553+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"switch","component_id":"main","state":{"value":"off"},"capability_id":"switch"}
2022-02-01T17:54:58.105913220+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:54:58.111326553+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:00.970319221+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler capability
2022-02-01T17:55:01.016625555+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received command: {"positional_args":[],"command":"on","capability":"switch","args":[],"component":"main"}
2022-02-01T17:55:01.029931888+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found CapabilityCommandDispatcher handler in ge-zwave-switch
2022-02-01T17:55:01.041127222+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  SWITCH_MULTILEVEL supported.
2022-02-01T17:55:01.054936555+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> sending Z-Wave command: {args={duration=1, value="ON_ENABLE"}, cmd_class="SWITCH_MULTILEVEL", cmd_id="SET", dst_channels={}, encap="AUTO", payload="\xFF\x01", src_channel=0, version=2}
2022-02-01T17:55:01.101014555+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(bbd706a4) queued for radio transmission: CC:Switch Multi-level, CID:0x01
2022-02-01T17:55:01.127665888+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:01.134529222+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:01.213055222+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(bbd706a4) transmit status: TRANSMIT_COMPLETE_OK
2022-02-01T17:55:01.731558889+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> sending Z-Wave command: {args={}, cmd_class="SWITCH_MULTILEVEL", cmd_id="GET", dst_channels={}, encap="AUTO", payload="", src_channel=0, version=1}
2022-02-01T17:55:01.750994889+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(b1c92421) queued for radio transmission: CC:Switch Multi-level, CID:0x02
2022-02-01T17:55:01.756877889+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:01.929520222+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(b1c92421) transmit status: TRANSMIT_COMPLETE_OK
2022-02-01T17:55:01.948534889+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler unnamed
2022-02-01T17:55:01.958502889+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received Z-Wave command: {args={current_value=23, duration=0, target_value=255, value=23}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x17\xFF\x00", src_channel=0, version=4}
2022-02-01T17:55:01.968475555+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:55:01.975061889+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"switch","component_id":"main","state":{"value":"on"},"capability_id":"switch"}
2022-02-01T17:55:01.994804555+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:55:02.003762222+00:00 ERROR GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights thread encountered error: [string "st/dispatcher.lua"]:229: Error encountered while processing event for <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)>:
    arg1: {args={current_value=23, duration=0, target_value=255, value=23}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x17\xFF\x00", src_channel=0, version=4}
[string "st/capabilities/init.lua"]:225: Value 255 is invalid for Switch Level.level
2022-02-01T17:55:03.321852223+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler unnamed
2022-02-01T17:55:03.331254556+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received Z-Wave command: {args={value=37}, cmd_class="BASIC", cmd_id="REPORT", dst_channels={}, encap="AUTO", payload="%", src_channel=0, version=1}
2022-02-01T17:55:03.355509556+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:55:03.362254556+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"switch","component_id":"main","state":{"value":"on"},"capability_id":"switch"}
2022-02-01T17:55:03.382072556+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:06.136893891+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> sending Z-Wave command: {args={}, cmd_class="SWITCH_MULTILEVEL", cmd_id="GET", dst_channels={}, encap="AUTO", payload="", src_channel=0, version=1}
2022-02-01T17:55:06.193714891+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(2f72ac24) queued for radio transmission: CC:Switch Multi-level, CID:0x02
2022-02-01T17:55:06.201314224+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:06.377398891+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Z-Wave command(2f72ac24) transmit status: TRANSMIT_COMPLETE_OK
2022-02-01T17:55:06.447995557+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler unnamed
2022-02-01T17:55:06.487426224+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> received Z-Wave command: {args={current_value=37, duration=0, target_value=37, value=37}, cmd_class="SWITCH_MULTILEVEL", cmd_id="REPORT", dst_channels={}, encap="S2_AUTH", payload="\x25\x25\x00", src_channel=0, version=4}
2022-02-01T17:55:06.611079558+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:55:06.654155891+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"switch","component_id":"main","state":{"value":"on"},"capability_id":"switch"}
2022-02-01T17:55:06.698789891+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Found ZwaveDispatcher handler in ge-zwave-switch
2022-02-01T17:55:06.721098891+00:00 INFO GE Z-Wave Switch/Dimmer/Fan/Outlet Test  <ZwaveDevice: 61606588-501f-4ff8-b071-8da57be02e7c [62] (Den Lights)> emitting event: {"attribute_id":"level","component_id":"main","state":{"value":37},"capability_id":"switchLevel"}
2022-02-01T17:55:06.772660558+00:00 DEBUG GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Den Lights device thread event handled
2022-02-01T17:55:52.118945246+00:00 TRACE GE Z-Wave Switch/Dimmer/Fan/Outlet Test  Received event with handler capability

How did you set that 10-second transition, is it part of the configuration parameters of the device?

I don’t mean to confuse the issue - that’s a completely different switch from the one the logs are based on. I was just noting it as an example of a real-world use of longer than normal transition times. The switch in the logs is not configured in any atypical way, and the Z-Wave and capability handlers involved in the logs are all default.

If you’re asking out of interest, the 10-second transition is on one of Jasco’s Zigbee dimmers. The transition time uses the rate parameter in the following Zigbee command:

device:send(Level.server.commands.MoveToLevelWithOnOff(device, level, rate))

Oh, cool. Thank you for the clarification. I will report this to the team so they can analyze the library and see what can we do in this kind of case.
Thank you for sharing your experience :smiley:

1 Like

Thank you, but the issue being reported in this topic is related to the Z-Wave library.

1 Like

sorry i misunderstood

1 Like

Interesting. I only have a superficial knowledge of these things but it seems to me that there is no allowance for target_value having the values 254 or 255. Nor does there seem to be any allowance for target_value and value using 99 to represent 100%.

It looks like the reports are deliberately being interpreted to show what the dimmer is up to, rather than where it has got to. It really shouldn’t be a case of either or. There needs to be a ‘fade’ capability.

This part is now handled in the 41.X library.

I would guess that the intent was to eliminate the intermediate reports to avoid confusion. The vast majority of dimmers will be set with a second or two transition at most, so those in-between reports will just be a nuisance. But… dynamic lighting is one of the big smart home selling points, and the current logic definitely falls short for hours-long fades.