How to setup this messed up sensor configs

So, I’m looking for a way to track where my home assistant instance is getting HTTP requests from.

I have a text_helper that gets updated with the IP address when a request comes in, and I want to geolocate that IP.

I have a shell scripts that uses the the IPinfo API to get the data, but this is where i’m stuck.

I need to pass the IP address as an argument to that shell script and then get the output and save it to maybe a text_helper in home assistant for tracking.

Does anyone have any idea how to do this or ever propose a better way to do it?

Why not write to a file?

Instead of writing the ip to the first input_text just pass it directly to the automation that runs the shell script, then either write directly to a file with the shell script or pass it back to homeassistant and write to a file with the notify component.

The only automation I have setup to this point is calling a shell command to scrape the IP from the HTTP access logs.

Are you suggesting I perform the geolocation in this same process and just pass the data back to homeassistant? I was kind of hoping to keep both, the IP and geolocation information.

Not sure how any of this would look like on the automation side though.

You’re in charge of what gets written to the file, put whatever you want in it :man_shrugging:

I would use the same shell command to both get the ip and perform the check, and then tbh I would just write the time, ip and result straight in to a file from the script. Simplicity is usually the best way to go.