Can NodeRed Do a Httping To ping a Webpage

hi since i cant get what i want which is mqtt from a caller id software in the py file… and the author isnt interested in adding a mqtt that sends every 10 min to keep alive he talked about a Httping something about pinging a webpage… so i can get a a connected or disconnect … so can nodered do something like this?

https://flows.nodered.org/node/node-red-node-ping

The Ping Node?

@Biscuit that looks like regular ping

needs to be “httping”

like
https://www.vanheusden.com/httping/
or
https://linux.die.net/man/1/httping

or
GitHub - pjperez/httping: httping - A tool to measure RTT on HTTP/S requests

its a ping for a webpage to see if a webpage is working

i want to be able to ping

http://192.168.0.50:5000 to seethat its working and when its not to show its disconnected but when its up and working that its connected… and do this every like 10 min

Http request node then.

Call the website and see if it responds.

@Biscuit so i tried some google stuff but i wanted a true false and just for the page i tried my own but its not quite working… i trying to get a true or false

and its supposed to run every 10 min as soon as Node red launches… not sure i didnt see a node red boot or a home assistant boot or start… for a trigger to run every 10 min

but this is what i got i said it it gets the cant find a webpage error then its False and if it doesnt equal the error then its true but its not working right

[{"id":"d131d4caadc4a94d","type":"inject","z":"feb1b184abb55693","name":"make request","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":130,"y":1980,"wires":[["941b231e2ab42149"]]},{"id":"941b231e2ab42149","type":"http request","z":"feb1b184abb55693","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.0.20:5000","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":310,"y":1980,"wires":[["71c3e52cbdbb0bca"]]},{"id":"71c3e52cbdbb0bca","type":"switch","z":"feb1b184abb55693","name":"","property":"payload.string","propertyType":"msg","rules":[{"t":"neq","v":"RequestError: connect ECONNREFUSED 192.168.0.20:4000","vt":"str"},{"t":"eq","v":"RequestError: connect ECONNREFUSED 192.168.0.20:4000","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":1980,"wires":[["cbc0a15a87724ecf"],["231d6ef996b71c2f"]]},{"id":"6cc80515fe7b0e93","type":"debug","z":"feb1b184abb55693","name":"debug 23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1040,"y":1980,"wires":[]},{"id":"30cccd3eceec1280","type":"ha-binary-sensor","z":"feb1b184abb55693","name":"Caller Id Status","entityConfig":"43dd031a66106cf4","version":0,"state":"payload.status","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":860,"y":1980,"wires":[["6cc80515fe7b0e93"]]},{"id":"cbc0a15a87724ecf","type":"change","z":"feb1b184abb55693","name":"Set To True","rules":[{"t":"set","p":"payload.status","pt":"msg","to":"True","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":1960,"wires":[["30cccd3eceec1280"]]},{"id":"231d6ef996b71c2f","type":"change","z":"feb1b184abb55693","name":"Set To False","rules":[{"t":"set","p":"payload.status","pt":"msg","to":"False","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":2000,"wires":[["30cccd3eceec1280"]]},{"id":"1996419553ee726a","type":"trigger-state","z":"feb1b184abb55693","name":"","server":"915baa48.9b1898","version":4,"inputs":0,"outputs":2,"exposeAsEntityConfig":"","entityIdType":"exact","debugEnabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":""}],"customOutputs":[],"outputInitially":false,"stateType":"str","enableInput":false,"x":180,"y":1920,"wires":[[],["941b231e2ab42149"]]},{"id":"43dd031a66106cf4","type":"ha-entity-config","server":"915baa48.9b1898","deviceConfig":"","name":"Caller Id Status","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Callattendant Current Status"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"connectivity"}],"resend":false,"debugEnabled":false},{"id":"915baa48.9b1898","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}]

@Biscuit i got it to work … i guess this is right maybe u can take a look at… it didnt work the way i wanted… and it didnt work the way i wanted to search for a key word… i took what i could find from a nodered example from the nodered page… and what it spit out i used… as i was trying to use < title> as the search word and not “.text”
but there wasnt enough google searchs…

but here is what i got

[{"id":"9d705cfbd4007653","type":"http request","z":"feb1b184abb55693","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.0.20:5000","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":370,"y":2200,"wires":[["e03b5ffbe6da7ec3"]]},{"id":"e03b5ffbe6da7ec3","type":"html","z":"feb1b184abb55693","name":"","property":"payload","outproperty":"payload","tag":".text","ret":"text","as":"single","x":430,"y":2280,"wires":[["99110dfd79ad724a"]]},{"id":"6cc80515fe7b0e93","type":"debug","z":"feb1b184abb55693","name":"debug 23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1020,"y":2200,"wires":[]},{"id":"30cccd3eceec1280","type":"ha-binary-sensor","z":"feb1b184abb55693","name":"Caller Id Status","entityConfig":"43dd031a66106cf4","version":0,"state":"payload.status","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":860,"y":2200,"wires":[["6cc80515fe7b0e93"]]},{"id":"cbc0a15a87724ecf","type":"change","z":"feb1b184abb55693","name":"Set To True","rules":[{"t":"set","p":"payload.status","pt":"msg","to":"True","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":2180,"wires":[["30cccd3eceec1280"]]},{"id":"231d6ef996b71c2f","type":"change","z":"feb1b184abb55693","name":"Set To False","rules":[{"t":"set","p":"payload.status","pt":"msg","to":"False","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":2220,"wires":[["30cccd3eceec1280"]]},{"id":"99110dfd79ad724a","type":"switch","z":"feb1b184abb55693","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Permit Next Call","vt":"str"},{"t":"neq","v":"Permit Next Call","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":2200,"wires":[["cbc0a15a87724ecf"],["231d6ef996b71c2f"]]},{"id":"853a468280ef83a9","type":"trigger","z":"feb1b184abb55693","name":"Loop Every 10 Min","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"-3","extend":false,"overrideDelay":false,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":230,"y":2280,"wires":[["9d705cfbd4007653"]]},{"id":"dd3b372968a50ad5","type":"server-events","z":"feb1b184abb55693","name":"Start When Nodred Starts","server":"915baa48.9b1898","version":3,"exposeAsEntityConfig":"","eventType":"home_assistant_client","eventData":"","waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"x":110,"y":2200,"wires":[["853a468280ef83a9"]]},{"id":"43dd031a66106cf4","type":"ha-entity-config","server":"915baa48.9b1898","deviceConfig":"","name":"Caller Id Status","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Callattendant Current Status"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"connectivity"}],"resend":false,"debugEnabled":false},{"id":"915baa48.9b1898","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}]

What if you use msg.statusCode = 200?

[{"id":"6cc80515fe7b0e93","type":"debug","z":"e619903b29c504e2","name":"debug 23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":940,"y":460,"wires":[]},{"id":"1a2464ca9f50340f","type":"inject","z":"e619903b29c504e2","name":"Start and every 10 min","props":[],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":150,"y":460,"wires":[["54adf51192521f4d"]]},{"id":"54adf51192521f4d","type":"http request","z":"e619903b29c504e2","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.0.20:5000","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":350,"y":460,"wires":[["4cd9553fe1a93885"]]},{"id":"4cd9553fe1a93885","type":"switch","z":"e619903b29c504e2","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":460,"wires":[["e8de86c4bef9da6b"],["3963e5ee5f188320"]]},{"id":"e8de86c4bef9da6b","type":"change","z":"e619903b29c504e2","name":"Set To True","rules":[{"t":"set","p":"something","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":440,"wires":[["6cc80515fe7b0e93"]]},{"id":"3963e5ee5f188320","type":"change","z":"e619903b29c504e2","name":"Set To False","rules":[{"t":"set","p":"something","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":480,"wires":[["6cc80515fe7b0e93"]]}]

I’m not able to look at this in detail at the moment, perhaps next week…

Ping is a standard tool, with most well behaved servers returning a Pong, from which we know the server itself is OK, and the network response time.

There are a few contrib-node variations on Ping, but I can’t see much in the way of httping support. Certainly it looks a useful tool, being a more realistic test to see if the server is not only working, but can actually serve up the correct http response with a particular element embedded.

Node-RED is a great prototyping tool, so it should be quick to put something together like this. It might also make a good project for a packaged sub flow as a published node. Actually writing a contrib-httpingy-node is well beyond me, but it would be a good learning exercise.

@walberjunior that worked…
i had to use “msg.payload” i had “msg.payload.status” but it throws an error about objects… why can you use msg.payload.staus for a node… without an error other times u get error… but if you change it to msg.payload no error…

[{"id":"40eca5f97ba64206","type":"debug","z":"feb1b184abb55693","name":"debug 23","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1080,"y":2060,"wires":[]},{"id":"c2ac9b3207f5dd74","type":"inject","z":"feb1b184abb55693","name":"Start and every 10 min","props":[],"repeat":"600","crontab":"","once":true,"onceDelay":0.1,"topic":"","x":170,"y":1960,"wires":[["ac6b9efabac8d238"]]},{"id":"ac6b9efabac8d238","type":"http request","z":"feb1b184abb55693","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.0.20:5000","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":310,"y":2060,"wires":[["f02957d6fa79da97"]]},{"id":"f02957d6fa79da97","type":"switch","z":"feb1b184abb55693","name":"","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":2060,"wires":[["c7e2dece7c880414"],["1b0ed2d76dbb57f4"]]},{"id":"c7e2dece7c880414","type":"change","z":"feb1b184abb55693","name":"Set To True","rules":[{"t":"set","p":"payload.status","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":2040,"wires":[["0783906936c38a44"]]},{"id":"1b0ed2d76dbb57f4","type":"change","z":"feb1b184abb55693","name":"Set To False","rules":[{"t":"set","p":"payload.status","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":2080,"wires":[["0783906936c38a44"]]},{"id":"0783906936c38a44","type":"ha-binary-sensor","z":"feb1b184abb55693","name":"Caller Id Status","entityConfig":"43dd031a66106cf4","version":0,"state":"payload.status","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":880,"y":2060,"wires":[["40eca5f97ba64206"]]},{"id":"43dd031a66106cf4","type":"ha-entity-config","server":"915baa48.9b1898","deviceConfig":"","name":"Caller Id Status","version":"6","entityType":"binary_sensor","haConfig":[{"property":"name","value":"Callattendant Current Status"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":"connectivity"}],"resend":false,"debugEnabled":false},{"id":"915baa48.9b1898","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}]

but that works better i did see the Status Code 200 in a video or so but they didnt show like this… which is much better

and the error i got


5/26/2024, 8:35:07 AMnode: Set To True
msg : string[54]
"Cannot set property of non-object type: payload.status"
5/26/2024, 8:35:07 AMnode: Caller Id Status
msg : error
"NoConnectionError: NoConnectionError"
5/26/2024, 8:35:07 AMnode: Set To True
msg : string[54]
"Cannot set property of non-object type: payload.status"
5/26/2024, 8:35:07 AMnode: Caller Id Status
msg : error
"NoConnectionError: NoConnectionE

so what the non-object mean… if its msg.payload no error but if i use the msg.payload.status i get the error…

and i appreciate all the help… it helps…

@Biscuit ah ok i learning every day… trying to improve things and i didnt know nodered was a proto type figured was a regular program everyone uses… always learning…

now i having difficulties trying to get HA into https so i can use Voice Assistant and been having issues so i gotta make a new help under which heading i not sure but ill have to do that next…

i appreciate all the helps … always learning

What is this address from? Is this a separate computer or an addon in HA?

@Mikefila its actually a raspberry pi running “Callattendant” a caller ID /Blocker program i use to block spammers… and to display Calls coming in to Displays through Home Assistant… and Throught Speakers through Home Assistant I made it so it says " John Doe Is Calling"

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.

image