User Tools

Site Tools


get_weather_conditions_and_forecast

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
get_weather_conditions_and_forecast [2019/01/09 10:32] – created akuzmukget_weather_conditions_and_forecast [2019/01/09 10:41] akuzmuk
Line 1: Line 1:
 ===== Weather and resource monitoring ===== ===== Weather and resource monitoring =====
 +
 +
 +==== GetCurrentWeather() ====
 +
 +The GetCurrentWeather function returns the current weather conditions at the WebHMI installation location. The data is being updated approximately every two hours. The service requires an Internet connection, an account in Level2 and a subscription to the weather forecast. The function is available since version 2.5.2400.
 +
 +If for some reason the data has not been received, the value nil will be returned.
 +
 +The function returns a table with the following fields:
 +
 +^time | The time for which the weather data was received |
 +^text | A short textual description of the current weather|
 +^temperature | Air temperature in degrees Celsius|
 +^pressure | Atmospheric pressure in hPa| 
 +^humidity | Relative air humidity in %|
 +^windDirection | The direction of the wind origin, metrological degrees (north— 0 degrees)|
 +^windSpeed | Wind speed in m/s|
 +^cloudness | Covering the sky with clouds as a percentage|
 +^rain | Precipitation (rain), in mm|
 +^snow | Precipitation (snow), in mm|
 +
  
  
Line 44: Line 65:
 If for some reason the data has not been received, the value nil will be returned. If for some reason the data has not been received, the value nil will be returned.
  
-==== GetMeterConsumption(variable_name[, connection_name]) ==== 
-The GetMeterConsumption function returns the resource consumption for the specified counter. Parameters **variable_name** and //connection_name// work in the same way as in the function GetReg - they determine the register with the resource counter. Since version 3.2 there is no more **connection_name** parameter. 
- 
-Returned consumption of resources is the consumption of the meter for each hour from the beginning of the month to the current moment. Data is taken from Level2 times per hour. Why not from the local database? Because a) the data storage period on the SD card can be less than 1 month and b) because the SD card may fail and if it is replaced in the middle of the month, the data will be unreliable. 
- 
-The service requires an Internet connection, an account in Level2, and an active data storage service. The function is available since version 2.9. 
- 
-If for some reason the data has not been received, the value nil will be returned. 
- 
-==== GetResourceLimit(resource_name) ==== 
- 
-The GetResourceLimit function returns the limit of the specified resource for the current month. Limits are set in the Level2 system. 
- 
-Possible resources names are: "ELECTRICITY", "GAS", "HEAT", "WATER", "HOTWATER", "CUSTOM" 
- 
-Data is taken from Level2. Data on WebHMI is usually updated no later than 1 hour after they are updated in Level2. If there is no connection, the system will return the limits from the cache. The cache stores the limits for the current and the next two months. 
- 
-The service requires an Internet connection, an account in Level2. The function is available since version 2.9. 
- 
-If for some reason the data has not been received, the value nil will be returned. 
- 
-==== GetTodayDayType() ==== 
- 
-The GetTodayDayType function returns the type of the current day: work, holiday, holiday. The types of days are set in the Level2 system. 
- 
-Three types are valid: "Working", "Weekend", "Holiday". 
- 
-Data is taken from Level2. Data on WebHMI is usually updated no later than 1 hour after they are updated in Level2. If there is no connection, the system will return the limits from the cache. The cache stores the limits for the current and the next two months. 
- 
-The service requires an Internet connection, an account in Level2. The function is available since version 2.9. 
- 
-If for some reason the data has not been received, the value nil will be returned. 
- 
-==== GetTomorrowDayType() ==== 
- 
-The GetTomorrowDayType function is completely analogous to GetTodayDayType with the only difference that it returns data about the future. 
- 
-==== GetHolidaysStats() ==== 
- 
-GetHolidaysStats returns a table with the following fields: 
- 
-  ***currentMonthDays** – number of days in the current month 
-  ***nextMonthDays** - number of days in the next month 
-  ***currentMonthWeekends** - the number of dayoffs (according to the settings in the Level2 system) in the current month 
-  ***nextMonthWeekends** - the number of dayoffs (according to the settings in the Level2 system) in the next month 
-  ***currentMonthHolidays** - number of holidays (according to the settings in the Level2 system) in the current month 
-  ***nextMonthHolidays** - number of holidays (according to the settings in the Level2 system) in the next month 
- 
-Data is taken from Level2. Data on WebHMI is usually updated no later than 1 hour after they are updated in Level2. If there is no connection, the system will return the limits from the cache. The cache stores the limits for the current and the next two months. 
- 
-The service requires an Internet connection, an account in Level2. The function is available since version 2.9. 
- 
-If for some reason the data has not been received, the value nil will be returned. 
- 
-===== Connection control ===== 
- 
-==== GetConnectionAddress (connection) ==== 
-The GetConnectionAddress function returns the current address of the device with which it is communicating. The function is available since version 3.0. 
- 
-The //connection// parameter specifies which connection to take the address from: 
-  *connection ID  
-  *Lua variable name 
-<code> 
-  Please note that numerical constants like ID numbers complicate the reading of the code and it is preferable to  
-  use named lines. 
-</code> 
- 
-If no connection is found, nil is returned. 
- 
-For connections connected via RS-485, the address is a number. GetConnectionAddress will return values ​​of type number. 
- 
-For TCP and UDP connections, the address is its IP address or host name. GetConnectionAddress will return values ​​of type string. 
- 
-==== SetConnectionAddress (connection, new_address) ==== 
-The SetConnectionAddress function replaces the current address of the device being communicated with a new one. The function is available since version 3.0. SetConnectionAddress is designed to work in projects with hot backup controllers and allows you to read registers from a particular (active, working) PLC. 
- 
-The //connection// parameter specifies for which connection the address should be replaced: 
-  *connection ID  
-  *Lua variable name  
- 
-If no connection is found, nil is returned. If the address was changed successfully, the function returns true. If you try to replace the address in internal register connection, the function returns false. 
- 
-For connections connected via RS-485, the address is a number. SetConnectionAddress expects the value of new_address to be of type number. 
- 
-For TCP and UDP connections, the address is its IP address or host name. SetConnectionAddress expects the values ​​of new_address to be of type string. 
- 
-==== GetConnectionUnitId (mb_connection) ==== 
-The GetConnectionUnitId function returns the current Unit Id of the specified Modbus TCP connection. The function is available since version 3.1. 
- 
-The //mb_connection// parameter is the Modbus connectoin ID or its Lua name.  
- 
-If no connection was found, nil will be returned. 
- 
-Unit Id is a number (0 .. 255). GetConnectionUnitId will return values ​​of type number. 
- 
-==== SetConnectionUnitId(mb_connection, new_unit_id) ==== 
-The SetConnectionUnitId function replaces the current Unit Id in provided Modbus TCP connection. The function is available since version 3.1. SetConnectionUnitId is designed to work in projects with hot backup controllers and allows you to read registers from a particular (active, working) PLC. 
- 
-  * mb_connection - Modbus TCP connection ID or its Lua name.   
- 
-If no connection is found, nil is returned. If the unit id was changed successfully, the function returns true. If you try to replace the address in internal register connection, the function returns false. 
- 
-Unit Id is a number (0 .. 255). SetConnectionUnitId expects the value of new_unit_id to be of type number. 
- 
-==== EnableConnection (connection) ==== 
-EnableConnection turns on polling registers "on-the-fly" in the specified connection. The function is available since version 3.0. In the project configuration, the checkbox 'Disconnect' for the specified connection does not change. 
- 
-  *connection - ID or Lua name  
- 
-==== DisableConnection(connection) ==== 
-DisableConnection disables polling registers "on the fly" in the specified connection. The function is available since version 3.0. In the project configuration, the checkbox 'Disconnect' for the specified connection does not change. 
- 
-  *connection - ID or Lua name  
- 
-==== IsConnectionEnabled(connection) ==== 
- 
-The IsConnectionEnabled function tells whether the polling of registers in the specified connection is enabled. The function is available since version 3.0. 
- 
-  *connection - ID or Lua name for the connection to be enabled.  
- 
-==== GetConnectionErrors(connection) ==== 
- 
-The GetConnectionErrors function reports whether there were errors while reading the registers in the last scan in the specified connection. The function is available since version 3.0. 
- 
-  *connectoin - ID of Lua name of the connection being checked 
- 
-If there were no errors, then the function returns zero. If there were errors, then the ID of the last register is returned, which was not read. 
- 
- 
-==== GetConnectionScanTime(connection) ==== 
- 
-The GetConnectionScanTime function returns the time taken to poll the registers in the last scan in the specified connection. The function is available since version 3.0. 
- 
-  *connectoin - ID or Lua variable name 
- 
-The function returns the time in milliseconds. 
- 
- 
-==== GetConnectionErrorScans(connection) ==== 
- 
-The GetConnectionErrorScans function returns the number of consecutive scans in which there were errors reading the registers in the specified connection. The function is available since version 3.0. 
- 
-  *connection - ID or Lua variable name  
- 
-The function returns the number of scans in which read errors occurred. If in any scan there were no read errors in this connection, the counter is reset to zero. 
- 
-===== Status ===== 
- 
-==== IsInternetConnectionAlive ==== 
-The IsInternetConnectionAlive function returns 1 when Internet connection is active and working. Otherwise it returns 0. The function is available since version 3.2. 
- 
-==== IsVPNConnectionAlive ==== 
-The IsVPNConnectionAlive function returns 1 when VPN connection is active and working. Otherwise it returns 0. The function is available since version 3.2. 
  
get_weather_conditions_and_forecast.txt · Last modified: 2023/02/20 10:28 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki