2

I need the bluetooth name on Pi to change to the current IP of the PI so i can ssh into it because Im constantly changing WIFI and my IP Address always changes.

I have tried FING but sometimes im on a network with over 500 people so a scan takes way too long and burns up my phone ,Ive also tried DATAPLICITY but that only works If the network has internet which isnt always the case.

I am hoping when I power up the PI its bluetooth name changes to the IP i need to ssh into it or if possible to access/edit the wpa_supplicant.conf file via Bluetooth

1 Answers1

1

You wouldn't need python for something like this, a simple shell script can do the trick as follows:-

bt-name-ip.sh:

#!/usr/bin/env bash

# Get current IP address
IP_ADDR=`hostname -I`

# Set new Bluetooth name
hciconfig hci0 name $IP_ADDR

# Check that the Bluetooth name has changed
hciconfig hci0 name

You will need to set the script as an executable and maybe give it root permissions in order for it to run the hciconfig command.

I hope this helps.

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72