Trying to $formatNumber of an input_number in a service node but getting error

Hi,

I have created an input_number which I am using to hold a position value for my blinds. I would like to call the service node and set my blinds to this value. My blinds require a string as the setpoint so need to conver the numeric value to a string then set the option parameter.

I’ve tried setting the JSONata Data to…
{“option”:$formatNumber($entities(“input_number.cfg_blindofficeopensp”).state,"#")}
but it throws the following error…
Argument 2 of function “formatNumber” does not match function signature

Any idea why I’m getting this error?

BTW: I initially tried setting the value without formatting with this command…
{“option”:$entities(“input_number.cfg_blindofficeopensp”).state}
I got this error message…
"Call-service error. Invalid option: 75.0 (possible options: close, closed, open, opened, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100)"
Note that my setpoint is 75.0 (numeric) but my target input_select was expecting string data.
This is why I’m trying to use the $formatNumber function.

Thanks

Try

{ "option": $number($entities("input_number.cfg_blindofficeopensp").state) }

That worked. Odd since input_number is already a number and I thought I needed to cast it as a string so I could use it in the input_select object.

As long as it works :slight_smile: