Executar serviço através de linhas de comando function

Boa tarde !
Alguém saberia como executar um serviço através de linhas de comando dentro de um nó function?
Encontrei o códigoe exemplo abaixo, mas não funciona:

image

Continuo no aguardo desse item, sem solução.

Hi @EduardoRCB
Welcome to this forum.

Despite my language knowledge regarding Spanish (?) is near to zero: There're some contributed nodes available that support HomeAssistant - thus there should be no need to use a function node for a standard task.
If you open the Node-RED menu (top right corner), select "Manage palette", select the "Install" tab & then enter assistant as search text, you'll get a number (34 - when I did this) of options:

Be sure to extensively wire Debug nodes initially - to understand the message format as it is processed...

1 Like

Thanks for the tip, but this node I already know. To make it clearer why I want to execute a service through "Function" command, is that I have a Skill of interaction with Alexa and during this interaction any service can be executed through received commands or words. Within the same "function" node, I would be able to insert thousands of words and phrases linked to the execution of services. If I use service nodes for each command, I would go insane!

OK then...
It looks like you need to load the homeassistant module first.

Make sure, you installed it via npm install homeassistant, then make it available in Node-RED.
The documentation can show you how to achieve this.

Additionally, make sure to use javascript code as reference. call_service looks like coming from the Python HASS module.

By the way: Você obteria muito mais feedback ao fazer suas perguntas usando o idioma inglês!

1 Like

Thank you for the tips. In my case, I use nodered within HomeAssistant. I'll do a code review for "java". tks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.