Français:Tâches
From bab-tec.de wiki
Contents |
Astuces générales
Générateur de télégrammes cycliques
Vous pouvez utiliser envoyer l'heure comme un générateur télégramme cyclique. Beaucoup de tâches dans l'eibPort ont besoin d'un télégramme de liberation. Si vous voulez utilisez un télégramme cyclique pour ces tâches vous pouvez utilisez la tâche envoyer l'heure comme entrée.
Compter le temps de fonctionnement
Configurer une combinaison entre le générateur de télégramme cyclique de Envoyer l'heure et la tâche Compteur. La tâche Compteur utilise le télégramme de la lampe (ou des autres éléments que vous voulez connaitre le temps de fonctionnement) comme objet de libération. Ensuite utilisé la sortie de la tâcheEnvoyer l'heure comme entrée de la tâche Compteur.Chaque fois que la tache Envoyer l'heure envoi un télégramme, le Compteur est incrémenter de la valeur un.Donc, si la tâche envoi un télégramme toutes les 60 secondes, le compteur affichera la durée approximative en minutes que la lampe a été allumée.
Bascule Astable(SET/RESET)
17/0 Première entrée du NonEt (RESET)
17/1 Sortie
17/2 Deuxième entrée du NonEt (SET)
17/3 Activer/Désactiver (objet de libération)
HTTP Requests
Avec http-request, il est possible de demander et traiter le contenu de serveurs web ou de transmettre des données à un serveur. A cet effet, les méthodes GET et POST sont disponibles. L'URL (indicateur de source uniforme) est composé de trois parties distinctes, l'URL de base, la cible et les L'URL (indicateur de source uniforme), il est composé de trois parties distinctes, l'URL de base, cibles et la valeur de l'objet ou type de contenu. Les champs obligatoires sont le nom des éléments, objet de saisie et de l'URL de base. Pour évaluer les réponses d'un serveur Web un module qui recherche dans la réponse avec des expressions régulières et déclenche des actions sur le bus KNX est disponible.
Interrogez la «disponibilité» et «la charge» de l'eibPorts
L'URL que vous avez besoin:
"http://<eibPort_IP>/cgi-bin/statcgi?uptime=on"
BN: status
pw: eibPort
Voici l'expression régulière pour faire cela:
"up (.*), load average: ([\.\d]*), ([\.\d]*), ([\.\d]*)"
Les quatre groupes dans l'expression pointant vers les quatre objets de sortie de la tâche. Le type de données pour les quatre sorties doit être EIS15, sinon les valeurs à virgule flottante ne sont pas affichés correctement.
'Note': La Demande de la charge moyenne trop souvent par minute peut entraîner une charge beaucoup plus élevé;)
Interroger le statut de la base de donnée de l'eibPort
En construction !
Request Weather Data
Weather data can be synchronized from the internet using the HTTP Request job: Donnée Météo
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) |
The new functions in math job version 1.2 (0x12)
Access on the output value
- eo_out()
Configuration of the inputs
Calculate Expression
- Always: The calculation is been executed as soon as any input is detected at the input objects.
- Never: The calculation is never been executed by this input. Certainly the value of the input object is been considered during the execution of the expression.
- On value change: Only when the input value changes according to the former value, the calculation is been executed.
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:
- „eo(1) + 100“ => Returns the value of the KNX-object with the number 1 (mentioned as EO_1 in the following) plus 100. Of course it is important to consider the possible range of KNX-output objects!
- „eo(3)*eo(4)“ => Multiplies EO_3 and EO_4. If there is no group address assigned to a KNX-object an error is been dropped.
- „100 / eo(1)“ => Divides 100 by EO_1. Attention: If a zero is been sent on input 1, the calculation of this expression delivers a run-time-error! ("Division by zero").
- „sqrt(eo(0)^2+eo(1)^2)“ => Is calculating the length of the hypotenuse in a right angled triangle, if on EO_0 and EO_1 the length of the cathetus is been sent. ("Pythagorean theorem")
- „eoi()“ => Returns 2, if on the KNX-Object with the number 2 is received something.
- „eo(eoi())“ => Returns the received value.
- „eo(eoi())^2“ => Is calculating the square of the received telegram value.
- „rand()“ => Returns a random value.
- „rand() & 0xff“ => Limits this value from 0 to maximum 255. So the result can be displayed with EIS 14.
- „srand(time())“ => Returns nothing (resp. zero), but initiate the random generator with a pseudo-random start value.
- „eo(0)+eo(2)+eo(3)+eo(1)+eo(5)+eo(6)+eo(4)“ => Is calculating the sum of multiple KNX-Objects.
- „eo_sum(0,1,2,3,4,5,6)“ => Like above, but much more "runtime friendlier" and insightful.
- „"foo" + "bar"“ => Returns "foobar" as result. This can only be sent as EIS 15 on the output.
- „eo(0)>23?1:0“ => Returns 1 if the value of the input object is above 23 (degrees EIS 5) and 0 if the value is smaller or equal than 23.
- „eo_ga(0,1)“ => Returns the second group address in the first input object (eo(0)) as unformatted number.
- „ga_str(0,2)“ => Returns the group address of the input 1 as string (EIS 15 text) in two digit notation on the output. "...(0,3)" returns the address in three digit notation.
- „str_ga("17/1/2")“ => Returns the number "35074" on the output.
- „override_addr=(eo(0)>10?61482:61480); eo(0)>10?1:0“ => Sends 1 on the address 30/0/42 if the input value is larger than 10, and 0 on the address 30/0/42 if the input value is smaller than 10.
- „override_addr=(eo(0)>10?61482:61480); override_eis=(eo(0)>10?1:9); eo(0)>10?1:2400“ => Sends 1 as EIS 1 (1bit) on the address 30/0/42 if the input value eo(0) is larger than 10, and sends 2400 as EIS 9 (4byte) on the address 30/0/40 if the input value is smaller than 10.
- „override_addr=(5<<11) | (1<<8) | eo(0); 1“ => sends value '1' to the group address 5/1/x, where x is the value of eo(0)
- „override_skip_send=(eo(0)>10?1:0)“ => Is the input value of eo(0) smaller than 10, a 0 is been sent on the output, if the value is larger than 10 the jobs sends nothing.
- „x=(eo(0)>10?1:0); override_keep_data=x“ => Returns a output value from 0 to 10 or the value of the triggering input telegram.
- „version()“ => Returns the current version number of the math job with a arbitrary input telegram.
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.
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:
- Enabled: The entry must be enabled!
- TLS: Please ask you provider which authentication method is required!
- 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.
- 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:
- 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).
- 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.
- Fill in the arrays “Job Name”, “Input Group Addresses”, “Receiver”, “Subject” and “Text”.
- Choose a desired “eMail-Provider” (the correct number you will find in the eMail Provider settings s.o.).
- 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!