-
Notifications
You must be signed in to change notification settings - Fork 4
Installation and configuration
The TFBrew software is well suited to run on a Raspberry Pi and this guide describes how to install it on the Raspberry Pi.
If you are familiar with setting up Raspian and a Raspberry Pi, feel free to skip to Dowloading Software below.
Download Raspian and read through the installation guide for it.
Install the Raspian Linux distribution on your sd card. The lite version of Raspian is enough if you will be running the Raspberry Pi in headless mode (no display, just remote setup and control).
When doing a headless setup, you will need to log in over the network to continue the installation.
After writing the Raspian to your sd card you will have access to the boot partition on the sd card.
- If you place a file the called ssh you will enable ssh access. The file can be empty.
- If you place a wpa_supplicant.conf file there it will be used to join the Raspberry Pi to you wifi. The contents of the file should be
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="YOUR_SSID_HERE"
psk="YOU_WIFI_PASSWORD"
}
After this you can find the IP for your Raspberry Pi by logging into your router and seeing which IP it assigned to it. You will need command line access to you Raspberry Pi to continue the installation. If you are setting up a headless RPi, you will need to log into the RPi using ssh.
Start by apt-get update/upgrade your RPi
sudo apt-get update
sudo apt-get upgrade
and install the Bluetooth development library so you can install the python pybluez module later
sudo apt-get install libbluetooth-dev
You will also need to install git and pip3
sudo apt-get install git python3-pip
Clone the TFBrew repository, as the pi user (default)
cd ~
git clone https://github.com/hrafnkelle/tfbrew.git
You should now have a directory tfbrew in the home directory of the pi user. There you will find the main program, tfbrew.py, the configuration file config.yaml and the start-at-boot service file tfbrew.service.
A file called requirements.txt can be found in the tfbrew/ directory. By running the following command, the needed python modules will be installed
cd ~/tfbrew
sudo pip3 install -r requirements.txt
TFBrew is configured by editing the config.yaml file. Like the filename suggests, this is a YAML style configuration file.
The configuration parameters for all plugins for components can be found on the Plugins page.
The structure of the config.yaml file is a
- list of all sensors with their configuration parameters
- list of all actors with their configuration parameters
- list of all controllers with their configuration parameters
- list of all extensions with their configuration parameters
- list of all connections between components
The name name of each component should be preceded by a - and followed by a :. The configuration for that component should be indented under the name.
Each component needs to have a plugin, configured with the plugin: ... parameter.
Struture of the configuration YAML file is as follows
sensors:
- TempSensor1:
plugin: ...
...
- TempSensor2:
...
actors:
- Heater1:
plugin: ...
...
- Pump:
plugin: ...
...
...
controllers:
- KettleController:
...
extensions:
- Web:
plugin: ...
...
- Blynk:
...
connections:
- TempSensor1.temperature=>Web.temp
- KettleController.power=>blynk.v1
...
For testing purposes it is best to run TFBrew from the command line. In your tfbrew directory, issue the command
python3 tfbrew.py
Raspian uses the systemd startup and service manager. To enable automatic startup on boot
sudo cp tfbrew.service /etc/systemd/system/
then enable automatic start by
sudo systemctl enable tfbrew
You can also start and stop tfbrew from the command line by
sudo services tfbrew stop
sudo services tfbrew start