Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metOfficeDataHub] Initial contribution #15367

Merged
merged 78 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
8fc9f67
[metOfficeDataHub] Initial Commit for v4
dag81 Aug 3, 2023
c7ed524
[metOfficeDataHub] Initial Commit for v4 updates
dag81 Aug 4, 2023
d9275cf
[metOfficeDataHub] Initial Commit for v4 updates
dag81 Aug 4, 2023
2d4fe2a
[metOfficeDataHub] Initial Commit for v4 updates
dag81 Aug 7, 2023
76ae456
[metOfficeDataHub] Updated snapshot version
dag81 Dec 23, 2023
550e4ae
[metOfficeDataHub] PR feedback adjustments
dag81 Mar 2, 2024
3397e2d
[metOfficeDataHub] New API updates
dag81 Mar 2, 2024
bc13219
[metOfficeDataHub] PR feedback adjustments
dag81 Mar 2, 2024
9718c0a
[metOfficeDataHub] Updated to 4.3
dag81 Sep 14, 2024
4e77ff8
[metOfficeDataHub] Channel name updates
dag81 Sep 15, 2024
32fe21f
[metOfficeDataHub] Channel group name updates
dag81 Sep 15, 2024
b67a8a6
[metOfficeDataHub] HttpClient init updated
dag81 Sep 15, 2024
46614dd
[metOfficeDataHub] Readme new line corrections and header check
dag81 Sep 15, 2024
c4b5902
[metOfficeDataHub] Exception handling cleanup
dag81 Sep 15, 2024
236b1ff
[metOfficeDataHub] dispose handlers and doc updates.
dag81 Sep 17, 2024
d0f8ea0
[metOfficeDataHub] charset read cleanup
dag81 Sep 17, 2024
a5ab0a1
[metOfficeDataHub] device config caching
dag81 Sep 17, 2024
24a0d55
[metOfficeDataHub] bridge cleanup
dag81 Sep 17, 2024
e1fd073
[metOfficeDataHub] Cleanups
dag81 Sep 17, 2024
84cd94b
[metOfficeDataHub] doc updates
dag81 Sep 17, 2024
dbc7fec
[metOfficeDataHub] code cleanup
dag81 Oct 5, 2024
a2b936e
[metOfficeDataHub] i18n pass 1
dag81 Oct 5, 2024
f8505a5
[metOfficeDataHub] Cleanups
dag81 Oct 5, 2024
e1af89e
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
7c1dfe8
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
6c4ccfa
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
0ef4268
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
306ad5b
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
8aa170b
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
56263e9
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
a6d46b7
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
7d05ffc
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
1f3a512
[metOfficeDataHub] PR Adjustments
dag81 Oct 11, 2024
59ed6a0
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
36da3a5
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
339f948
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
0939f70
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
c8c7afb
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
608811a
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
7c6f9da
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
fad5c5e
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
dd3f9a0
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
f08f37e
[metOfficeDataHub] PR Adjustments bugfixes
dag81 Oct 12, 2024
803a345
[metOfficeDataHub] PR Adjustments bugfixes
dag81 Oct 12, 2024
212dfe6
[metOfficeDataHub] PR Adjustments bugfixes
dag81 Oct 12, 2024
64febde
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
0c56dc0
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
ed8df4b
[metOfficeDataHub] Channel Label Updates
dag81 Oct 12, 2024
6506ba0
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
3fbc4ef
[metOfficeDataHub] PR Adjustments
dag81 Oct 12, 2024
45bdd30
[metOfficeDataHub] PR Adjustments
dag81 Oct 13, 2024
16d1e82
[metOfficeDataHub] PR Adjustments
dag81 Oct 13, 2024
02a3320
[metOfficeDataHub] PR Adjustments
dag81 Oct 13, 2024
7b26916
[metOfficeDataHub] Refactor ready for bridge init check
dag81 Oct 13, 2024
f4e714c
[metOfficeDataHub] PR Adjustments
dag81 Oct 13, 2024
787ecef
[metOfficeDataHub] PR Adjustments - Pre Refactor
dag81 Nov 3, 2024
ecc2330
[metOfficeDataHub] WIP: Rate limiter and site api start
dag81 Nov 7, 2024
5d5a182
[metOfficeDataHub] WIP: Site API integration to bridge
dag81 Nov 8, 2024
29a1b61
[metOfficeDataHub] WIP: Cleanups
dag81 Nov 8, 2024
48461b1
[metOfficeDataHub] WIP: Poll adjustments to allow coalescing later
dag81 Nov 9, 2024
d0a1d74
[metOfficeDataHub] WIP: Corrections to refactoring.
dag81 Nov 9, 2024
fff29f8
[metOfficeDataHub] WIP: Testing corrections and adjustments
dag81 Nov 10, 2024
8469d95
[metOfficeDataHub] WIP: Corrections to refactoring.
dag81 Nov 10, 2024
89e2dc5
[metOfficeDataHub] WIP: Corrections to refactoring.
dag81 Nov 10, 2024
5b0a813
[metOfficeDataHub] WIP: Corrections to refactoring.
dag81 Nov 10, 2024
557c977
[metOfficeDataHub] WIP: RF feedback adjustments to refactoring.
dag81 Nov 11, 2024
d7f1d07
[metOfficeDataHub] WIP: Corrections to refactoring.
dag81 Nov 11, 2024
fe6a643
[metOfficeDataHub] WIP: Cleanup unused logger
dag81 Nov 12, 2024
8921f85
[metOfficeDataHub] WIP: Init cleanup
dag81 Nov 12, 2024
83ccd1b
[metOfficeDataHub] WIP: Init double poll fix
dag81 Nov 13, 2024
4fe25a7
[metOfficeDataHub] Boundary condition adjustments
dag81 Nov 15, 2024
a232289
[metOfficeDataHub] Interfaces javadoc
dag81 Nov 16, 2024
e1a2670
[metOfficeDataHub] MET Office Ts Simplification
dag81 Nov 16, 2024
e264ff5
[metOfficeDataHub] unkown error text updated
dag81 Nov 16, 2024
8df8e72
[metOfficeDataHub] httpClient caching
dag81 Nov 16, 2024
760baef
[metOfficeDataHub] Start-up bug fix
dag81 Nov 17, 2024
3cba0b9
[metOfficeDataHub] Start-up bug fix
dag81 Nov 17, 2024
a160af0
[metOfficeDataHub] Readme example fix
dag81 Nov 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,11 @@
<artifactId>org.openhab.binding.meteostick</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.metofficedatahub</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.mffan</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.metofficedatahub/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
446 changes: 446 additions & 0 deletions bundles/org.openhab.binding.metofficedatahub/README.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.metofficedatahub/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.metofficedatahub</artifactId>

<name>openHAB Add-ons :: Bundles :: MetOffice DataHub Binding</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.metofficedatahub-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-metofficedatahub" description="MetOfficeDataHub Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.metofficedatahub/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.metofficedatahub.internal;

import java.util.Random;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
* The {@link MetOfficeDataHubBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author David Goodyear - Initial contribution
*/
@NonNullByDefault
public class MetOfficeDataHubBindingConstants {

public static final Gson GSON = new GsonBuilder()
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).setPrettyPrinting()
.disableHtmlEscaping().serializeNulls().create();

private static final String BINDING_ID = "metofficedatahub";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "account");
public static final ThingTypeUID THING_TYPE_SITE_SPEC_API = new ThingTypeUID(BINDING_ID, "site");

/**
* Site Specific API - Shared
*/

public static final String SITE_TIMESTAMP = "forecast-ts";

/**
* Site Specific API - Hourly Forecast Channel Names
*/
public static final String SITE_HOURLY_FORECAST_SCREEN_TEMPERATURE = "air-temp-current";

public static final String SITE_HOURLY_FORECAST_MIN_SCREEN_TEMPERATURE = "air-temp-min";
public static final String SITE_HOURLY_FORECAST_MAX_SCREEN_TEMPERATURE = "air-temp-max";

public static final String SITE_HOURLY_FEELS_LIKE_TEMPERATURE = "feels-like";

public static final String SITE_HOURLY_SCREEN_RELATIVE_HUMIDITY = "humidity";

public static final String SITE_HOURLY_VISIBILITY = "visibility";

public static final String SITE_HOURLY_PROBABILITY_OF_PRECIPITATION = "precip-prob";

public static final String SITE_HOURLY_PRECIPITATION_RATE = "precip-rate";

public static final String SITE_HOURLY_TOTAL_PRECIPITATION_AMOUNT = "precip-total";

public static final String SITE_HOURLY_TOTAL_SNOW_AMOUNT = "snow-total";

public static final String SITE_HOURLY_UV_INDEX = "uv-index";

public static final String SITE_HOURLY_PRESSURE = "pressure";

public static final String SITE_HOURLY_WIND_SPEED_10M = "wind-speed";

public static final String SITE_HOURLY_WIND_GUST_SPEED_10M = "wind-speed-gust";

public static final String SITE_HOURLY_MAX_10M_WIND_GUST = "wind-gust-max";

public static final String SITE_HOURLY_WIND_DIRECTION_FROM_10M = "wind-direction";

public static final String SITE_HOURLY_SCREEN_DEW_POINT_TEMPERATURE = "dewpoint";

public static final String SITE_DAILY_MIDDAY_WIND_SPEED_10M = "wind-speed-day";

public static final String SITE_DAILY_MIDNIGHT_WIND_SPEED_10M = "wind-speed-night";

public static final String SITE_DAILY_MIDDAY_WIND_DIRECTION_10M = "wind-direction-day";
public static final String SITE_DAILY_MIDNIGHT_WIND_DIRECTION_10M = "wind-direction-night";

public static final String SITE_DAILY_MIDDAY_WIND_GUST_10M = "wind-gust-day";

public static final String SITE_DAILY_MIDNIGHT_WIND_GUST_10M = "wind-gust-night";

public static final String SITE_DAILY_MIDDAY_VISIBILITY = "visibility-day";

public static final String SITE_DAILY_MIDNIGHT_VISIBILITY = "visibility-night";

public static final String SITE_DAILY_MIDDAY_REL_HUMIDITY = "humidity-day";

public static final String SITE_DAILY_MIDNIGHT_REL_HUMIDITY = "humidity-night";

public static final String SITE_DAILY_MIDDAY_PRESSURE = "pressure-day";
public static final String SITE_DAILY_MIDNIGHT_PRESSURE = "pressure-night";

public static final String SITE_DAILY_DAY_MAX_UV_INDEX = "uv-max";

public static final String SITE_DAILY_DAY_UPPER_BOUND_MAX_TEMP = "temp-max-ub-day";
public static final String SITE_DAILY_DAY_LOWER_BOUND_MAX_TEMP = "temp-max-lb-day";

public static final String SITE_DAILY_NIGHT_UPPER_BOUND_MAX_TEMP = "temp-min-ub-night";
public static final String SITE_DAILY_NIGHT_LOWER_BOUND_MAX_TEMP = "temp-min-lb-night";

public static final String SITE_DAILY_NIGHT_FEELS_LIKE_MIN_TEMP = "feels-like-min-night";

public static final String SITE_DAILY_DAY_FEELS_LIKE_MAX_TEMP = "feels-like-max-day";

public static final String SITE_DAILY_NIGHT_LOWER_BOUND_MIN_TEMP = "temp-min-lb-night";

public static final String SITE_DAILY_DAY_MAX_FEELS_LIKE_TEMP = "feels-like-max-day";

public static final String SITE_DAILY_NIGHT_LOWER_BOUND_MIN_FEELS_LIKE_TEMP = "feels-like-min-lb-night";

public static final String SITE_DAILY_DAY_LOWER_BOUND_MAX_FEELS_LIKE_TEMP = "feels-like-max-lb-day";

public static final String SITE_DAILY_DAY_UPPER_BOUND_MAX_FEELS_LIKE_TEMP = "feels-like-max-ub-day";

public static final String SITE_DAILY_UPPER_BOUND_MIN_FEELS_LIKE_TEMP = "feels-like-min-ub-night";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_PRECIPITATION = "precip-prob-day";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_PRECIPITATION = "precip-prob-night";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_SNOW = "snow-prob-day";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_SNOW = "snow-prob-night";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_HEAVY_SNOW = "heavy-snow-prob-day";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_HEAVY_SNOW = "heavy-snow-prob-night";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_RAIN = "rain-prob-day";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_RAIN = "rain-prob-night";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_HEAVY_RAIN = "day-prob-heavy-rain";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_HEAVY_RAIN = "night-prob-heavy-rain";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_HAIL = "hail-prob-day";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_HAIL = "hail-prob-night";

public static final String SITE_DAILY_DAY_PROBABILITY_OF_SFERICS = "sferics-prob-day";

public static final String SITE_DAILY_NIGHT_PROBABILITY_OF_SFERICS = "sferics-prob-night";

public static final String SITE_DAILY_DAY_MAX_SCREEN_TEMPERATURE = "temp-max-day";
public static final String SITE_DAILY_NIGHT_MIN_SCREEN_TEMPERATURE = "temp-min-night";

public static final String GROUP_PREFIX_HOURS_FORECAST = "current-forecast";
public static final String GROUP_PREFIX_DAILY_FORECAST = "daily-forecast";
public static final String GROUP_POSTFIX_BOTH_FORECASTS = "-plus";
public static final char GROUP_PREFIX_TO_ITEM = '#';

public static final String GET_FORECAST_URL_DAILY = "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/daily?latitude=<LATITUDE>&longitude=<LONGITUDE>";
public static final String GET_FORECAST_URL_HOURLY = "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/hourly?latitude=<LATITUDE>&longitude=<LONGITUDE>";
public static final String GET_FORECAST_KEY_LATITUDE = "<LATITUDE>";
public static final String GET_FORECAST_KEY_LONGITUDE = "<LONGITUDE>";
public static final String GET_FORECAST_API_KEY_HEADER = "apikey";
public static final int GET_FORECAST_REQUEST_TIMEOUT_SECONDS = 3;
public static final String EXPECTED_TS_FORMAT = "YYYY-MM-dd HH:mm:ss.SSS";

public static final long DAY_IN_MILLIS = 86400000;

public static final Random RANDOM_GENERATOR = new Random();

public static final String BRIDGE_PROP_FORECAST_REQUEST_COUNT = "Site Specific API Call Count";

public static final Runnable NO_OP = () -> {
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.metofficedatahub.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* The {@link MetOfficeDataHubBridgeConfiguration} class contains fields mapping thing configuration parameters.
*
* @author David Goodyear - Initial contribution
*/
@NonNullByDefault
public class MetOfficeDataHubBridgeConfiguration {

/**
* Site Specific API Subscription - API Key
*/
public String siteApiKey = "";

/**
* Rate limit of API call's in 24 hour period starting from 0000 (Free is capped at 360 - this allows 110 due to
* reboots)
*/
public int siteRateDailyLimit = 250;
}
Loading