Hue Connect Device Service Manager: Mysterious "parse()" method


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

Continuing the discussion from Is Philips Hue the neglected one and TCP the favored one:

I asked this in the long related existing Hue Topic, but no response. Guess I’m impatient, but decided to spin off to own Topic now…

Zippy… May I ask you (or anybody) a question regarding the Hue (Connect) Service Manager SmartApp?

I don’t understand the purpose of the “def parse(...)” method in the Service Manager. I thought “def parse()” was only required and called in Device Handlers, not Service Manager SmartApps.

I’ve searched all the Hue SmartApp and Device Handler code, and I can’t find anything that calls this method:

From: https://github.com/zpriddy/SmartThings/blob/master/Hue%20SmartApps%20and%20Devices/zp_hue_groups_and_lights_connect_new.groovy

/////////////////////////////////////
//CHILD DEVICE METHODS
/////////////////////////////////////

def parse(childDevice, description) {
	def parsedEvent = parseEventMessage(description)
...
}

NB: The above chunk of code is in the original SmartThings authored Hue-Connect.groovy as well.

The purpose of the other methods defined in the Service Manager are obvious and clearly called from the child Devices in their Command methods (e.g., “def on(childDevice, transition = 4) {}”). I just don’t see the purpose of the parse method here, or even that it is used anywhere.

Thanks…?


(Tim Slagle) #2

To make sure I understand. You are asking what the purpose of parse is in any device type out there?


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

No. That is not my question. (I very much understand the purpose of the “parse(String)” method in Device Handlers.).

I don’t understand why “Hue Connect Service Manager” SmartApp has its own parse(), and I never see it called (just by searching related code, child devices).


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

In other words, as linked from the SmartThingsPublic GitHub Repository… this method in this SmartApp (by @juano2310).

https://github.com/SmartThingsCommunity/SmartThingsPublic/blob/master/smartapps/smartthings/hue-connect.src/hue-connect.groovy#L475

Thanks!
…Terry.