English:Jobs

From bab-tec.de wiki

Jump to: navigation, search

Back

Contents

General Tips

Cyclic telegram generator

You can use the time sender as a cyclic telegram generator. Many of the jobs in the eibPort need a triggering telegram. If you want to call this jobs cyclic interval just use the time telegrams from the time sender as input.

Counting working hours

Working hour counter.png
Configure a combination between the time sender as cyclic telegram generator and a counter job. The counter job uses the telegram of the light (or whatever working hours you want to count) as enabling object. Then you use the output of the time sender as an input for the counter job. Each time the time sender sends a telegram, the counter can increase it's value by one.

So if the time sender has an interval of 60 seconds, the counter holds the approximate minutes, the light was switched on.


astable multivibrator (flip-flop) 

17/0 Start (first input NAND)
17/1 Output
17/2 second input NAND
17/3 enable/disable (Gateobject)


Flip flop.JPG

Sending minimum / maximum daily values

The task to determine a minimum or maximum value per day and to send it via e-mail can be accomplished in a very simple way: every value telegram is compared to the previous reference value for minimum and maximum and will replace the previous reference value if neccessary. Around midnight, this value is sent by mail and reset. The following example explains how to capture a maximum temperature per day.

Neccessary Jobs:

Groupaddresses for the following example:

Comparator

EN MaxValue Comparator.png
Using the comparator to compare the received input value (16/1) to the previous maximum value (16/1). If the value is higher than the previous maximum it is sent as the new maximum value. If the value is lower then nothing further happens.

Weektimer

EN MaxValue WeekTimer.png
The weektimer sends one telegram shortly after midnight to start the following lightscene. We suggest to set the time not on midnight directly to avoid having too high bus load due to many tasks at the same time. This is why we don't use the yeartimer which would send the telegram exactly at midnight.

Lightscene

EN MaxValue LightScene.png
The light scene first triggers the email job and one second later, the maximum value is reset to a lowest value that will never appear (here -100°C).

E-Mail Job

EN MaxValue Mail.png
The e-mail job just sends the determined maximum value as a floating point value with two decimal places (format in the text: %.2f).

HTTP Requests

With http-Request it is possible to request and process content from websevers or to transmit data to a server. For this purpose the methods GET and POST are avaiable. Thereby the URL (uniform resource locater) is been put together out of different parts, the base URL, the target and the value object(s) resp. the contents as content type. Mandatory fields are 'Element name', 'Input Object' and 'Base URL'. For the processing of the servers' response a module is available which searches the answer with regular expressions and is triggering actions in the KNX bus depending on that.

Control Axis PTZ network camera via http request job

To control an Axis PTZ network camera with a KNX group address you have to use an http request Job.


The commands are documented in the “http request API”. Available on the manufacturer homepage. Here the link for Axis cameras: http://www.axis.com/au/en/support/developer-support/vapix

The PTZ commands are placed under the section “Pan/Tilt/Zoom API” (PTZ). Here the direct download link of the PDF: http://www.axis.com/files/manuals/vapix_ptz_52933_en_1307.pdf

On Page 20 you find the http request syntax you have to use for the PTZ function: http://<ip-address-camera>/axis-cgi/com/ptz.cgi?<argument>=<value>

Parameters: <ip-address-camera> - Give the IP address of the Axis camera. <argument> - Type the command “move” for PTZ function. Find more commands in the table starts from page 20 <value> - Give the possible values for the “move” command. Possible values are “home, up, down, left, right, upleft, upright, downleft, downright, stop” (see table on page 21) control the camera.


See the screen shot of an example http request Job:
Axis PTZ http request.png

To control the camera with the KNX group address 31/0/200 (see example screen shot), trigger the job with the value:

Request 'uptime' and 'load' of the eibPort

The URL you will need:

"http://<eibPort_IP>/cgi-bin/statcgi?uptime=on"
BN: status
pw: eibPort

Here is the regular expression with that this is done:

"up (.*), load average: ([\.\d]*), ([\.\d]*), ([\.\d]*)"

The four groups in the expression maps on the four output objects of the job. The datatype of all four outputs has to be EIS 15, otherwise the floating point values will not be shown correctly.

Note: Requesting the load average to often per minute can cause a much more higher load ;)

Request database status of the eibPort

under construction !

Request Weather Data

Weather data can be synchronized from the internet using the HTTP Request job: Weatherdata


The google weather api has been cancelled. This is just the example configuration for the HTTP Request job.

With a request to the google weather data server ("Google weather API") the eibPort gets an XML-file as response. The response is then filtered by the regular expression and the values are handed over by the outputs objects to the visualisation. For the request the following settings are necessary:

Protokoll: http://
Base-URL: www.google.com
Request Type: GET
GET-URL / Post Data: /ig/api?weather=Dortmund

Note: It is important to ensure, that the response of the request is made in the correct language. Is for example "google.de" used instead of "google.com" the response is given in german language.

With the city name behind "weather=" it is defined from which place the weather data is collected. Theoretically it is been possible to change this value dynamically by the help of the value objects.

If the URL of this request is been copied into the browser line and is requested, the response will be shown as an XML-file in the browser window. In our example we want to give out the current weather conditions, the current temperature in celsius, the current humidity and the maximum temperature for the next day. At first we create the expression for every single output, after this we fit them together.

Note: The expressions which are created are best verified with a tool. There are different tools available online, for example: http://dev.radsoftware.com.au/downloads /Rad.RegexDesigner.Setup.1.4.exe. Thereby it is to be considered that some of the flags have another meaning (e.g. Dot All = Singleline).

Important: In Mozilla Firefox it might be that you have a space sign behind the expression string when you copy it directly into the array of the job. Is this the case the expression won't work, so please check out exactly what is written in your expression array.


Current Weather Conditions:
The current weather data is written in the part "<current_conditions>". After it the information "<condition data=" is following. However this is repeated three times in the information "<forecast conditions>". To avoid that the expression is matching on all "condition data=" the string "<current_conditions>" must be prepent.

<current_conditions>.*?<condition data="([a-zA-ZäÄöÖüÜ\s]+)"

In order to have success with this expression there must be placed a ".*?" (dot - asterik - question mark) between the proper expression and the string "<current_conditions>" with the flag "DotAll" enabled. The background is, that this two strings are placed in different lines. By the help of the flag "DotAll" the expression is also taking care of the line ends (otherwise it would try to match line by line) and with the ".*?" the behaviour of the expression is "ungreedy".

This is the first group matching, thats why the output opbject 1 is defined as EIS 15 text.


Current temperature in celsius
The output of the current temperature is written behind the string "<temp_c data=". This appears only one time in the whole text. According to that the expression is:

temp_c data="([\-\+]?[0-9]+)

There must no flag be enabled. Because this is an temperature value the output object is been formatted in EIS 5. The data configuration is "ASCII – Unsigned long deicmal".


Current Humidity
The output of the current humidity is following behind the string "Humidity:". Should the the response be given in german language at this place is written "Feuchtigkeit" and the expression is not working (equally with other languages).

Humidity: ([0-9]+)

No flag is enabled for this. This is an percent value, thats why the output object is formatted EIS 6. The data configuration is "ASCII – Unsigned long deicmal".


Maximum temperature of the next day
The forecast for the upcoming days can be found in the section "<forecast_conditions>". There exists an information "high data=" in which the maximum temperature of the respective day is been given out. Certainly this section is existing altogether four times, for each of the following four days. In the recent case we are only interessested into the temperature of tomorrow, that means the first entry of "high data=".

high data="([\-\+]?[0-9]+)

All flags are disabled. This expression is giving out the first entry of altogether 4 matches. As it is a temperature value the output object is again formatted as EIS 5. The data configuration is "ASCII – Unsigned long deicmal".


All outputs in one regular expression
For the reason that 4 outputs objects can be used in one job, it is possible to filter out all above mentioned information with one regular expression and place them by help of the group configuration into the four objects. Thereby it is to be considered that the flag "DotAll" is been enabled, because the expression has to detect end of line. Between the different expression a ".*" is placed each.

<current_conditions>.*?<condition data="([a-zA-ZäÄöÖüÜ\s]+)".*temp_c data="([\-\+]?[0-9]+).*Humidity: ([0-9]+).*?high data="([\-\+]?[0-9]+)

Note: Between the expression for the humidity and the maximum temperature beside the ".*" a question mark must be placed to get the expression "ungreedy".

Mathematics

This section about the math job is listing all current function and operations. Further information you will find in the latest eibPort documentation. It is available in the download area of http://www.bab-tec.de/en/service/download/

The math module is subjected to enhancement as well as the eibPort firmware. At present there are two version: The version 1.1 and the version 1.2. The version number of the module can be requested by the function "version()" of the math job itself. Here is a little configuration example:

Output: 31/7/10 EIS 14
Input: 31/7/11 EIS 1
mathematical operation: version()

If now the math job receives a 1bit telegram on the input 31/7/11 it is giving out the number 17 (stands for 0x11 that means version 1.1) or the number 18 (stands for 0x12 that means the version 1.2).

All functions in math job version 1.1 (0x11)

Mathematical Operations:

Symbol Description
+ Addition (resp. stringing together)
- Subtraction
* Multiplication
/ Division (real numbers)
% Modulo (rest of an integer division)
& bit by bit AND operation
| bit by bit OR operation
^ exponentiate


Logical (boolean) operations

Symbol Description
|| logical OR
&& Logical AND
> Comparison operation "Greater than"
>= Comparison operation "Greater than or equal"
< Comparison operation "Less than"
<= Comparison operation "Less or equal"
== Comparison operation "equality"


Bitwise operations

Symbol Description
<< Shift left by x places (result = 0x01 << 3 // the result is 0x08)
>> Shift right by x places (result = 0x08 >> 3 // the result is 0x01)
& Bitwise AND (get LSB: result = 0x05 & 0x01)
| Bitwise OR (set LSB: result = 0x04 | 0x01)
^ Exclusive OR (result = 0x03 ^ 0x01 // the result is 0x02)
~ Binary invert (result = ~0x07 // the result is 0x08)


Ohter operations

Symbol Description
= Assignment
'(' and ')' Parenthesis for changing the operation process


Built in functions

Symbol Description
sqrt(x) Square root calculation
sin(x) Sine calculation
cos(x) Cosine calculation
tan(x) Tangens calculation
max(x,...) Maximum determination of an (finite) amount of values
min(x,...) Minimum determination of an (finite) amount of values
rad(x) Conversion from degrees into radian (sheet calculation)
asin(x) arc sine calculation
acos(x) arc cosine calculation
atan(x) arcus tangens calculation
ceil(x) Calculation of the smallest integer values, which is not smaller than the argument ("round off")
floor(x) Calculation of the largest integer values, which is not larger than the argument ("round down")
abs(x) Calculation of the absolute value of an argument
exp(x) Calculation of the base 'e' exponential function (euler's constant)
log10(x) Calculation of the base 10 logarithm
pow(x,y) Exponential function is calculating x^y
time() Ist giving out the system time in seconds from the beginning of the era (00:00:00 UTC, January 1, 1970)
srand(x) Is setting the (pseudo-)random generator to a definated start value
rand() Delivers the next random value
eo_sum(x,...) Adds the KNX-objects with the numbers according to the arguments
int(x) Is cutting off the real number and delivers only the integer value
modf(x) Delivers the decimal point of a real number (the places behind the decimal point)
round(x) Delivers a correct rounded integer of an real argument
round(x, n) Delivers a rounded value with n decimal places


Number types and strings:

Types Notation
Integer number 42
Hexadecimal number 0x12ab
Real number 1.23
Exponential number 1.23e3 für 1.23 * 10^3 oder 1023.0
String "text"


Predefined constant:

Symbol Description
M_PI The constant Pi (3.14.....)
M_E The euler's constant (Base of the natural logarithm)
M_LOG2E Base 2 logarithm of 'e'
M_LOG10E Base 10 logarithm of 'e'
M_LN2 Natural logarithm of 2
M_LN10 Natural logarithm of 10
M_PI_2 Pi divided by 2 ("Pi-half")
M_PI_4 Pi divided by 4 ("Pi-quarter")
M_1_PI Reciprocal value of Pi (1 divided by Pi)
M_2_PI 2 times 1 divided by Pi
M_2_SQRTPI 2 times 1 divided by root of Pi
M_SQRT2 Root of 2
M_SQRT1_2 Reciprocal of squareroot (resp. root of 1/2)


New functions in math job version 1.2 (0x12)

Access on the output value


Configuration of the inputs
Calculate Expression


Mathematical Operations:

Symbol Description
~ negate bit by bit
! logical negate (NOT)


Other operations:

Symbol Description
?: If-Then-Else Operator


Built in functions:

Symbol Description
eoiga() Delivers the group address which has triggered the expression (not formatted!)
eo_ga(idx, idx_ga) Delivers the group address of an object unformatted. "idx" defines the index number of the input, "idx_ga" defines the index number of the group address in the object. Both counting is beginng at "0" (from left to right).
ga_str(ga, fmt) Delivers the desired group address (ga = index number) as a string (EIS 15) on the output. With "fmt" 2- or 3-digit notation is been determined.
str_ga(str) Delivers the desired group address as an integer. 2- or 3-digit notation is no important factor.
version() Delivers the version number of the mathematic module. Currently this is "18" = version 1.2 (0x12) and "17" = version 1.1 (0x11).


Reserved variables

Variable Description
override_addr If the value of this variable is unequal "0", the original output address is been discarded and the value of this variable is been interpreted as the new output address instead (1-digit notation).
override_eis If the value of this variable is unequal "0", the original datatype configuration is been overwritten by that. Thereby there will be no adjustment of the value.
override_skip_send If the value of this variable is unequal "0", the transmission is been aborted. The running operation comes to no result.
override_keep_data If the value of this variable is unequal "0", not the calculated output value, but the input value which has triggered the operation is been used.


Some examples

This examples are showing how the functions, variables and operations are insert into the mathematical expression:



Triggering Lightscenes with EIS 14

The eibPort lightscene can only handle EIS 1 telegrams and can be started with the value 0 or 1 (depends on the configuration). There are many demands to trigger lightscenes with an EIS 14 value (e.g. value 5 triggers scene 5).

This can be done with the Math job with this formula:

 override_addr = (MAIN << 11) | (MIDDLE << 8) | eo(0); 1

MAIN and MIDDLE needs to be replaced with the main group and middle group the lightscene shall be triggered. So if I want to have 10 lightscenes which are triggered with the adresses 1/5/1-10 I'd insert 1 for MAIN and 5 for MIDDLE. The eo(0) is a variable for the first input of the job (with value 1-10). So the first part of this formula build the target group adress which is the trigger for the scene. The last 1 is just the value which will be sent to this address to trigger the scene.

E-Mail

In order to send e-mails with the eibPort at different locations settings has to be made.

E-Mail Provider settings

The e-mail provider settings you will reach by browsing “System” > “Configuration” > “eMail accounts”. There are two mail providers pre-set. Both providers can be used for testing proposals. Overall 10 providers can be set up.

If an individual provider should be used you will need the correct connection data. You will get this data from your e-mail provider, please enter this data according to it. By this you have to consider the following entries:

  1. Enabled: The entry must be enabled!
  2. TLS: Please ask you provider which authentication method is required!
  3. Realm: Means a group of users which accessed to the same server among other groups. Depending on the realm it is differed to which user group the client belongs. If it is not mentioned explicit at this point there is no entry necessary.
  4. Force default “From:”: Some mail server expect an designated e-mail address in the “From” array. Is an wrong address entered there the dispatch will not work. With the option “Force default “From:” every e-mail is sent with the here entered “From settings”, and not with the one which are entered into the e-mail Job!

By saving the provider the entry automatically gets an ongoing number. In case of the third set provider this is “mail_provider02”. This name is used to link the e-mail job.

Network settings

In order to have a working e-mail job the provider must be accessible. Beyond the standard configuration it is important to enter the following entries:

  1. Default gateway: The default gateway is the router which connects the network in which the eibPort is located with another one (mostly the internet). Normally here the address of the local router is been entered (e.g. 192.168.1.1).
  2. DNS-Server: A DNS Server is responsible for resolving hostnames (e.g. bab-tec.de) into ip-addresses (85.22.73.82) in the network. This service is normally offered by a server outside the own network in the internet. Modern routers (from the home market) dispose certainly over a “DNS forwarding” function and refers the DNS requests from the local network to the corresponding DNS servers. In this case here also the ip-address of the default gateway can be entered.

Another possibility would be to search for the valid DNS server entries in the configuration interface of the router and to transfer them into the eibPort or to use so called “Public DNS server” (e.g. from Google: 8.8.8.8). If the name resolution do not work, the e-mail job cannot resolve the hostname of the provider (e.g. mx.eibport.de) and therefore cannot connect to the e-mail server!

It is recommended always to use the server from you local internet service provider (DSL provider etc.)!

To verify if the connection settings are done correctly you can use the RSS Feed element in the Ajax Visualisation (Control L). Unlike the Java Visualisation the RSS Feed is requested by the eibPort itself and not by the visualisation client. If the RSS Feed is displayed the eibPort can establish a connection to the internet and is able to resolve hostnames!

E-Mail Job settings

In order to trigger an e-mail now only a E-Mail Job is necessary. The E-Mail Jobs are configured at “Editor” - “Job Editor” - “Send eMail”. For the beginning there should be used an easy configuration.

  1. Fill in the arrays “Job Name”, “Input Group Addresses”, “Receiver”, “Subject” and “Text”.
  2. Choose a desired “eMail-Provider” (the correct number you will find in the eMail Provider settings s.o.).
  3. Enter the correct Sender, if this is not done in the provider settings.

The triggering telegram (“Input Group Addresses”) must be an 1bit telegram (EIS 1). As the default send condition of the job is “ON or OFF”, the job reacts either on “1” than on “0”! For testing purpose add a switch element on a visualisation page and trigger it. You should then briefly receive an e-mail in the desired mailbox. Please consider that the e-mail service can be delayed at any time and an e-mail must not be received at once!

If the e-mail dispatch does not work despite all efforts, please contact the bab-tec support at info@bab-tec.de.

UDP-Sender

under construction!

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox