About project, available features, recipes how to configure them and software used in project.
Brief information about the markings, which can be seen in this documentation, as well as in other parts of this site.
The aim of this project is to create a platform that will allow:
The project is designed for Lan Kontroler v3, which supports communication protocol MQTT. It consists of multiple modules, among which can be distinguished several major:
MQTT is a Client Server publish/subscribe messaging transport protocol that runs over TCP/IP. It is light weight and therefore is ideal for use in constrained enviroments.
Clients can:
Topic can be imagined as channel, which clients can observe to see its content (subscribe) or put something inside it (publish). It is worth noting that subscription topic differs from publish topic, as they may contain special characters. With the help of these characters it is possible to receive messages from multiple "common" topics with a single subscription.
Before explaining which characters are special and what actually can do, it's necessary to mention that the topics form a hierarchy. That means they are built of hierarchy levels, separated with character /. Special characters make use of hierachical structure of topics, and precisely they make that one topic may contain many other topics. They have been presented below:
Both special signs (+ and #) can be used together in one topic subscription, eg. a/+/c/# which matches a/b/c/d, a/d/c/f.
As a MQTT server we use Mosquitto (more about it here). It listens on few ports:
You can find more detailed information about MQTT protocol at:
We will refer to LK3, GSM Controller and other devices that can connect with our server via MQTT, simply as devices. In this section you will find informations about adding new device to your account, configuring it, editing it's server-side settings and more.
Devices page is the central point of the site where you can manage devices. It's where you can add new devices, view already added ones and delete them. You can also find links to edition pages, chart and table views for your devices.
The image below shows Devices page on account with few devices. Here you can distinguish the following elements:
First step to start using the service is adding a new device to your account.
Select at least one checkbox so LK3 will be actually sending data.
Approve changes by clicking Save.
Afterwards LK3 should start sending data, which you can observe in Chart view for this device. Generally first data should arrive in about 5 minutes since configuration of device.
If you have configured your device and waited for at least 5 mins for data in Chart view and didn't see any messages coming in then something is wrong. To learn what could have gone wrong and how to fix it keep reading.
First start with few checks:
Is there 'MQTT connected' message in MQTT client tab (on device's page), like in the image above (if there isn't any status message then it's recommended to upgrade firmware to newer version to have this feature)?
Can device fetch time via NTP (Time tab on device) with default settings (pool.ntp.org:123)?
Solutions:
The above issues are the most common ones, but there might be problems caused by external factors, e.g. restrictive firewall blocking outgoing data.
After adding a device to your account you will be able to configure some options for it (mentioned in Devices page section). Below is short description of available settings and device related management functions, available in Edit section.
You can control your devices remotely as long as they are connected to our MQTT server. Currently (in ver 1.49) you can send commands to your LK3 to turn on/off output or pwm, to change pwm frequency and duty cycle.
Following example/instruction shows how to send commands to your device (here to LK3), using MQTT Client page.
Below you can find list of supported devices along with their topics and commands:
There is option to aggregate your device's series into groups (called series group), which can then be viewed together in chart or table view.
When you create device, it will also have its own dedicated series group to which you then add series (select them as active). It's used in chart and table views to display only chosen series.
Apart from these special series groups you can create custom ones, which can contain series from multiple devices. They are best used to group chosen series for easier viewing on chart and table, or to group certain series across multiple devices for comparing purposes. Note that custom series groups aren't tied with devices so they can be deleted freely, without affecting the devices.
In case of custom series group you might need to change series' names after creating new group with series, that happen to have the same names. It's necessary for chart view that every serie has distinct name, otherwise data won't be displayed properly.
Series groups page is quite simple and very similar to Devices page. There is list of series groups, form to add new ones, group of links to edition pages just like in Devices page.
The few differences between Series groups page and Devices page are listed below (including editing pages):There are two pages available for viewing data from devices - chart and table views. These views can be accessed via links in Devices and Series groups pages.
Both of views queries databases to get data for series assigned to groups. Then they put it respectively on the chart or in the table. In case of the former one (chart) it will also listen for incoming messages over MQTT.
It is necessary to select some series as active for device. Otherwise chart and table views won't work and also links pointing to them will be disabled.
There are few parts of Chart page that should be distinguished.
There are also expandable sections:
In the centre of Table page there is said table with date and series values. There also are few other parts that should be distinguished.
The Config panel allows you to configure reactions (very similar to events in LK3) and tasks (similar to the scheduler on LK3).
Basically, there are 4 sections on Config panel page:
Sections of services, reactions, tasks are very similar visually - there is counter showing their count, button to open form for adding new, list of positions with their details and buttons to edit or delete them.
There is a message displayed when there are unsaved changes, so you won't forget about it and lose your changes. However it's recommended to save after batch of changes, not single ones, or in other words do in once you have finished applying changes (to actually lose them you would have to close Config panel tab in browser).
Service configurations are the basis of Config panel, because they are required to create reactions and therefore are important for tasks (task can trigger reactions). Service configuration defines basic options for service, eg. for smtp (email) it defines address to which send message.
Currently there are few supported services:
Adding or configuring service is nothing more but giving common name to let's say sending email to your email address or sending MQTT message to LK3 command topic. The goal behind it is to have pool of "actions" that can be used in reactions, where you will define the actual message to send or under what conditions it should happen, but more about it in reactions section.
Form for adding a new service configurations is shown on the picture below. There are 3 fields:
List of configured services with their details and buttons for editing or deleting. There are 4 columns:
Reactions are actions to be performed in response to an incoming MQTT message on a specific topic (e.g. from a device). The actions to be performed are defined by service configurations. There are also modifiers, such as a filter or format, that can affect the time and manner of action.
Very important part of reaction is filter, because it allows to take action based on message content, not only the fact that there was a message on specific topic. For now there are two filters that can work on numeric values, eg. sensor reading, out status. They compare received value with the one given in reaction setup, and if the result of comparison is true it will pass message to actions, else it will not take further actions.
Currently available are following filters:
Format allows to overwrite received message's text before it is passed to services for processing, but after it was checked by filter. You can use special tags {topic} and {payload} in format, so they will be replaced in message with actual topic on which message was received and message's content respectively. Thanks to that you can send more human-like message via email by wrapping sensor reading into full sentence.
Let's say for example, a format with the following content:
The temperature in living room is {payload} from DS sensor on topic {topic}
Then on the associated topic dev1/temp arrives message 25, and format changes it to:
The temperature in living room is 25 from DS sensor on topic dev1/temp
Form for adding new reaction is shown on the picture below. There are 5 fields:
List of reactions with their details and buttons for editing or deleting. There are 6 columns:
Tasks consist in sending MQTT messages to specific topics at specified times, in a periodic manner. Therefore, they act as mqttpub service themselves, but when paired with reactions they can perform more functions (any attached to reaction, eg. send email).
Form for adding a new task is shown on the picture below. There are 4 fields:
List of tasks with their details and buttons for editing or deleting. There are 5 columns:
MQTT Client page embbeds user's MQTT client for connecting with server using WebSockets. You can use this page for testing your devices, for controlling them or something else. Connection to server is created right as you open this page, with use of your personal MQTT client credentials, so there is no setup required.
Below is description of MQTT client page.
In this section you will find what software has been used in the project and where to find more about them. There also is note about licenses.
It is a MQTT client implementation in JavaScript that uses WebSockets to connect to the MQTT broker by the browser. It is used in chart view and Config panel to receive incoming messages and send messages. You can find more about this library and other MQTT client implementations at Paho website.
About license:
* Copyright (c) 2013 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Andrew Banks - initial API and implementation and initial documentation
It links JS MQTT client with user interface (that is created in HTML/CSS) and also provides wrapper functions for connecting to server, subscribing, publishing and others. It has been used as a template that has been modified to suit our needs. You can find more about it and their enterprise MQTT broker at HiveMQ website.
About license:
* Copyright 2013 dc-square GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author: Christoph Schäbel
Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol version 3.1 and 3.1.1. With its extensive, but flexible configuration it is great solution for use in this project (WebSockets support, multiple listeners, user-based access, access limitation to topics). You can find more about Mosquitto broker at Mosquitto website.
About license:
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php
Dygraphs is JS charting library that can handle huge data sets. It is used to create charts in chart view and Config panel. You can find more about it at Dygraphs website.
About license:
@license Copyright 2014 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT)
mqttwarn is program that subscribes to any number of MQTT topics and informs one or more services. You can find more about it at JP Mens GitHub repository.
About license:
Eclipse Public License – v 1.0 (http://www.eclipse.org/legal/epl-v10.html)