#how can I set an entity state from a
1 messages · Page 1 of 1 (latest)
const HA_NAME = "homeAssistant-SMG27"; // Your HA name
const ha = global.get("homeassistant")[HA_NAME];
if (!ha.isConnected) {
return
}
temp = ha.states["input_number.hall_temp"].state;
reading like that
typically you would send it to an output into a call-service node. If you wanted to keep it contained within the function node you would need to make an http request with an imported lib to HA
Trying through the call-service node, but getting ""Call-service error. extra keys not allowed @ data['0']""
10.1.2023, 16:51:05node: debug 61
msg : Object
object
payload: 18
room: "hall"
_msgid: "7fb2dfd001fe2383"
{"entity_id":"input_number.hall_tempsetpoint","value":{{msg.payload}}}
typically means you're sending a string when it expects a json object
set the data type of the data field to J:expressiona nd use "value": payload
"Syntax error: ":""
did you use the whole object?
{"entity_id":"input_number.hall_tempsetpoint","value": payload}