pyicloud2mqtt allows you to send data from icloud webservices to a mqtt broker. It is based on the famous PyiCloud project.
It just forwards the retrieved data of the connected devices on your iCloud account to an mqtt broker as a JSON document.
Only data (e.g. battery level or location) that is available with user / password authentication will be sent to mqtt.
Sending data to iCloud is also not supported.
- iCloud credentials
- MQTT broker (e.g. Eclipse Mosquito)
- (optional) Docker
The configuration is done via environment variables
env variable | Description | Default |
---|---|---|
ICLOUD_ACCOUNT | your apple id | |
ICLOUD_PASS | your apple password | |
MQTT_HOSTNAME | hostname or ip address of your mqtt broker | |
MQTT_PORT | port of the mqtt broker | 1883 |
MQTT_USER | (optional) username for mqtt broker | |
MQTT_PASSWORD | (optional) password for mqtt broker | |
MQTT_BASEPATH | path of mqtt topic e.g. homeassistant/component | icloud/ |
UPDATE_INTERVAL | interval in minutes how often the icloud webservices will be called | 5 |
You can start it on the commandline:
pip3 install -r requirements.txt
python3 cloud.py
or via docker / docker-compose. A simple docker-compose.yml is included. There is an env_template
file included that can be used.
cp env_template .env
# change values in .env file
docker-compose up -d