Closed youzer-name closed 5 days ago
I don't think the Number
type exists (though I’m not a Groovy expert). Did you try with Integer
in the method definition to enable automatic casting.
The command node uses the Maker API for this request, and the argument is passed via the URL. Enabling Node-RED debug will reveal more details. For example:
24 Nov 19:25:21 - [debug] [hubitat command:<node-id>] Request: http://127.0.0.1/apps/api/1/devices/1/setLevel/50
Where setLevel
is the command, and 50
is the argument.
As shown, there is no strict concept of type—everything is transmitted in the URL as a string (e.g., string, float, int, vector, etc.). It’s up to the driver to handle the argument and perform the necessary conversion.
(not so long answer :joy: )
You can reproduce or troubleshoot the issue by directly making requests with the Maker API. If the request works through the API but not via the node, I can assist further. Otherwise, the problem is likely related to the driver.
Edit: I'm not an expert with hubitat driver, but I think you should also be sure to have the right type
definition for the command :man_shrugging:
command(
'setChargeLimit',
[[
name: 'Set Charge Limit,
type: 'NUMBER',
description: "...",
]]
)
That makes sense. So to work with Maker API requests, drivers need to accept strings and cast as needed. Thanks!
I'm trying to use a command node to send a command to a device with a number as a parameter:
Even though the field shows "number", I'm getting this error when I try to send the command:
When I send the command directly from the device page in Hubitat, it works:
In the driver the command was set up as:
I changed that to
and then used
to cast the string to an integer. That worked.
So it seems that despite the field in the Command node saying "number", it is sending a string to the hub.