Hi,
I am no developer but playing around with some coding.
I have a flow in node red using the Hubitat Command node trying to update an attribute in a Hubitat driver.
When my flow sends a string like this: 2024-11-29:1.178 it receives just fine.
but, when the string is for example - [2024-11-29:1.178, 2024-11-30:1.582, 2024-12-01:0.794] i get the following error message:
groovy.lang.MissingMethodException: No signature of method: user_driver_amithalp_Rimonim_Meter2_1105.updateConsumptionData() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String) values: [2024-11-29:1.178, 2024-11-30:1.582, 2024-12-01:0.794] Possible solutions: updateConsumptionData(java.lang.String) on line 515 (method updateConsumptionData)
They are both sent from the same node in node red and received by the same function in the driver:
void updateConsumptionData(String data) {
sendEvent(name: "consumptionData", value: data, isStateChange: false)
log.debug "Raw data received: ${data}"
}
Your method is expecting a String as a parameter and in the second instance is receiving an ArrayList. Either remove the String type on the parameter or create an overload for the method (another method with the same name that accepts an array list).
Or maybe they want that "List" to just be sent as a string. I have not done this with node red but maybe you need wrap your string in quotes so that it is processed as a string instead of a list of strings.
Because of the [ ... ] and the comma separation is it treating that as a list of 3 separate strings.
Hi @jtp10181 and @thebearmay.
Thanks a lot for your responses. I did what you suggested with no luck.
Eventually I came to the conclusion that for some reason using a "," (comma) signs between the values in my string caused the Node Red Edit Command node to assign the square brackets no matter what I did. This is return caused the error message in the update function in Hubitat.
So, eventually I ended up (for now) with changing the comma signs to a # sign when creating the string in node red.
So, instead of sending [2024-11-29:1.178, 2024-11-30:1.582, 2024-12-01:0.794], I am now sending 2024-11-29:1.178# 2024-11-30:1.582# 2024-12-01:0.794
I will now have to parse this string into an array of measurements in Hubitat and send it to influxDB, and then to Grafana and then present it as Iframe in Hubitat.
If my boss only knew this is what I am doing during my work hours......... but, well, I don't have a boss
I'm not sure if it would help much since you eventually want the string in Hubitat (I assume in a Hubitat dashboard), but you could consider sending it straight from Node Red to InfluxDB to simplify the process.
Agreed, sounds like you took the most complicated route. Not sure what you are doing exactly though so maybe it is needed.
You could also use a custom function in NR instead of one of the built in nodes. Then you can set the payload string to anything you want.
Or if you are always sending in groups of 3 like that you could just make your function on HE accept 3 strings instead of one as @thebearmay suggested.
Might even be able to have the function accept a ListArray and then it will take any number of comma separated strings and put them into the array, not sure if that would work or not.
I was thinking about this option but could not a find template for it on the influxDB side (no predefined source) and as I already have some working Hubitat to InfluxDB transfers I thought I will stick with what is working for me. Plus the fact that I would like to keep all logs in Hubitat as my system of 4 Hubitat hubs + 2 RPI is becoming hard to control as it is.
But I think my decision would have changes if I knew I would spend hours debuging the NR-HE interface.
My flow is meant to allow the user in Hubitat device of the fromDate and toDate and then fetch the data from a water company server API accordingly. So, I do not know in advance how many records will be in the consumptionData string.
I could not figure out how to do this succesfully so I took the other route.
Hmmm, you probably could eliminate NR and just hit the API directly from HE. I assume it returns a JSON string? But maybe there is a NR node already made to interact with it so that you did not have to code the API calls that way.
I took the opposite route. I push all my Hubitat logs from my two hubs to a MySQL database running on a Raspberry Pi, and view them using a Grafana dashboard. This lets me see the logs from both hubs inline with each other, making troubleshooting processes that involve both hubs much easier.
Similar here. First I had setup a custom NR flow to log all desired events to Influx, pushed to NR via Maker API (before the updated Influx app was released). That was based on some forum posts and examples but I took my own liberties with the custom NR function. Then later I decided to setup a log server that pushes everything to Influx as well, so I have my two servers, router and two HE hub pushing all logs to that where I can view the logs in a much better view.
And... now that everything is setup and working smooth I never have to look at it
Comes in handy when an issue pops up or for troubleshooting though.
That was indeed my starting point but I had to give it up as I could not make the driver code run the API commands and receive the responses as they should.
Just to mention that this was a long journey because the water company does not supply an API documentation so I had to use wed developer tool and Postman to figure out what is going on. I then tried to code these calls into Hubitat but failed and Chat GPT suggested that this might be Hubitat limitations related and only then I tried using Node Red and it worked so I sticked with it.