Okay I guess the script fails and not the pi hence the need to ping a specific port? There are 2 ways I can think of going about this.
Go to the node red addon page then the config tab. Edit in yaml and replace the system packages entry with:
system_packages:
- nmap
If you already have entries add it with another dash
system_packages:
- moment
- nmap
Save and restart. Go to the work space and pull out an exec node and use nmap
You should get back a similar message.
The other way would be to use a command line sensor and ssh into the pi to run
sudo systemctl status callattendant.service
It’s a little more involved but you should be able to create a binary sensor to tell if the service is running or not
https://www.home-assistant.io/integrations/command_line/#check-if-a-system-service-is-running
Use this guide to setup shh access from HA to the pi.
Edit: if nmap works, if the service is up and running, the name of the service will be in the return string. If it is not it won’t show up. You can isolate this message with a switch node.