Owntracks, Mosquitto and Home Assistant

OwnTracks is an open-source device tracker app for iOS and Android that lets you publish location data from your mobile phone. On the mobile app you can locate other connected devices on a map and get help navigating to the devices/friends/family members. With OwnTracks integrated in Home Assistant, you can create automation rules based on presence detection (for example, turn on the lights when someone gets home) or just keep an eye on where your youngsters (their phones) are from within the Home Assistant GUI.

What I really like about OwnTracks is that the creators encourages you to own and handle your private location data. Owntracks has a public broker but supports sending the location data with MQTT to your own private broker instead. To achieve this in my current home automation setup, I need to bridge an external broker with my within-LAN mosquitto broker that I use for my home automation.

Continue reading →

Advertisements

InfluxDB and Grafana for sensor time series

I’ve started using InfluxDB for storing my sensor data as time series. The main reason for this is that it allows me to use Grafana for analyzing the data. This blog post is an introduction to my setup with these tools on a Raspberry Pi.

Continue reading →

A self-hosted MQTT environment for Internet of Things – Part 2

In the second post in this series, I will setup two ESP8266 microcontrollers with MQTT publishing through a Raspberry Pi-hosted Mosquitto broker. The idea is that the microcontrollers will send sensor data (like temperatures or other events) that one or several MQTT subscribers can act on.

Continue reading →

A self-hosted MQTT environment for Internet of Things – Part 1

MQTT (MQ Telemetry Protocol) is a lightweight machine-to-machine communication protocol that works on top of TCP/IP and it is very much suited for usage in an Internet-of-Things scenario. MQTT uses the publish-subscribe pattern where the clients subscribe to topics and publish messages through a broker. There are many different framework implementations of MQTT as well as complete cloud services that use MQTT (Adafruit IO, CloudMQTT, ThingMQ etc). The cloud services are nice and easy to use, but if you don’t want your data uploaded to a third party storage, you can host an MQTT environment yourself and have full control of the gathered data. Even if you decide to upload data to the cloud, the local MQTT environment can work as a gateway where data goes out to the Internet only from one single place on the Intranet. This makes it easier to control and change the outgoing data flow.

In this post I will show how I have self-hosted an MQTT environment with the help of a Mosquitto broker running on a Raspberry Pi and let two different ESP8266 microcontrollers publish sensor data through the broker. I will also use the Raspberry Pi as a subscriber for the messages, and these data will be persisted in a MongoDB database. Another subscriber will route the messages to a cloud service.

Continue reading →