Tem diversos jeitos de fazer, eu particularmente uso mais assim:
nó function:
msg.entity_id = 'sensor.nome'
msg.payload = {
data: {
state: msg.payload.Valor,
attributes: {
friendly_name: 'Nome Bonito',
}
}
};
return msg;
Nó API
[{"id":"8d6a4a75c80cbf74","type":"ha-api","z":"f727fdcc.c16a4","name":"","server":"d854bbe5.321208","version":1,"debugenabled":false,"protocol":"http","method":"post","path":"/api/states/{{entity_id}}","data":"","dataType":"json","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":970,"y":1480,"wires":[[]]},{"id":"d854bbe5.321208","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]