Device Driver Startup Method


(Jay Basen) #1

I’m writing a device driver to communicate between the SmartThings Hub and and an Arduino Mega. If, for some reason, the SmartThings Hub is restarted I’d like my device driver to, for lack of a better term, poll the Arduino board for it’s current status. I’m not looking for a continuous poll, just once at start up. The device driver would send a message to the Arduino which would respond with a series of status messages that would get everything to a normalized state.

I’ve tried reading through all the documentation and related posts I can find but haven’t found anything that seems to directly relate to this topic.

Is there a method I could define that gets called with the device driver gets initiated by the SmartThings Hub?

Or, is there a capability I could define in my device driver that would help me accomplish this?

Or, some other approach?

I’m brand new to coding in Groovy so please be gentle:-)

Thanks in advance for the help


(Duncan) #2

Unfortunately, there’s not any way to do that currently. It’s something we’ve run into as well, so there’s an improvement request in our tracking system. It’s not a huge priority for us, so I wouldn’t hold your breath, but we’ll definitely be looking into it. Thank you for the input.


(Jay Basen) #3

Duncan

Thanks for letting me know.

While it isn’t the norm to have a SmartThings Processor reboot (though I assume it may be happening more than I think because it may be occurring every time you guys push a software update to the hubs) this is a real world issue for anyone writing automation code that relies on accurate feedback from devices and users who are using the app on their phone and taking actions based on what they see. Having worked in the automation industry professionally for almost 10 years I can tell you with a high degree of certainty that it is a significant issue from an end user perspective. No feedback is better than incorrect feedback.

I guess I can add a 3rd state to my tiles that will be the first state and therefore the default at start up. That state would have a text of something like unknown and require the user to press an update button. Not great, but at least a possible work around unless anyone has a better idea.

Thanks again for getting back to me and listening to my feedback


(Jay Basen) #4

I just wanted to follow up and let people know what I heard back from support. As Duncan described above there may be a better solution in the future; at this point the best way to accomplish this is to use the poll event.


(Barry) #5

Well, if we are going to use the poll() event, then at least the hub should automatically do a poll() upon reboot. That’s not too much to ask now, is it?

And there’d be no reason this has to wait - they could implement and deliver in this Thursday’s update, no?