Zanzito User Manual

Version 2.0 · 27 November 2026 · Gianluca Barbaro

  1. 1. Introduction
  2. 2. Before you start
  3. 3. Settings
    1. 3.1 MQTT connection
    2. 3.2 Outbound
    3. 3.3 Inbound
    4. 3.4 Voice
    5. 3.5 More settings
  4. 4. The home screen
  5. 5. Moving around the app
  6. 6. Licence levels
  7. 7. Running in the background
  8. 8. Android permissions
  9. 9. Privacy
  10. A1. Status messages
  11. A2. SSL/TLS and WebSocket
  12. A3. Types of Report
  13. A4. Pictures over MQTT
  14. A5. Access rules with Mosquitto
  15. A6. The Admin module
  16. A7. Remote administration
  17. A8. Home Assistant

1. Introduction

Zanzito is an application that acts as a bridge between your Android device and an MQTT server. MQTT is a lightweight means of communication between systems, such as your home-automation system and the sensors and devices in your home. It is based on publishing messages and subscribing to topics: clients connect to a server, called the broker, publish messages to topics, and receive the messages of the topics they subscribed to.

With Zanzito your Android device becomes one of those clients. It can send to your broker:

And it can receive:

If you use Home Assistant, Zanzito can add itself to it, with an entity for each of these functions and nothing to write in the configuration of Home Assistant (§3.1, A8).

Throughout this manual, <device-name> stands for the name of the device as set in Zanzito (§3).

2. Before you start

You need an MQTT broker that your device can reach: Zanzito does not provide one.

The broker address Zanzito comes with is a public server. test.mosquitto.org is the public test server of the Eclipse Mosquitto project. It lets you check that the app connects, and nothing more: on that server everything you send can be read by anyone, and the connection is not encrypted.

Enter the address of your own broker, as described in §3.1, before you turn on location, photos or anything else. To protect the connection over the Internet, see A2.

Nothing is sent until you start the connection, with Connect on the home screen (§4).

If you connect without changing the address, Zanzito says that the broker is public and asks you to confirm before it connects; the automatic connection (§3.5) waits for that confirmation too. Once Zanzito has connected to any broker, it does not ask again.

When it starts, Zanzito asks for the Android permissions that the functions switched on at that moment need (§8). On Android 13 and later the first one is the permission to show notifications: without it you will not see the status of the connection, nor the messages and alarms that arrive.

3. Settings

The settings are under Preferences: the button at the top right of the home screen, or More → Preferences. The first item is the Device name, which Zanzito uses to build the topics it publishes and subscribes to: all of them begin with zanzito/<device-name>/. If you leave it empty, the Android ID of the device is used. Choose a short name of your own; letters, digits, underscore and full stop are allowed.

By subscribing to zanzito/# on your broker you see every message that Zanzito sends.

The Preferences screen: Basic, Outbound, Inbound and Advanced sections
Preferences

3.1 MQTT connection

Under MQTT Connection you set:

Under Security:

Under Home host you can give Zanzito a second address for the same broker, to be used when the device is on your home network:

When the device is connected to one of those networks Zanzito switches to the home address, and back to the main one when it leaves. A common setup is a plain MQTT connection at home and a WebSocket with SSL/TLS outside.

Android shows the name of the Wi-Fi network only to apps that hold the Location permission, with location switched on. When you enter a home network, Zanzito asks for the permission; if it is still missing when Zanzito starts, Zanzito explains why it needs it and asks again. Without location tracking, Zanzito uses the permission only to read the name of the network. If you refuse, it stays on the main address, and the log says why.

Under Update modes you decide when Zanzito sends its updates:

You can also ask for an update by hand, with Report on the home screen, or remotely (A7).

Under Home Assistant:

3.2 Outbound

What Zanzito sends: location, sensors, photos.

Location

FIND integration. FIND is an indoor-positioning server that tells which room a device is in from the Wi-Fi networks it sees. When enabled, Zanzito publishes the Wi-Fi fingerprint of the device — the access points in range and their signal strength — to the topics that a FIND server connected to the same broker listens to:

<group-name>/track/<device-name>
<group-name>/learn/<device-name>/<location-name>

FIND and the Owntracks emulation below are available only with Track Location on. You need a FIND server of your own; refer to its documentation. Current versions of Android limit how often an app may scan for Wi-Fi networks, so the fingerprint is refreshed less often than it was on older ones.

Owntracks emulation. When on, the position is published in the format of the OwnTracks app, instead of on zanzito/<device-name>/location:

owntracks/<user>/<device>
{"_type":"location","tid":"ph","batt":87,"lon":9.19,"lat":45.46,"alt":120.0,"acc":12,"tst":1795460000}

Changed in version 2.0. Earlier versions built this topic the wrong way round: owntracks//<device> without a user name, and the device name in place of the user name when there was one. If you used the emulation, update the topic in your automations.

Home Assistant does not need this emulation (A8).

Sensors

The list shows Battery level and the hardware sensors your device has. Tick the ones you want. Each is published to a topic of its own, named after the sensor in lower case with underscores:

zanzito/<device-name>/battery_level 87
zanzito/<device-name>/<sensor_name> <value>

A sensor with a single value, such as light or pressure, sends a number. Sensors with several values, such as the accelerometer, the gyroscope or the magnetometer, send a JSON object:

zanzito/<device-name>/<sensor_name> {"value0":0.12,"value1":9.78,"value2":0.40}

Photos

Pictures taken by Zanzito are turned upright and stamped with the date and time. They are sent as JPEG, as the binary payload of the message:

zanzito/<device-name>/picture <binary data>
zanzito/shared_pictures/<device-name> <binary data>     (only with Share photos; retained)

Your system must be able to take the image out of the payload: see A4, and A8 for Home Assistant, which can do it by itself. Zanzito also sends the pictures that other apps share to it.

3.3 Inbound

What Zanzito accepts from the broker. Text notifications, photos, alarms and texts to read aloud (§3.4) are received by default: switch off what you do not use, since whoever can publish on your broker can make the device ring or speak.

Push notifications

Notifications with buttons, pictures and channels

Instead of plain text, the notification topic accepts a JSON object. Only title or message is needed; add the other keys as you need them:

{"title": "Front door", "message": "Someone rang the bell",
 "channel": "Doorbell", "priority": "high", "tag": "door",
 "image": "http://192.168.1.20/snapshot.jpg",
 "actions": [{"title": "Open the gate", "topic": "home/gate/set", "payload": "open"},
             {"title": "Ignore"}]}
A Zanzito notification titled Front door, Someone rang the bell, with the buttons Open the gate, Talk and Ignore
A notification with three buttons
KeyValue
titleThe title of the notification.
messageThe text.
channelThe name of an Android notification channel, up to 40 characters. Zanzito creates the channel the first time a message uses it; from then on its sound and its importance are set in the Android settings of Zanzito, channel by channel, and can be different for each kind of message.
prioritymin, low, default, high or max. With high and max the notification pops up on the screen; with min and low it makes no sound. A new channel takes it as its importance; without a channel, the message goes to a channel for that priority, such as “Messages, high priority”.
tagA notification with the same tag replaces the one on the screen instead of adding another one. {"tag": "door", "clear": true} removes it and shows nothing.
actionsUp to three buttons. Touching one publishes its payload to its topic (QoS 1, not retained) and closes the notification. Without topic, the payload goes to zanzito/<device-name>/action; without payload, the title is sent. If the message cannot leave, because the connection is off, the notification stays there.
imageThe http:// or https:// address of a picture, shown in the expanded notification. The device must be able to reach it without a login; up to 8 MB. If the picture cannot be downloaded, the notification arrives without it and the log says why.

A message without channel and priority goes to the usual channel, with the Notification sound you selected. On Android 7 and earlier there are no channels: the priority applies to the single notification. A JSON message without title and message is shown as it arrived, as before.

The buttons that publish outside the topics of the device need the permission to write there on the broker (A5). For Home Assistant, see A8.

Play alarm

When Play alarm is on and a message arrives at:

zanzito/<device-name>/alarm/play <message>

Zanzito plays the Alarm sound you selected, and keeps playing it until it is stopped. A notification shows the message: touch it to stop the sound. Whenever a ringing alarm is stopped, from the notification or from the broker, Zanzito publishes:

zanzito/<device-name>/alarm ack

The alarm can also be stopped from the broker, by publishing to zanzito/<device-name>/alarm/stop. Override “silent” mode makes the alarm sound even when the device is silenced.

Earlier versions could also send an SMS on request from the broker. That function was removed in version 2.0, because Google Play no longer allows it for this kind of app.

3.4 Voice

Text to speech

Zanzito speaks through the text-to-speech engine of your device, in the language set for that engine in the Android settings. With Enable Text to speech on, it can be used for:

With Say MQTT texts on, the device is also a speaker for your system: any text published to zanzito/<device-name>/say is read aloud.

Audio stream for TTS selects the channel the voice is played on (default: Notification). If you choose Multimedia, the voice is muted while continuous listening is active.

Voice commands

With Enable voice commands on, any Activity can be sent by saying its command. While the connection is active, you start listening with Voice on the home screen or Voice command in Zanzito's notification; on Android 15 and earlier with three-button navigation, also by holding Back down. Both buttons appear only while voice commands are on, and not while continuous listening is on.

The command is set in each Activity: type it in Voice command, or touch the microphone next to it and say it. If Use the spoken words as payload is on in the Activity, whatever you say after the command is sent as the payload.

With Vocal confirmation on, Zanzito answers “OK” and the name of the Activity, or “Command not found”. You can replace that answer with a sentence of your own, or with several, one per line. The log (More → View logs) shows what was understood and what was sent.

Speech recognition is done by the recognition service of your device — on most devices, Google's. See the privacy policy for what that implies.

Continuous listening

This function is experimental and may not work on your device: if it gives problems, turn it off.

With Continuous listening on, Zanzito keeps listening while the connection is active and reacts when it hears the Keyword you chose: touch Keyword and say the word. To give a command, say:

Please <keyword>, <voice command of the Activity> <optional payload>

“Please” can be any other word, as long as it is not too short. While this is active the Multimedia audio stream of the device is muted, and the battery drains quickly: Only when plugged in, on by default, suspends listening when the device runs on battery.

3.5 More settings

The parental-control password is a very basic protection, meant to keep children from changing the settings: it is not a security measure. If you forget it, the only way to reset it is to uninstall Zanzito and install it again, which erases all its settings.

4. The home screen

The home screen, connected: the dragonfly lit, the broker address, the Disconnect button, the Location and Sensors cards, the quick actions and the last messages
The home screen, connected

At the top, the name of the device; the button on the right opens the Preferences (§3).

The connection card says whether Zanzito is Connected, Connecting… or Not connected: the dragonfly is lit while the connection runs, dimmed when it is off. Under the state are the main address and the port of the broker, with WebSocket when it is used (the home address of §3.1 is not shown), and the button that starts or stops the connection: Connect or Disconnect. If the parental control is on (§3.5), Disconnect asks for the password.

Two cards follow:

The quick actions:

All four need the connection to be active; Photo also needs Enable camera, Bookmark needs Track Location, and Voice appears only while voice commands are on (§3.4). At the bottom, Last messages shows the last one sent and the last one received; View logs opens the whole log.

Turned sideways, the home screen puts the connection card on the left and the rest on the right.

The bar at the bottom leads to the five parts of the app: Home, Activities, Reports, Map and More.

Activities

The list of Activities, each with its topic, its payload and a send button
Activities
Editing an Activity: icon, name, topic, payload, voice command, options and the Shortcuts section
Editing an Activity

Your list of publications. Each row shows the name, the topic and the payload, and after the first send the last payload sent. Touch the row, or its arrow, to send it. An Activity on a Quick Settings tile shows the number of the tile next to its name. The menu of the row (⋮) has Edit, Clone, Delete and Info, and Add to Quick Settings… and Add to home screen… (see Tiles and widgets). A long press starts the multiple selection, with Select all, Cut, Copy, Delete and Add to home screen; what you copy can be pasted in this list or in that of another device (A6).

The + button adds an Activity. The button at the top right opens the discovery of the topics on your broker, from which a topic can be imported (A6).

An Activity has:

Under Shortcuts, the ways of sending it without opening the list:

Tiles and widgets need an Activity with a fixed payload: one that uses the spoken words cannot go there, and the screen says so. They belong to this device, so the Admin module (A6) does not show them for the Activities of another device.

Send test sends it as it is. Changes are saved when you leave the screen.

Tiles and widgets

The Android home screen with a Zanzito Activity widget for one Activity and a Zanzito Activities widget with four buttons and the state of the connection
The two widgets on the home screen

An Activity can be sent without opening Zanzito: from a tile of Quick Settings, the panel of tiles that opens when you swipe down from the top of the screen, or from a widget on the home screen. Neither of them starts the connection: they send only while Zanzito is connected, and otherwise they say so.

Quick Settings tiles

Zanzito has three tiles (Android 7 and later), Zanzito 1, 2 and 3, each holding one Activity. To put an Activity on a tile, choose Add to Quick Settings… in the menu of its row, or Quick Settings tile in the Activity, then the tile: if it already holds another Activity, the tile switches to this one. On Android 13 and later Zanzito then asks Android to add the tile to the panel, if it is not there yet. On earlier versions, swipe down Quick Settings, touch the pencil and drag the tile among the others.

The tile shows the name and the icon of its Activity. Touch it to send the Activity: the tile lights up and says Sent for three seconds, or Not sent if the message could not leave. While Zanzito is not connected the tile is greyed out and says Zanzito offline. The texts under the name, here and below, appear from Android 10.

A tile without an Activity says Choose an Activity, and touching it opens the choice. A long press on any Zanzito tile opens the same choice, where None frees the tile.

On a locked phone the tile says Unlock to send and asks you to unlock first. To send an Activity from the lock screen too, switch on Allow from the lock screen in the Activity. Do it only for messages that anyone holding your phone may send: the tile can then be used without unlocking.

Widgets

Two widgets, in the list of widgets of the home screen under Zanzito:

The quickest way to place them is from the list of Activities: Add to home screen… in the menu of a row, or Add to home screen in the Activity, places a Zanzito Activity widget for that Activity; selecting several Activities with a long press and choosing Add to home screen places a Zanzito Activities widget with those. The home screen asks you to confirm. On Android 7 and earlier, or with a home screen that does not let apps add widgets, these items are not shown: add the widgets from the list of widgets.

Touch a button to send its Activity: it says Sent, or Not sent. While Zanzito is not connected the buttons are dimmed and open Zanzito instead. To change what a widget sends, hold it on the home screen and open its settings. If the Activity of a Zanzito Activity widget is deleted, the widget says Activity not found, and touching it opens the choice again.

Android redraws widgets when the home screen is in view: a widget may show a change of the connection only when you go back to it.

Reports

The list of Reports, each with its topic and the last value received
Reports
Editing a Report of type JSON, with the key to extract
Editing a Report

Your list of subscriptions, managed in the same way. Each row shows the last value received. Touch the row, or its i button, for the details: the last value and when it arrived; for a Report of type Picture, the picture.

A Report has a Name, a Topic and a Type (A3); a JSON key for the type JSON. It can be switched off with Enabled, show an Android notification, with the sound you choose, and Read the message aloud (§3.4). As in Activities, %devicename% in the topic is replaced by the device name. The topic of a Report can use the MQTT wildcards, as whole levels: + stands for one level, # for all the remaining ones and goes only at the end. For example home/+/temperature receives the temperature of every room. A message that matches several Reports updates all of them.

Map

Your position, the position you bookmarked, and the other Zanzito devices on the broker that share theirs, while this device shares its own (§3.2). The zoom adjusts to show them all; touch a marker and change the zoom, and the map follows that device. From the menu at the top right, Reload goes back to the automatic zoom and Screen on keeps the screen awake.

More

The More screen: Gallery, View logs, Admin, Preferences, User Manual, About Zanzito, Quit Zanzito
More
The log: messages received and sent, with their time and topic
The log

6. Licence levels

Once installed, Zanzito works in Demo mode:

Two licences are available from More → Buy license:

Purchases belong to your Google account: on a new device, sign in to Google Play with the same account and Zanzito finds them.

7. Running in the background

While the connection is active, Zanzito runs as a foreground service and shows a status notification. Its buttons give a voice command, save the current position as the bookmark and publish it, and take a picture, each when the corresponding function is on; when the connection is off, Start starts it again (not in Demo mode). If the buttons are not visible, expand the notification.

Closing the app from the list of recent apps does not stop the connection: touch the notification to bring Zanzito back. To stop everything, choose More → Quit Zanzito.

Current versions of Android put limits on what an app may do when it is not on screen:

8. Android permissions

Zanzito asks for a permission only when a function that needs it is switched on:

If you refuse a permission, Zanzito switches off the setting that needs it — Track Location, Enable camera or Enable voice commands — and says so; switch it on again to be asked again. The other functions carry on. Permissions can be changed at any time in the Android settings.

9. Privacy

Zanzito sends what it collects to the broker set in its preferences, and to nobody else: its developer cannot see your data and has no connection to your device. This also means that the security of your data is the security of your broker: make sure the connection is encrypted, and that users and permissions on the broker are set up properly.

Do not use public MQTT servers unless you know what you are doing: anyone can read your position, your pictures and anything else that Zanzito exchanges there.

Installing Zanzito on someone else's device without their knowledge and consent is forbidden by the licence, and in many countries it is a crime.

The complete privacy policy and the licence agreement are on the Zanzito website.

A1. Status messages

Every time it connects, and at each heartbeat, Zanzito publishes its state. You can use these messages on your system to follow each device and what it can do.

TopicPayloadMeaning
zanzito/<device-name>/status1 / 0Connected or not. Retained. 0 is also the last-will message, so the broker publishes it by itself if the connection is lost.
zanzito/<device-name>/versiontextThe version of Zanzito. Retained.
zanzito/<device-name>/servicesJSONThe functions switched on in the device (below). Retained.
zanzito/<device-name>/notification1 / 0Text notifications accepted or not.
zanzito/<device-name>/alarm1 / 0 / ackAlarm requests accepted or not; ack when a ringing alarm has been stopped, on the device or with alarm/stop.
zanzito/<device-name>/say1 / 0Texts to be read aloud accepted or not.

The services message, new in version 2.0:

{"remote_admin":false,"notifications_enabled":true,"send_sms_enabled":false,"play_alarm_enabled":true,
 "find_enabled":false,"location_enabled":true,"tts_enabled":true}

send_sms_enabled is always false: it is kept for the systems that read it.

A2. SSL/TLS and WebSocket

If your broker can be reached from outside your home network, do not connect to it without encryption. Zanzito supports SSL/TLS connections with user name and password; it does not support client certificates.

If the certificate of your broker is signed by a recognised authority, enabling SSL/TLS connection under Preferences → MQTT Connection → Security, and setting the right port, is all it takes.

If it is signed by an authority of your own, copy the CA certificate (usually ca.crt) to the device and import it with Import CA certificate in the same screen, or install it among the certificates of Android. Then enable SSL/TLS connection.

For Mosquitto, the configuration of the server side is described in its documentation: mosquitto-tls.

An alternative to exposing the broker is to reach it through a VPN to your home network. In that case Zanzito needs nothing special: it connects to the address the broker has on that network.

Through a web server: MQTT over WebSocket

If you already publish Home Assistant or another site on port 443, with a reverse proxy or a tunnel, the broker can be reached the same way, without opening a port of its own. The broker needs a WebSocket listener; for Mosquitto, in mosquitto.conf:

listener 9001
protocol websockets

The web server passes a path of your choice to that listener, as a WebSocket. For example, with nginx:

location /mqtt {
    proxy_pass http://127.0.0.1:9001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 300s;
}

Zanzito keeps the connection alive with a message every 90 seconds, so the web server must not close a quiet connection sooner: nginx does it after 60 seconds, hence proxy_read_timeout.

In Zanzito: Host is the name of your site, Port 443, SSL/TLS connection and MQTT over WebSocket on, WebSocket path /mqtt. The certificate is that of the web server: if it comes from a recognised authority, such as Let's Encrypt, there is nothing to import. User name and password are still those of the broker.

A3. Types of Report

A4. Pictures over MQTT

The two scripts below use the Eclipse Paho client for Python, version 2 (pip install paho-mqtt). Home Assistant needs neither (A8).

Saving the pictures sent by Zanzito

Subscribes to the picture topic of a list of devices and saves each picture it receives as <device-name>.jpg.

#!/usr/bin/env python3
import os
import paho.mqtt.client as mqtt

BASE_DIR = "path-to-images-directory"
SERVER = "<server-address>"
PORT = 1883
USERNAME = "<mqtt-username>"
PASSWORD = "<mqtt-password>"

# Device names of the Zanzito devices to follow
DEVICES = ["<device-name-1>", "<device-name-2>"]


def on_connect(client, userdata, flags, reason_code, properties):
    for device in DEVICES:
        client.subscribe("zanzito/" + device + "/picture")


def on_message(client, userdata, msg):
    device = msg.topic.split("/")[1]
    with open(os.path.join(BASE_DIR, device + ".jpg"), "wb") as image:
        image.write(msg.payload)


client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
client.username_pw_set(USERNAME, PASSWORD)
client.on_connect = on_connect
client.on_message = on_message
client.connect(SERVER, PORT, 60)
client.loop_forever()

Sending a picture to Zanzito

Publishes a JPEG file to a topic — for example zanzito/<device-name>/photonotification, or the topic of a Report of type Picture:

mqtt_send_file.py <topic> <image-file-path>
#!/usr/bin/env python3
import sys
import paho.mqtt.client as mqtt

SERVER = "<server-address>"
PORT = 1883
USERNAME = "<mqtt-username>"
PASSWORD = "<mqtt-password>"

topic = sys.argv[1]
image_path = sys.argv[2]

with open(image_path, "rb") as image:
    data = image.read()

client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
client.username_pw_set(USERNAME, PASSWORD)
client.connect(SERVER, PORT, 60)
client.loop_start()
client.publish(topic, data, qos=1).wait_for_publish()
client.loop_stop()
client.disconnect()

Neither script checks its arguments or handles errors: they are a starting point.

A5. Access rules with Mosquitto

With the sharing functions on, every Zanzito device publishes its position and its pictures to all the others. To decide who sees whom, give each device a user of its own on the broker and limit what each user can read. With Mosquitto, add the reference to an access-control file to the configuration (usually /etc/mosquitto/mosquitto.conf):

acl_file /etc/mosquitto/local.acl

and in that file define, for example, a user that can do everything:

user myadministrator
topic readwrite #

and the ordinary users:

user normal_user
topic readwrite zanzito/<normal-user-device-name>/#
topic readwrite zanzito/shared_locations/<normal-user-device-name>
topic readwrite zanzito/shared_pictures/<normal-user-device-name>
topic read zanzito/shared_locations/Another_Device
topic read zanzito/shared_pictures/Another_Device

Here normal_user can publish and subscribe to the topics of its own device, and sees the shared position and pictures of Another_Device only. If the device uses FIND, add a line for the topics of its group (topic readwrite <group-name>/#); if it uses the Owntracks emulation or custom topics, add theirs. Restart Mosquitto for the changes to take effect.

If the device uses Home Assistant discovery (A8), it must also be able to publish its configuration and to read the status of Home Assistant, with the prefix you set if it is not the default one:

topic write homeassistant/device/zanzito_<normal-user-device-name>/config
topic read homeassistant/status

In that topic a full stop in the device name becomes an underscore.

For other brokers, refer to their documentation.

A6. The Admin module

More → Admin shows all the Zanzito devices that ever connected to your broker. It works in real time: this device and the one you want to manage must both be connected, the other one must have Remote administration switched on, and all of them should run the same version of Zanzito.

Touch a device to open its overview. Long-press it for a menu from which you can manage it or delete it: deleting a device erases from the broker all the retained messages that belong to it.

In Demo mode, and with a Base licence, you can manage the device you are using only. Managing the others requires a Full licence (§6).

The Administration screen: the button to discover the topics, and the list of devices with their state
Administration
The overview of a device: state, version and battery, the Manage buttons and the remote commands
The overview of a device

Current topics discovery

Discover current topics, at the top of the Admin screen and behind the button at the top right of Activities and Reports, lists the topics that are alive on your broker. Give it some time: only retained topics appear at once, the others when something is published to them. From the menu of an item you can import the topic as an Activity or as a Report, or delete it from the broker. While this screen is open the list keeps updating and the normal functions of Zanzito are suspended; the button at the top right pauses and resumes the list.

Device overview

If the device is online and has Remote administration on, the overview shows whether it is connected, the version of Zanzito it runs and its battery level. Under Manage are its Prefs, Activities and Reports, its Logs, its position on the Map and, under Info, the details below. Further down, the remote commands:

Device details

With Remote administration on, at every heartbeat the device publishes, retained:

zanzito/<device-name>/device_info
KeyValueDescription
timenumberUnix time of the update
device_infotextManufacturer, model and Android version
battery_levelnumberBattery charge, in per cent
battery_chargingtrue/falseWhether the battery is charging
charge_typetextAC, USB, Wireless, None or N/A
current_foreground_apptextThe app in the foreground. Current versions of Android show an app only its own processes, so this is Zanzito itself or empty
screen_ontrue/falseWhether the screen is on
screen_lockedtrue/falseWhether the screen is locked
screen_orientationtextPortrait, Landscape or N/A
current_wifitextName (SSID) of the Wi-Fi network in use; needs the Location permission
current_operatortextName of the mobile operator

The values are read at each heartbeat: send a Send heartbeat command before opening Info if you want them fresh.

Preferences, Activities and Reports of another device

Prefs shows almost all the preferences of the remote device. Change what you need: nothing is applied until you press Upload. Copy puts all of them in the clipboard, and Paste in the preferences of another device overwrites them, cloning the first device: remember to change the Device name before uploading.

Activities and Reports show the custom topics of the remote device. The list supports multiple selection, with select all, cut, copy, paste and delete; you can copy and paste between a remote device and this one, edit, clone and add items as you do with your own, and send an Activity with its arrow button. Here too, changes are applied when you press Upload.

A7. Remote administration

With Remote administration on (§3.5), the device accepts settings and commands from the broker. The Admin module of another Zanzito device uses exactly these messages; you can send them yourself with any MQTT tool.

Whoever can publish to this device's topics on your broker controls it: can change its settings, make it take a picture, read its configuration. Turn Remote administration on only with a broker of your own, with encryption and access rules in place (A2, A5) — never on a public server.

Configuration backup and restore

With Remote administration on, at each heartbeat and shortly after the preferences change (Activities and Reports included) Zanzito publishes its configuration, retained, to:

zanzito/<device-name>/lastprefs

The payload is an encoded text. It contains every setting except the passwords: the broker password and the parental-control password never leave the device. Everything else is there — broker address and user name, home network, Activities and Reports — and it is encoded, not encrypted: keep that topic readable only by you. You can save it by subscribing to the topic with any MQTT tool.

To restore a saved configuration:

  1. configure Zanzito to connect to your broker and start the connection;
  2. turn Remote administration on;
  3. publish the saved text to zanzito/<device-name>/restore_prefs.

Zanzito applies the configuration and restarts the connection. If it comes from another device, change the Device name straight away. The passwords are not in the copy: a restore leaves those already on the device as they are; on a new device, enter them again.

Setting preferences

Publish a JSON object with one or more of the keys below to:

zanzito/<device-name>/set_prefs
{"updates_heartbeat_interval":"120","location_share":false}

Zanzito applies the values and restarts the connection. It is all or nothing: if a key is unknown or a value has the wrong type, nothing is applied and the log says why. Values marked text must be sent as strings, numbers included. A preference set remotely does not grant the Android permission it depends on: that can only be done on the device.

KeyValuePreference
device_nametextDevice name
custom_topicstextActivities and Reports, as the Admin module encodes them
MQTT connection
hosttextBroker address
porttextBroker port
usernametextUsername
passwordtextPassword
tlstrue/falseSSL/TLS connection
websockettrue/falseMQTT over WebSocket
websocket_pathtextWebSocket path
home_ssidtextHome Wi-Fi name(s)
home_hosttextHome broker address
home_porttextHome broker port
home_tlstrue/falseSSL/TLS connection for the home address
home_websockettrue/falseMQTT over WebSocket for the home address
home_websocket_pathtextWebSocket path for the home address
updates_instanttrue/falseInstant updates
updates_heartbeattrue/falseHeartbeat
updates_heartbeat_intervaltextHeartbeat interval, in seconds
ha_discovery_enabledtrue/falseHome Assistant discovery
ha_discovery_prefixtextDiscovery prefix
Location
location_activetrue/falseTrack Location
location_high_precisiontrue/falseHigh precision
location_minimum_distancetextMinimum distance, in metres
location_sharetrue/falseShare my location
find_enabletrue/falseEnable FIND
find_enable_only_hometrue/falseFIND only when at home
find_group_nametextFIND group name
owntracks_enabledtrue/falseEmulate Owntracks
owntracks_device_idtextOwntracks Device ID
owntracks_tracker_idtextOwntracks Tracker ID
Photos
camera_enabledtrue/falseEnable camera
camera_auto_take_picturestrue/falseSend photos automatically
camera_auto_take_pictures_intervaltextInterval, in seconds
camera_shutter_soundtrue/falseShutter click
camera_share_picturestrue/falseShare photos
camera_autofocustrue/falseAutofocus
Inbound
inbound_notifications_enabledtrue/falseReceive text notifications
inbound_photo_notifications_enabledtrue/falseReceive photos
inbound_notifications_tts_enabledtrue/falseRead notifications
inbound_alarm_enabledtrue/falsePlay alarm
inbound_alarm_override_silenttrue/falseOverride “silent” mode
Voice
voice_tts_enabledtrue/falseEnable Text to speech
voice_tts_over_mqtt_enabledtrue/falseSay MQTT texts
voice_commands_enabledtrue/falseEnable voice commands
voice_commands_feedbackstrue/falseVocal confirmation
voice_negative_feedbackstextAnswer(s) for a command that was not found
voice_commands_continuoustrue/falseContinuous listening
voice_commands_continuous_pluggedtrue/falseOnly when plugged in
voice_commands_keywordtextKeyword
More settings
advanced_automatic_connectiontrue/falseAutomatic connection
advanced_autostart_boottrue/falseAutostart Zanzito
advanced_parental_control_enabledtrue/falseParental control
advanced_parental_control_passwordtextParental control password

Commands

A message published to one of these topics, with any payload, is a command. Publish commands, set_prefs and restore_prefs without the retain flag: retained ones are ignored, and the log says so, so that they are not executed again at every connection.

TopicEffect
zanzito/<device-name>/cmd/restartrestarts the connection to the broker, as reconnect does; the app itself is not restarted
zanzito/<device-name>/cmd/reconnectrestarts the connection to the broker
zanzito/<device-name>/cmd/take_picturetakes a picture and sends it, if the camera is enabled and available (§7)
zanzito/<device-name>/cmd/send_heartbeatsends a heartbeat
zanzito/<device-name>/cmd/set_bookmarksaves the current position as the bookmark and publishes the position
zanzito/<device-name>/cmd/send_logspublishes the current logs to zanzito/<device-name>/log_inbound and zanzito/<device-name>/log_outbound
zanzito/<device-name>/cmd/send_html_logsthe same, with the HTML formatting of the log on the screen

A8. Home Assistant

Home Assistant is an open-source home-automation platform. Connect its MQTT integration to the same broker as Zanzito, then switch on Home Assistant discovery on the device (§3.1). At the next connection the device appears in Home Assistant, under Settings → Devices & services → MQTT, with its entities: there is nothing to write in configuration.yaml.

The entities

Each function that is switched on in Zanzito becomes an entity:

EntityTypePresent whenTopic
Connectionbinary sensoralwaysstatus
the device namedevice trackerTrack Location is onlocation, or the Owntracks topic with the emulation on
BatterysensorBattery level is selectedbattery_level
the name of each sensorsensorthe sensor is selected<sensor_name>
CameracameraEnable camera is onpicture
NotificationnotifyReceive text notifications is onnotification
SaynotifySay MQTT texts is onsay
AlarmnotifyPlay alarm is onalarm/play
Stop alarmbuttonPlay alarm is onalarm/stop
Send heartbeatbuttonRemote administration is oncmd/send_heartbeat
Take picturebuttonRemote administration and the camera are oncmd/take_picture

All the topics begin with zanzito/<device-name>/. Light, pressure, temperature, humidity and proximity sensors have their unit; the others show their value as text. The camera shows the last picture the device sent: on request, from the home screen, or with Take picture.

When Zanzito disconnects, Connection goes off, the position stays at the last one known, and the other entities become unavailable until it connects again.

Home Assistant builds the entity IDs from the device name: notify.<device-name>_notification, button.<device-name>_stop_alarm and so on, with a full stop in the name turned into an underscore. You can rename them in Home Assistant.

Activities as triggers

Each Activity is a device trigger: in an automation, add a trigger of type Device, choose the Zanzito device and then “<name of the Activity>” pressed. The automation starts when the message of the Activity reaches the broker, with its topic and its payload; for an Activity that sends the spoken words or a file, any payload on its topic. The trigger is fired by the message, whoever sends it. Two Activities with the same name get “(2)”, “(3)” and so on.

With Receive text notifications on there is one more trigger, “Notification button” pressed, for the buttons of the notifications (below).

Sending notifications

A notification, a sentence to say aloud or an alarm are sent with the notify.send_message action:

action: notify.send_message
target:
  entity_id: notify.<device-name>_notification
data:
  message: "The washing machine has finished"

The notify entities send the text only: Home Assistant does not pass a title on. For a title, and for the buttons, the picture and the other keys of §3.3, publish a JSON message to the notification topic:

action: mqtt.publish
data:
  topic: "zanzito/<device-name>/notification"
  payload: '{"title": "Laundry", "message": "The washing machine has finished"}'
  qos: 1

Notifications with a picture and buttons

When someone rings at the door, the phone shows the picture of the camera and a button that opens the gate. The picture is saved first in the www folder of Home Assistant, which serves it under /local/ without a login. Anyone who can reach Home Assistant can read what is in that folder, so use it only on your home network.

actions:
  - action: camera.snapshot
    target:
      entity_id: camera.front_door
    data:
      filename: /config/www/front_door.jpg
  - action: mqtt.publish
    data:
      topic: "zanzito/<device-name>/notification"
      payload: >-
        {"title": "Front door", "message": "Someone rang the bell",
        "tag": "door", "priority": "high",
        "image": "http://<home-assistant-address>:8123/local/front_door.jpg",
        "actions": [{"title": "Open the gate", "payload": "open_gate"},
        {"title": "Ignore", "payload": "ignore"}]}
      qos: 1

The buttons have no topic, so they publish to zanzito/<device-name>/action. In an automation, that is the device trigger “Notification button” pressed, with the payload of the button in {{ trigger.payload }}; in YAML, an MQTT trigger on the same topic:

automation:
  - alias: "Gate opened from the phone"
    triggers:
      - trigger: mqtt
        topic: "zanzito/<device-name>/action"
        payload: "open_gate"
    actions:
      - action: cover.open_cover
        target:
          entity_id: cover.gate

The button closes the notification on the phone where it was touched. To remove it when it is no longer needed, for example from the other phones that received it, publish {"tag": "door", "clear": true} to their notification topics.

An alarm switched on and off from Home Assistant

An alarm that is switched on from Home Assistant and switches itself off when someone stops it on the phone. It needs a switch and, since the acknowledgement of Zanzito is not one of the entities above, a sensor for it, both in configuration.yaml:

input_boolean:
  zanzito_play_alarm:
    name: "Zanzito Alarm"
    icon: mdi:alarm-multiple

mqtt:
  - binary_sensor:
      name: "Alarm ack Zanzito"
      state_topic: "zanzito/<device-name>/alarm"
      payload_on: "ack"
      payload_off: "1"

If you already have an mqtt: key, add the sensor to its list. Then three automations, which use the Alarm and Stop alarm entities of the device:

automation:
  - alias: "Zanzito alarm switch goes on"
    triggers:
      - trigger: state
        entity_id: input_boolean.zanzito_play_alarm
        from: "off"
        to: "on"
    actions:
      - action: notify.send_message
        target:
          entity_id: notify.<device-name>_alarm
        data:
          message: "Wake up!"

  - alias: "Zanzito alarm switch goes off"
    triggers:
      - trigger: state
        entity_id: input_boolean.zanzito_play_alarm
        from: "on"
        to: "off"
    actions:
      - action: button.press
        target:
          entity_id: button.<device-name>_stop_alarm

  - alias: "Zanzito alarm acknowledged"
    triggers:
      - trigger: state
        entity_id: binary_sensor.alarm_ack_zanzito
        to: "on"
    actions:
      - action: input_boolean.turn_off
        target:
          entity_id: input_boolean.zanzito_play_alarm

The alarm is now controlled from anywhere in Home Assistant by turning input_boolean.zanzito_play_alarm on and off.

How discovery works

Zanzito publishes the configuration of the device, retained, to:

homeassistant/device/zanzito_<device-name>/config

with the prefix of §3.1 in place of homeassistant, every time it connects, and again when Home Assistant starts and announces itself on homeassistant/status. The configuration names the device, its make and model, and the version of Zanzito; it publishes no other data, since the entities use the topics described in this manual.

When you switch a function off, its entity is removed. When you switch discovery off, or change the device name or the prefix, the device is removed from Home Assistant at the next connection; with a new name it comes back as a new device. If your broker has access rules, see A5.

Without discovery, the same entities can be written by hand in configuration.yaml with the MQTT integration, on the topics of the table above. Check the examples against the Home Assistant documentation for the version you run.