Basic authentication with Python Flask

For a simple web application in a home automation scenario, basic authentication can be a sufficient solution. Setting up a REST API and a web app with Flask is very easy, and adding basic authentication requires just a few more steps that can be reused between different applications. Continue reading →


A web app for IoT data visualization

As described in some earlier posts, I have a setup at home with IoT devices that publish measurement messages to a Raspberry Pi via MQTT. The RPi stores the data in a database and also forwards the messages to a cloud service (Adafruit IO).

In this post I have made a self-hosted data visualization web app that can be accessed from any browser-enabled device.

Continue reading →

Daemonize that Python script!

This post builds on a previous experiment where I made a remote control app for my outlets with a Raspberry Pi, Python/Flask and AngularJS. For the backend to be really useful, I want to make it behave as a service in Linux. It should start automatically after a reboot and there should be some control mechanism for manually starting, stopping and viewing the status of the service. There should also be a proper logging in place.

Continue reading →

Control your home with a Raspberry Pi and a mobile phone

In this post I will show how I have used a Raspberry Pi as a relay server that can be controlled via a web app on e.g. a mobile phone or via REST calls. The system consists of:

  • A Raspberry Pi 2 with Raspbian
  • A set of relays connected via the GPIO pins on the RPi
  • Flask running a Python WebAPI on the RPi
  • A Single Page Application made with HTML5, JavaScript and AngularJS where you can control the relays via the WebAPI

There are many inexpensive kits available for controlling voltage outlets at home, but making your own is an opportunity for learning and tinkering, so let’s go!

Continue reading →