LAN device consisting of a server and multiple environmental sensors pushes XML data to HE. The XML data has one parent element (for the server) and one or more child elements (the sensors). The sensors can be several different "types".
Every time data is received by the parent driver's parse() function, I want to process each child element (sensor) with the updated data by calling a function for the sensor device type. Here's the code so far...
There's probably several errors in the above code, but it does "compile" like it is. I've tried several different things, but it always gets a compile error or throws an exception. What class should be used instead of "String"?
The above version of the code gets throws this exception...
groovy.lang.MissingMethodException: No signature of method: groovy.util.slurpersupport.NodeChild.updateDS18B20() is applicable for argument types: () values: on line 228 (method parse)
Note that if I move the code from the child functions into the calling function, the code works as expected, i.e., this works as expected...
But your sensor member is probably a NodeChild or some other complex type. You can track that down and type it explicitly in the parameter list, or you can just declare it like this and then sort it out inside updateXXX function:
There are several different types of sensors. The last log I posted contains two of them. My goal is to pass a child node to a sensor-specific function for "individual processing" based on the child's tag (e.g., owd_DS18B20, owd_EDS0068, etc.) or the child's "Name" value (e.g., DS18B20, EDS0068, etc.). The sensor values vary by device. For example, the DS18B20 has about a dozen values, whereas the EDS0068 has about 70. Processing requirements will vary depending on the sensor type. That's why I want to separate the functions by sensor type, i.e., to make the code more readable/manageable.
Your function works, but it looks to me like a "general purpose" function that is passed the complete XML doc and it processes all types of sensors in the same function.
That works. If you look at the previous code I posted, lines 219-230 were copied from the driver I am using as a template. I'm not sure why but replacing that code with the code in your processResponse function works the way I wanted it to.