This Python script fetches the location data from Google and publishes it to MQTT.
This script has been provided by user Marmoset_Threat in this thread on openHAB community forum
I've adopted script for use in Docker container.
Folowing env variables can be passed to Docker container to configure it:
- GOOGLE_EMAIL - email to log in to Google services (empty by default, required)
- COOKIES_FILE - file with session cookies (default 'googlemaps_cookie.txt')
- MQTT_CLIENT_NAME - name of the MQTTclient (default 'google_location_mqtt')
- MQTT_HOST - hostname or ip address of MQTT server (default 'localhost')
- MQTT_PORT - port of MQTT server (default '1883')
- MQTT_TOPIC - topic to which events will be stored to (default 'googlelocation/')
- MQTT_USER - username for MQTT authentication (empty by default)
- MQTT_PASS - password for MQTT authentication (empty by default)
- INTERVAL - Google location services polling interval in seconds (default 60)
Example usage:
put your googlemaps_cookie.txt in current directory
docker run -ti --name google-location -e GOOGLE_EMAIL=my_email@gmail.com -v ./:/files/ kamikac/google-location