Call Service node help, please

I have a script that works from Developer Tools, Services. I select script.fios_stb_office_pause then click on “Call Service”, and the set-top box pauses.

How do I translate this to a call service node?

I’ve tried this:

Domain: script
Entity ID: script.fios_stb_office_pause
Service: send_command

But, the Service is wrong:

"Call-service error. Service not found.

What service should I use to run a script, and where do I find that in the documentation?

What does this script do?
What’s the yaml?

Set the call service node like this

Fair question…

/config/scripts.yaml

fios_stb_pause:
  alias: fios_stb_office_pause
  sequence:
  - service: remote.send_command
    data:
      entity_id: remote.broadlink_office_remote
      device: fios_stb
      command: pause
  mode: single

This is how I am testing my flow:
flow

This is the only attempt that doesn’t give me an API error, but it does not run the script:
inject

Check your HA logs see if there are any failed script errors.

Ok, and any reason to not issue the call service to the remote - not the script?

Just use the call service node and make it do the remote action directly the.
This is what mine looks like to turn on our kitchen TV.

And the data field has this:

{
    "device": "kok_tv",	  
    "command": "power"	
}

I’ve tried that also, but all I ever get is “API Error”.

Why should it be so difficult to just run the script?

Why would you need to run a script?

I run half a dozen scripts everyday to reboot my pi zero’s, mostly because I can’t seem to run a direct shell command from nodered. When they fail they show up in HA’s main log.

Because it works.

All the log tells me is
“Unable to find referenced entities script.fios_stb_office_pause”

This is the script that I can run from developer’s tools:
run

Make sure there is no white space after the entity in msg.entity in the inject node.

And I just remembered, look in dev tools for the script. I have a few named scripts that I have to call by a number that HA assigns. eg script.1616143114854

Ok… let me rephrase then, if the script has more than one service call then sure.
But having one service call in a script then you are not winning anything.

It works in node red also.
You’re making a service call in the script and that is exactly what the call service node does.

Have you even tried as I posted?

[{"id":"c8676bed8eecf470","type":"inject","z":"341b64864f1ae744","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1250,"y":800,"wires":[["bee25a789d1c187f"]]},{"id":"bee25a789d1c187f","type":"api-call-service","z":"341b64864f1ae744","name":"","server":"4bbca37b.1700ec","version":3,"debugenabled":false,"service_domain":"remote","service":"send_command","entityId":"remote.broadlink_office_remote","data":"{\t  \"device\": \"fios_stb\",\t  \"command\": \"pause\"\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1560,"y":800,"wires":[[]]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

Where do you find the number?

In dev tools if you can’t find it by name, then look for numbered scripts.

Yes, and I got the “API Error” again.

But, I went back to try again and discovered that I had an error on my ‘Data’ line. It’s working now. Thanks.

Thanks, but I don’t have any script numbers in dev tools:

I appreciate the help. I have it working as desired now.

I’ve got the same issue with an RM4 mini device… I’m trying to call a service to send “device”:“AC” and “command”:“poweroff” and although it runs and turns off the AC, I get API Error.

What exactly did you change on the “data” line?