Function - Executando call-service

Por favor, alguém saberia quais as linhas de comando dentro do nó function para executar um call service, por exemplo: Um turn_on de uma entidade light, etc

Exemplo de código encontrado na internet, mas não funcionou…

image

O que vc esta tentando fazer?

Eu acho que não da para chamar o call service direto do function.

Mas vc pode enviar uma msg formatada direto para o nó call-service

[{"id":"888334f7a7332619","type":"api-call-service","z":"190f546538219810","name":"","server":"33803899.487d48","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":480,"wires":[[]]},{"id":"4c34d62682761952","type":"inject","z":"190f546538219810","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"service\":\"toggle\",\"domain\":\"light\",\"data\":{\"entity_id\":\"light.cozinha\"}}","payloadType":"json","x":470,"y":480,"wires":[["888334f7a7332619"]]},{"id":"7aae546441598b8c","type":"api-call-service","z":"190f546538219810","name":"","server":"33803899.487d48","version":5,"debugenabled":false,"domain":"light","service":"toggle","areaId":[],"deviceId":[],"entityId":[],"data":"{\"entity_id\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":580,"wires":[[]]},{"id":"b43d59656e500b4f","type":"inject","z":"190f546538219810","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"light.cozinha","payloadType":"str","x":490,"y":580,"wires":[["7aae546441598b8c"]]},{"id":"33803899.487d48","type":"server","name":"Home Assistant","version":5,"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","enableGlobalContextStore":true}]
1 curtida

tem um nó específico para call service, não precisa do function…

1 curtida