In context of a device driver, can someone confirm what the descriptionText
and type
map properties are used for in the sendEvent
method/command?
sendEvent(name: "doubleTapped", value: 1, descriptionText: "${device.displayName} button 1 was doubleTapped", isStateChange: true, type: "digital")
I cannot see where they are used, and could not find anything definitive on the forum.
I thought descriptionText might be used in the Events log on any subscribing app. The below shows the output from Rule Machine for the above sendEvent command. Description is empty?
I haven't a notion about type
.
These properties seem to be used a lot in the driver code samples written by @mike.maxwell.
Thanks
For a driver, descriptionText
is used in the Event log (device page, then the "Events" button/tab at the top) of that device. For example (this is for a bulb device):
In many cases, if descriptionText/info logging is enabled, the driver would also spit out the same text to the live (and past) logs, again for the device. That part is just convention (but a good idea if you're writing a driver); the "Description Text" field of the event that is actually generated is where it is actually used (shown above).
Many apps do nothing in their "Events"--it's up to the app to do what it wishes. I'd guess that many do absolutely nothing here, and I rarely find anything of use there so can't even tell you what the convention is with stock apps (RM might sort of log triggers and device actions there?). In any case, the device doesn't have any control over that, just the app.
1 Like
You don't really need to have a "type" for a button event. There's no distinction made between button presses anywhere in Hubitat. Type is typically used to distinguish between physical presses on a switch or dimmer and digital commands sent from the hub to the device, usually when turned on or off. For example, if you were to turn off a smart-wall switch at the switch itself, the type would say "physical" if you were to turn the device off from Hubitat, the type would say digital. This is, of course, if the capability to do so has been built into the driver that supports the device. Otherwise the type will be blank. The only fields required to generate an event are name and value.
1 Like
Many thanks @bertabcd1234 and @Ryan780. Exactly what I needed. I somehow missed the Events tab in the device driver settings.
Cheers
2 Likes