Skip to content

MQTT Tinkerforge Bridge built as Spring Boot Application.

Notifications You must be signed in to change notification settings

zambrovski/mqtt-tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT Tinkerforge Bridge

Build Status

This project allows to bind TinkerForge sensors and actuators using MQTT to a central broker using configuration file only. The application is built using Spring Boot and is currently in a playground phase.

Installation and usage

Installation

In order to build the software, please run mvn clean package from command line (you will require Apache Maven).

Configuration

For configuration, make sure to copy the application.properties from docs folder to the directory you start from and adjust the configuration.

General configuration

In order to connect to the TinkerForge MasterBrick, the connection needs to be specified. Please use the following two values to configure the connection (the specified values are default):

#
# TF connection
# 
tinkerforge.host=localhost
tinkerforge.port=4223

The sensor values are delivered to a MQTT broker, which has to be configured.

#
# MQTT connection
#
mqtt.broker=tcp://localhost:1883
mqtt.client.id=localtest
mqtt.qos=2

Configuring MQTT delivery

The MQTT protocol allows to create topics in a special way, so MQTT selectors (# and +) can be applied. In doing so, every MQTT sensor setup has a naming scheme which can be applied to the devices delivering the events. Usually this naming scheme is establishing a topology (physical or logical). The configuration is divided in three parts:

  • Topic prefix of the entire application
  • Topic segment for device
  • Topic segment for measurement

The resulting topic is created by a concatenation of all three segments. The application topic prefix is configured by the property mqtt.topic.prefix. The device topic segment is configured using properties of scheme <uid>.topic=cellar where the <uid> is denoting the device UID of the bricklet. It is possible to configure multiple devices to point to the same topic. e.G.:

mqtt.topic.prefix=testsetup/
aDc.topic=cellar
hgY.topic=cellar
dfH.topic=cellar

In this setup, the three devices with given UIDs are located in cellar and deliver measurements to the same topic testsetup/cellar. The measurement topic is configured usgin the device specific setting (see next section).

Device configuration

Currently, the following sensor types are supported:

SensorClass
Ambient lightde.techjava.mqtt.tf.device.Ambienlight
Barometerde.techjava.mqtt.tf.device.Barometer
Distance Infra-Redde.techjava.mqtt.tf.device.DistanceIRMeter
Distance Ultra-Soundde.techjava.mqtt.tf.device.DistanceUSMeter
Hygrometerde.techjava.mqtt.tf.device.Hygrometer
LCD 20x4 Buttonsde.techjava.mqtt.tf.device.LCD20x4
LED Stripde.techjava.mqtt.tf.device.LedStrip
RFID NFCde.techjava.mqtt.tf.device.RFIDNFC
Scalede.techjava.mqtt.tf.device.Scale
Thermometerde.techjava.mqtt.tf.device.Thermometer
Thermometer Infra-Redde.techjava.mqtt.tf.device.ThermometerIR
Voltmeterde.techjava.mqtt.tf.device.Voltmeter

In addition, the following actuators are implemented:

  • LCD 20x4 Text and Backlight

In general, you can configure every value sensor and set its value read timeout (callbackperiod) and the target topic (topic) based on the device type.

#
# Example ambient light
# 
tinkerforge.ambilight.topic=illuminance
tinkerforge.ambilight.callbackperiod=10000

This will configure the ambient light to be checked every 10 seconds and deliver the value to testsetup/cellar/illuminance. In particular cases, it is important to configure a single device (not the device type). This can be done in a similar way, how the device segment is set.

#
# Example ambient light
# 
aDc.callbackperiod=10000

By default, all factories are enabled. You can disable them by providing a disable property using the factory class low-case. This will disable a voltmeter factory:

#
# Example to disable a voltmeter
#
tinkerforge.voltmeter.disabled=true

As an alternative, you cand disable a concrete device:

#
# Example to disable the aDc device
#
aDc.disabled=true

Run

To run the software just run java -jar <mqtt-tinkerforge-boot-version.jar>.

About

MQTT Tinkerforge Bridge built as Spring Boot Application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages