Error in service node

Hallo all,

I have : input_number.climate_temperature_away
When I run this in Node Red msg.payload gives the correct result : 19

I want to use this value in a call service node.

domain.climate
service: set_temperature
entry id: climate.living_room

data:{"temperature":"{{payload} | float "}}

I get this error: “Call-service error. expected float for dictionary value @ data[‘temperature’]”

How can I solve this error.

set data to expression

and try this in the data field:

{“temperature”: $number(payload)}

You can’t use jinja filters in the data field. Check out Jsonata for that purpose.

1 Like

Thankx for the replay. I replaced as in you advice.

Now i get: “Key in object structure must evaluate to a string; got: undefined”

Hello
Did you solve this?
I am trying to send float-1 to my thermostat but I get the same error message as you do.
image

If you are trying to subtract 1 from the payload, remove the float filter and use J expression instead of json

Yes that is exactly what I want to do. I am still a novice in node red so could you please show me how the code would look?

In the data field there is a drop down, change it to J;expression

{
   "entity_id": "climate.floor_thermostat_2",
   "temperature": payload - 1
}

Thank you for the help, but there must be more fundamentally wrong here. Maybe you could help.
My flow is like this:
image

The current state node does not send out the attribute.temperature only the state.

image

The call service node gives an error like this now:
msg : string[59]
“The left side of the “-” operator must evaluate to a number”

What am I doing wrong now?

With jsonata you need to tell it where to look. You also would drop data

$entity().attributes.temperature

Thank you. That solved my problems