# Weather

![App schema](https://raw.githubusercontent.com/eliona-smart-building-assistant/weather-app2/refs/heads/develop/schema.png)

### Installation

1. Navigate to the Eliona App Store
2. Search for "Weather App"
3. Click "Install" and confirm the installation
4. Wait for the installation confirmation (usually 1-2 minutes)

### Configuration

#### OpenWeatherMap registration

1. Visit [OpenWeatherMap](https://openweathermap.org/) and create an account
2. Subscribe to the "One Call API 3.0" service (free version available)
3. Generate your API key in the account dashboard
4. Note your API key for the Eliona configuration

#### App configuration parameters

| Parameters        | Description                             | Required | Default value |
| ----------------- | --------------------------------------- | -------- | ------------- |
| `apiKey`          | Your OpenWeatherMap API key             | Yes      | -             |
| `enable`          | Enables/disables the configuration      | Yes      | true          |
| `refreshInterval` | Data synchronization interval (seconds) | Yes      | 300           |
| `requestTimeout`  | API request timeout (seconds)           | No       | 120           |
| `projectIDs`      | Eliona project IDs for data collection  | Yes      | -             |

#### Configuration steps

1. Navigate to `Settings > Apps > Weather` in Eliona
2. Access the Generic Frontend interface
3. Use the configuration endpoint with the PUT method
4. Enter your configuration in JSON format:

```json
{
  "apiKey": "your-api-key",
  "enable": true,
  "refreshInterval": 300,
  "requestTimeout": 120,
  "projectIDs": [
    "10"
  ]
}
```

### Asset management

#### Asset type

The app creates a `Weather`asset type that represents weather monitoring locations.

#### Creating weather assets

1. Navigate to Assets in Eliona
2. Click "Create new asset"
3. Select "Weather" as the asset type
4. Configure the basic asset properties
5. Save the new asset

#### Location configuration

1. Open your weather asset
2. Click the edit button
3. In the "Additional information" section:
   * Enter the location name (e.g. "Zurich, Switzerland")
   * For best results, use the format: "City, Country" or "City, State, Country"
4. Save the configuration
5. Refresh the page to verify:
   * The location name appears with additional geographic details
   * Weather data begins to populate the asset attributes

#### Location troubleshooting

If the location is not found:

1. Try more specific location names
2. Add country or state information
3. Check whether the location exists in the OpenWeatherMap database
4. Check for typos in the location name

### Weather data attributes

The app provides these weather properties:

| Attribute   | Description                                                 | Unit |
| ----------- | ----------------------------------------------------------- | ---- |
| temperature | Current air temperature                                     | °C   |
| feels\_like | Perceived temperature taking wind and humidity into account | °C   |
| pressure    | Air pressure at the location                                | hPa  |
| humidity    | Relative humidity in percent                                | %    |
| dew\_point  | Temperature at which dew forms                              | °C   |
| uvi         | Ultraviolet index indicating the risk of sunburn            | -    |
| clouds      | Percentage of cloud cover                                   | %    |
| wind\_speed | Current wind speed                                          | m/s  |
| wind\_deg   | Wind direction in degrees (0-360)                           | °    |

### App status monitoring

The app creates a "Weather Root" asset that provides:

#### Status indicators

* **Asset status**: Indicates the active/inactive state
* **Status attribute**: Current operating status with possible values:

| Status         | Description                         | Recommended action                                    |
| -------------- | ----------------------------------- | ----------------------------------------------------- |
| OK             | Normal operation                    | No action required                                    |
| API\_ERROR     | Problem with the OpenWeatherMap API | Check the API key and network connection              |
| CONFIG\_ERROR  | Configuration problem               | Check the app configuration                           |
| RATE\_LIMIT    | API rate limit exceeded             | Increase the refresh interval or upgrade the API plan |
| NETWORK\_ERROR | Connection problem                  | Check network settings                                |

### Use cases

#### Building energy optimization

* Adjustment of HVAC systems based on outside temperature
* Optimization of cooling systems using humidity data
* Implementation of natural ventilation strategies based on wind conditions

#### Renewable energy management

* Forecasting solar power generation using cloud cover data
* Adjusting wind turbine operation based on wind speed/direction
* Implementation of weather-dependent energy storage strategies

#### Facility management

* Planning maintenance activities considering weather conditions
* Implementation of weather-dependent cleaning schedules
* Optimizing landscape irrigation based on precipitation forecasts

#### Analytics and reporting

* Correlation of energy consumption with weather patterns
* Creation of reports on weather impacts
* Creation of predictive models for energy consumption
