I’ve got the opposite, I get location, then unknown
I just found if I remove this line of code then it doesn’t report unknown
client.publish(f"{base_topic}/state", state)
But I’m not quite sure if that throws it off in other ways, but it seems to be working for me. According to the MQTT device tracker - Home Assistant docs it states: Using state_topic is optional when using json_attributes_topic to determine the state of the device tracker.
It seems your PR addresses this somewhat but I still got unknown state with it. But when I removed the above line I no longer got unknown state after each update. Although I haven’t tested it with Semantic Location.
More testing and yes when a Semantic Location is reported my hack didn’t work. But with a few small changes I think I’ve found a way to work with Semantic Location, and not have the unknown location state reported just before the real state. I’ll follow up in the PR you opened.
Hi @xHecktor ,
Thks for your reply, I’ve finally read the other posts above and tried with the version from GitHub - txitxo0/googlefindmytools-homeassistant: Fork of Google Find My Device trackers that can publish the locations to an MQTT topic discoverable by home assistant but it seems I’m not doing everything as it should because this time Google CHrome is launching, I can log in to Google but after this the script stops with :
If you want to see locations of a tracker, type the number of the tracker and press 'Enter'.
If you want to register a new ESP32- or Zephyr-based tracker, type 'r' and press 'Enter': 8
Traceback (most recent call last):
File "/home/lolomin/googlefindmytools-homeassistant/main.py", line 10, in <module>
list_devices()
~~~~~~~~~~~~^^
File "/home/lolomin/googlefindmytools-homeassistant/NovaApi/ListDevices/nbe_list_devices.py", line 72, in list_devices
get_location_data_for_device(selected_canonic_id, selected_device_name)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: get_location_data_for_device() missing 1 required positional argument: 'name'
after this the Auth/secrets.json is generated but I’m not able to find the profile directory as explained on step 1 of Docker deployment :
Generate Session Data (One-Time Setup): a. On your local computer, run the authentication script: python main.py. b. A Chrome window will open. Log in to your Google Account. The script will exit after listing your devices. c. This creates a user profile folder. The location depends on your OS:
Linux: ~/.config/undetected_chromedriver
there is some improvements now but not yet a functionnal way to get informations from Google FindMy devices ![]()
Thks !
lolo
Hi,
Finally found that if I take the Auth/secrets.json and provide it to docker with docker-compose.prod.yml, it works.
But what will be the duration for secrets.json to be valid before not able to get any data from Google please ?
Regards,
lolo
Hi,
I managed to make this into an Add-on (with a lot of help from Claude.ai).
Can someone help clean this up and making it an official Add-on?
Get the code from GitHub - endeavour/GoogleFindMyTools-homeassistant: Fork of Google Find My Device trackers that can publish the locations to an MQTT topic discoverable by home assistant and place it in: /addons/local/google_find_my_tools/
In the same dir - create config.json:
{
"name": "Google Find My",
"description": "Track Google Find My devices and publish to MQTT",
"version": "1.0.1",
"slug": "google_find_my_tools",
"init": false,
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
"startup": "services",
"boot": "manual",
"options": {
"mqtt_broker": "core-mosquitto",
"mqtt_port": 1883,
"mqtt_username": "",
"mqtt_password": "",
"update_interval": 300
},
"schema": {
"mqtt_broker": "str",
"mqtt_port": "int",
"mqtt_username": "str?",
"mqtt_password": "password?",
"update_interval": "int"
},
"services": ["mqtt:need"]
}
In the same dir create run.sh:
#!/bin/bash
# Read configuration from options.json (Home Assistant add-on config)
if [ -f /data/options.json ]; then
export MQTT_BROKER=$(jq -r '.mqtt_broker // "core-mosquitto"' /data/options.json)
export MQTT_PORT=$(jq -r '.mqtt_port // 1883' /data/options.json)
export MQTT_USERNAME=$(jq -r '.mqtt_username // ""' /data/options.json)
export MQTT_PASSWORD=$(jq -r '.mqtt_password // ""' /data/options.json)
export UPDATE_INTERVAL=$(jq -r '.update_interval // 300' /data/options.json)
else
export MQTT_BROKER="core-mosquitto"
export MQTT_PORT="1883"
export MQTT_USERNAME=""
export MQTT_PASSWORD=""
export UPDATE_INTERVAL="300"
fi
echo "Starting Google Find My Tools..."
echo "MQTT Broker: $MQTT_BROKER"
echo "MQTT Port: $MQTT_PORT"
echo "Update interval: $UPDATE_INTERVAL seconds"
cd /app
while true; do
echo "$(date): Running Google Find My update..."
python3 publish_mqtt.py
if [ $? -eq 0 ]; then
echo "$(date): Update completed successfully"
else
echo "$(date): Update failed with exit code $?"
fi
echo "$(date): Sleeping for $UPDATE_INTERVAL seconds..."
sleep "$UPDATE_INTERVAL"
done
In the same dir, create Dockerfile:
FROM alpine:3.21
ENV LANG=C.UTF-8
ENV CHROME_BIN=/usr/bin/chromium-browser
ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver
RUN apk add --no-cache \
python3 \
py3-pip \
gcc \
musl-dev \
python3-dev \
libffi-dev \
openssl-dev \
cargo \
rust \
bash \
curl \
jq \
&& rm -rf /var/cache/apk/*
WORKDIR /app
COPY requirements.txt .
RUN pip3 install --upgrade pip --break-system-packages && \
pip3 install --no-cache-dir --break-system-packages -r requirements.txt
# Copy all application files
COPY . .
# Create run.sh directly in Dockerfile if it doesn't exist properly
RUN echo '#!/bin/bash' > /run.sh && \
echo 'if [ -f /data/options.json ]; then' >> /run.sh && \
echo ' export MQTT_BROKER=$(jq -r ".mqtt_broker // \"core-mosquitto\"" /data/options.json)' >> /run.sh && \
echo ' export MQTT_PORT=$(jq -r ".mqtt_port // 1883" /data/options.json)' >> /run.sh && \
echo ' export MQTT_USERNAME=$(jq -r ".mqtt_username // \"\"" /data/options.json)' >> /run.sh && \
echo ' export MQTT_PASSWORD=$(jq -r ".mqtt_password // \"\"" /data/options.json)' >> /run.sh && \
echo ' export UPDATE_INTERVAL=$(jq -r ".update_interval // 300" /data/options.json)' >> /run.sh && \
echo 'else' >> /run.sh && \
echo ' export MQTT_BROKER="core-mosquitto"' >> /run.sh && \
echo ' export MQTT_PORT="1883"' >> /run.sh && \
echo ' export MQTT_USERNAME=""' >> /run.sh && \
echo ' export MQTT_PASSWORD=""' >> /run.sh && \
echo ' export UPDATE_INTERVAL="300"' >> /run.sh && \
echo 'fi' >> /run.sh && \
echo 'echo "Starting Google Find My Tools..."' >> /run.sh && \
echo 'echo "MQTT Broker: $MQTT_BROKER"' >> /run.sh && \
echo 'cd /app' >> /run.sh && \
echo 'while true; do' >> /run.sh && \
echo ' echo "$(date): Running Google Find My update..."' >> /run.sh && \
echo ' python3 publish_mqtt.py' >> /run.sh && \
echo ' if [ $? -eq 0 ]; then' >> /run.sh && \
echo ' echo "$(date): Update completed successfully"' >> /run.sh && \
echo ' else' >> /run.sh && \
echo ' echo "$(date): Update failed with exit code $?"' >> /run.sh && \
echo ' fi' >> /run.sh && \
echo ' echo "$(date): Sleeping for $UPDATE_INTERVAL seconds..."' >> /run.sh && \
echo ' sleep "$UPDATE_INTERVAL"' >> /run.sh && \
echo 'done' >> /run.sh && \
chmod +x /run.sh
CMD ["/run.sh"]
Add your auth/token.
Go to the Add-on Store - Click Install - Configure your MQTT options - Run.
The code is still too “green” for a add-on. It needs a lot of work, improvement and testing.
I chatted with the owner of this repo GitHub - txitxo0/googlefindmytools-homeassistant: Fork of Google Find My Device trackers that can publish the locations to an MQTT topic discoverable by home assistant and he plans to refactor and improve the code and eventually make it an add-on, when he gets the time.
That’s why I made a PR for the semantic location fix directly in that repo.
I’ll be happy with a working container ![]()
I have the script running and it’s been there for over 24 hours and still going, still getting updates.
EDIT: Figured it out. The folder in the repo is named “Auth” but the script is looking for “auth”. Assuming it will only break new deployments after the change was made that made all instances of “Auth” lowercase in every script.
I feel like I’m missing something dumb. Getting this error, via docker and baremetal. Any ideas?
google-find-my-tools | Traceback (most recent call last):
google-find-my-tools | File "/app/publish_mqtt.py", line 11, in
google-find-my-tools | from auth.fcm_receiver import FcmReceiver
google-find-my-tools | ModuleNotFoundError: No module named 'auth'
I also had a problem with “Auth” so renamed the folder to “auth”. This solved the problem. But unfortunately, the script was never success with opening the chrome browser, even when I gave it a full path to chrome.exe. Did it work for you ?
I’m not on Windows, but hopefully someone else might be able to advise on that.
Are you using the latest version? I think the dev just made some changes to that part and there’s never 2 different requirement files depending on what stage you’re at. Might be worth trying from scratch again?
I recommend trying with a fresh pull from the Git repo. Once I realized that the capitalization was the problem, I started fresh and had no issues. I also started right from a folder in the C: drive. The only reason I ran it there first was to get it authenticated. Then, I moved the entire directory to a Debian LXC on one of my Proxmox servers, since the Docker container does not work due to the capitalization issue.
I did get the publish_mqtt.py to run fully through windows, though. So, it should work with renaming the auth path.
Awesome!
Do you have any idea why cron-based running may start to report:
Error: Message publish failed: The client is not currently connected.
UPD: found, sometimes script execution hangs so the second instance can’t publish results, I’ve configured another cron job to kill the previous instance, hopefully it will work.
I want to integrate my brand new Chipolo Pop into Home Assistant, but I am confused on what GitHub repository / fork is best to go with? ![]()
Right now I’ve got a MQTT broker running in a Docker on my NAS and HA running separately in a VM.
I’ve manage to use the docker.
Here is the compose I used. Had to copy the Auth folder to myfolder/Auth.
I still have to figure some stuff out as I have to restart the container every few hour or it just stop pulling info.
google-find-my-tools:
image: ghcr.io/txitxo0/googlefindmytools-homeassistant:latest
container_name: google-find-my-tools
restart: unless-stopped
volumes:
- "myfolder/Auth:/app/auth"
environment:
- MQTT_BROKER=your_mqtt_ip_without_""
- MQTT_PORT=integer_without_""
- REFRESH_INTERVAL=integer_without_""
Unfortunately docker compose is not created for arm64, I cannot install it on raspberry pi, I get
Network google-find-my_default Creating
Network google-find-my_default Created
Container google-find-my-tools Creating
google-find-my-tools IPv4 forwarding is disabled. Networking will not work.
google-find-my-tools The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Container google-find-my-tools Created
Container google-find-my-tools Starting
Container google-find-my-tools Started
Google Find My Tools – Docker Deployment (What Worked for Me)
Steps
-
Clone the repository
git clone https://github.com/txitxo0/googlefindmytools-homeassistant.git cd googlefindmytools-homeassistant -
Install prerequisites (Debian/Ubuntu)
sudo apt update sudo apt install -y python3 python3-pip -
Install Python dependencies
pip3 install -r requirements.dev.txt -
Rename the auth folder (case-sensitive)
mv Auth auth -
Create
secrets.json
Follow Step 1 in the repo’s Docker deployment instructions to sign in to your Google account and generate thesecrets.jsonfile. -
(Optional) Prevent entities from flipping to “unknown”
If you prefer that entities don’t switch to unknown on every update, remove lines 115–117 inpublish_mqtt.py. -
Build the Docker image
docker build -t google-find-my-tools . -
Create
docker-compose.yml
Save the following asdocker-compose.ymlin the project root:version: "3.9" services: google-find-my-tools: image: google-find-my-tools container_name: google-find-my-tools restart: unless-stopped environment: MQTT_BROKER: "192.168.1.11" MQTT_USERNAME: "mqtt_user" MQTT_PASSWORD: "mqtt_user_pw" REFRESH_INTERVAL: "150" DEVICE_NAMES_FILTER: "CarY,Workkey,Bike,CarX" # optional: comma-separated filter volumes: - /root/googlefindmytools-homeassistant/auth:/app/auth -
Adjust the auth path
Change/root/googlefindmytools-homeassistant/authin the volume mapping to the correct path on your filesystem if needed. -
Start the container
docker compose up -d
Notes
- Replace the MQTT settings with your actual broker, username, and password.
- Replace the device name filter string with your own devices, or leave it empty to include all.
- I currently restart the container every few hours because the script stops working; overall it works, though.
- If you don’t want use docker-compose you can use the command from step 3 in the original repo instructions.
I hope this helps someone!
Cheers
Harry
i have a question, is kind of noob, because i’m still learning about docker…
when you run “pip3 instal -r requirements.dev.txt”
this will be installed on the docker host, not the container that you will create after? or these instalations are need for conteiner start on this host?
I supose that a conteiner is all packed plugins, instalations, and addons necessary to run an application to work and not need to install anything on host
The pip3 command installs the Python requirements on the host. These are required in order to run main.py and create the secrets.json file. These requirements are also installed in the container when it is built.
These requirements are not needed to run the container. Everything that is needed is inside the container.
I hope I could clarify it.
Cheers, Harry
I am currently working on a Home Assistant integration. I have it working to the point of not requiring any external scripts, docker, or MQTT integration to run normally.
The only unfortunate thing is the authentication sitll requires running main.py on a different computer to get the initial token from secrets.json. I’ve been trying to get the auth workflow merged into my integration but have unsuccessful up to this point. Still kicking around different options if anyone has any ideas.
I don’t have it up on GitHub public yet. Potentially next week once I’ve let it soak for a while.
drumroll
