586837r / node-red-contrib-alexa-remote2

MIT License
88 stars 72 forks source link

(Q) Output status of node #135

Open cg089 opened 4 years ago

cg089 commented 4 years ago

Hi, is there any way to get continous status output ("ready", "please visit ip:3456")? I would like to send me a message, when the node needs the amazon site to be visited again.

Thanks!

craigayre commented 4 years ago

It's been almost 5 months since this has been asked but I did something similar to this today so figured I'd share.

You can use the status node to achieve this

image

Configure it to listen to the status of the On Device Activity node

image

From there you can access the text through msg.status.text

I have an automation that listens for status updates and opens the link in a new tab so I can reauthenticate when needed.

image

[{"id":"c8505ea0.55aa2","type":"switch","z":"8126516b.4586e","name":"","property":"msg.status.text","propertyType":"msg","rules":[{"t":"eq","v":"open 192.168.0.77:3456 in your browser","vt":"str"},{"t":"eq","v":"no JSON","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1370,"y":80,"wires":[["ea2cd8b1.9f4aa8"],["37432305.4756ec"]]},{"id":"ea2cd8b1.9f4aa8","type":"exec","z":"8126516b.4586e","command":"ssh mbp 'open -a \"Google Chrome\" http://192.168.0.77:3456/'","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"","x":1690,"y":40,"wires":[[],[],[]]},{"id":"82418c6e.87d27","type":"status","z":"8126516b.4586e","name":"","scope":["bfb8b7f0.c4eb68"],"x":1120,"y":80,"wires":[["5c47c198.3d94c"]]},{"id":"5c47c198.3d94c","type":"rbe","z":"8126516b.4586e","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"status.text","x":1250,"y":80,"wires":[["c8505ea0.55aa2"]]},{"id":"37432305.4756ec","type":"api-call-service","z":"8126516b.4586e","name":"","server":"59830e87.88141","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_craigs_iphone","entityId":"","data":"{ \"message\": \"Failed to setup node-red-contrib-alexa-remote2\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1610,"y":120,"wires":[[]]},{"id":"59830e87.88141","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
cg089 commented 4 years ago

Will try tonight, ty!!