Does eventhandler work for device types?


(Don Caruana) #1

The documentation (http://docs.smartthings.com/en/latest/ref-docs/event-ref.html) implies that you can use:
def eventHandler(evt)

to get more information about an event. But I think it can only be used in smartapps. Can anyone confirm this or tell me how to do it in a device type handler?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Can you describe more about what you are actually trying to do? i.e., what is your end requirement?

Offhand, I don’t think eventHandler() is applicable within a DTH, because a DTH receives events through its parse() method.


(Don Caruana) #3

When I posted this, I was trying to look for a few extra debugging tools, mostly. Looked like a lot of good info could be in those events, was trying to get at it.

If it only works in smartapps, that’s okay. Just want to clarify at this point.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

In a DTH, indeed, there is a lot of useful information from “events”, but the events are routed to parse(), not to an arbitrary Event Handler.

http://docs.smartthings.com/en/latest/device-type-developers-guide/parse.html


(Don Caruana) #5

You know - I was thinking of the kind of events that you do when you do “createevent” or “sendevent”. Pretty dumb - sorry about that!

I’m familiar with parse (and even “intercepting” it) although there are some things in here I didn’t actually realize. :slight_smile:

Thanks!