Multiple Events - A clue?

@mike.maxwell @bcopeland

I've been experiencing the "multiple events for single action" bug which has been mentioned numerous times in these pages.

I think I found a possible clue for you guys to check into.

Using MakerAPI, I did a "Get All Devices with Full Details" report on a couple of lights and outlets. I've pasted the resulting JSON below. Notice that if you look in the "command" section, you see the "on" and the "off" commands each repeated twice for these devices. This seems to be happening in the "Generic Z-Wave Outlet", Zooz Zen25 Double Plug, and a few Zigbee lights. I also have problems of multiple events for Z-Wave dimmer devices, but I haven't seen this repeated command problem for those devices.

I"m currently running firmware 2.2.2.129 (I had to downgrade from 2.2.3.148 as I had too many problems with that one), but given the problems I was having with 2.2.3.148, maybe this problem exists there too.

[
{
"name":"Generic Z-Wave Outlet",
"label":"Backyard Landscape",
"type":"Generic Z-Wave Outlet",
"id":"35",
"date":"2020-10-03T00:25:36+0000",
"model":null,
"manufacturer":null,
"capabilities":[
"Switch",
"Configuration",
"Refresh",
"Actuator",
"Outlet"
],
"attributes":{
"switch":"off",
"dataType":"ENUM",
"values":[
"on",
"off"
]
},
"commands":[
{
"command":"configure"
},
{
"command":"off"
},
{
"command":"off"
},
{
"command":"on"
},
{
"command":"on"
},
{
"command":"refresh"
}
]
},
{
"name":"Generic Component Dimmer",
"label":"Bonus Room LZW36 Light",
"type":"Generic Component Dimmer",
"id":"218",
"date":"2020-09-11T23:11:50+0000",
"model":null,
"manufacturer":null,
"capabilities":[
"Switch",
"SwitchLevel",
"Refresh",
"Actuator",
"Light",
"ChangeLevel"
],
"attributes":{
"level":"100",
"dataType":"ENUM",
"values":[
"on",
"off"
],
"switch":"off"
},
"commands":[
{
"command":"off"
},
{
"command":"off"
},
{
"command":"on"
},
{
"command":"on"
},
{
"command":"refresh"
},
{
"command":"setLevel"
},
{
"command":"startLevelChange"
},
{
"command":"stopLevelChange"
}
]
},
{
"name":"Zooz Double Plug",
"label":"Kitchen Cabinet Parent - Lights Over Desk",
"type":"Zooz Double Plug",
"id":"270",
"date":"2020-10-03T00:10:47+0000",
"model":null,
"manufacturer":null,
"capabilities":[
"Switch",
"Configuration",
"Refresh",
"EnergyMeter",
"PowerMeter",
"Sensor",
"Actuator",
"VoltageMeasurement",
"Outlet"
],
"attributes":{
"current":"0.14",
"dataType":"NUMBER",
"values":null,
"currentHigh":"0.14",
"currentLow":"0",
"energy":"3.41",
"energyDuration":"21 Days",
"power":"10.3",
"powerHigh":"10.6",
"powerLow":"0",
"switch":"on",
"voltage":"124.9",
"voltageHigh":"125.8",
"voltageLow":"0"
},
"commands":[
{
"command":"configure"
},
{
"command":"off"
},
{
"command":"off"
},
{
"command":"on"
},
{
"command":"on"
},
{
"command":"refresh"
},
{
"command":"reset"
}
]
},
{
"name":"Generic ZigBee RGBW Light",
"label":"Color Bulb Left",
"type":"Generic ZigBee RGBW Light",
"id":"462",
"date":"2020-10-02T23:52:26+0000",
"model":null,
"manufacturer":null,
"capabilities":[
"Switch",
"Configuration",
"SwitchLevel",
"Refresh",
"ColorControl",
"Actuator",
"ColorTemperature",
"Light",
"ChangeLevel",
"ColorMode"
],
"attributes":{
"RGB":null,
"dataType":"ENUM",
"values":[
"on",
"off"
],
"color":null,
"colorMode":"RGB",
"colorName":"Green",
"colorTemperature":"2702",
"hue":"33",
"level":"71",
"saturation":"100",
"switch":"on"
},
"commands":[
{
"command":"configure"
},
{
"command":"off"
},
{
"command":"off"
},
{
"command":"on"
},
{
"command":"on"
},
{
"command":"refresh"
},
{
"command":"setColor"
},
{
"command":"setColorTemperature"
},
{
"command":"setHue"
},
{
"command":"setLevel"
},
{
"command":"setSaturation"
},
{
"command":"startLevelChange"
},
{
"command":"stopLevelChange"
}
]
}
]

It's a phenomina of Capabilities vs Attributes vs Commands.

Attributes and Commands are what I think of as "real" things. They Do Something. Capabilities are are like an accordion file folder that holds a bunch of Attributes and Commands. The Capability "Switch" quite obviously would include an Attribute to track on/off and a pair of commands for On and Off.

Dimmers do too along with setLevel etc. Thus two Attributes and two Commands that get auto-populated, saving a driver writer a few steps. But when the driver gets written for real, there's only one On command coded and only one Off command coded and only one Attribute to hold the state.

Hubitat publishes their Generic Zigbee RGBW Light driver at:

So I created a virtual device and selected that driver. Then I selected that device in my Get Attribute App and got the following result:

Screen Shot 2020-10-02 at 5.56.32 PM

You can see, two On Commands two Off Commands.

But within the Source of the Driver there's a single ON method:

def on() {
    def cmd = [
            "he cmd 0x${device.deviceNetworkId} 0x${device.endpointId} 0x0006 1 {}",
            "delay 1000",
            "he rattr 0x${device.deviceNetworkId} 0x${device.endpointId} 0x0006 0 {}"
    ]
    return cmd
}

Only one path through the Driver. :slight_smile:

Thanks for the explanation. The duplicating of commands in some drivers, but not others, does seem quite confusing though!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.