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

[openweathermap] Add support for persisting OneCall API forecasts #15963

Merged
merged 13 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
118 changes: 73 additions & 45 deletions bundles/org.openhab.binding.openweathermap/README.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,20 @@
<description>Location of weather in geographical coordinates (latitude/longitude/altitude).</description>
</parameter>
<parameter name="forecastDays" type="integer" min="0" max="8" step="1">
<label>Number of Days</label>
<description>Number of days for daily forecast, including the current day.</description>
<label>Number of Daily Forecast Channels</label>
<description>Number of days for daily forecast, including the current day and determining how many daily channels are
created.</description>
<default>6</default>
</parameter>
<parameter name="forecastHours" type="integer" min="0" max="48" step="1">
<label>Number of Hours</label>
<description>Number of hours for hourly forecast.</description>
<label>Number of Hourly Forecast Channels</label>
<description>Number of hours for hourly forecast, determining how many hourly channels are created.</description>
<default>12</default>
</parameter>
<parameter name="forecastMinutes" type="integer" min="0" max="60" step="1">
<label>Number of Minutes</label>
<description>Number of minutes for minutely precipitation forecast.</description>
<label>Number of Minutely Forecast Channels</label>
<description>Number of minutes for minutely precipitation forecast, determining how many minutely channels are
created.</description>
<default>0</default>
</parameter>
<parameter name="numberOfAlerts" type="integer" min="0" max="5" step="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ thing-type.openweathermap.weather-api.description = Provides access to the OpenW

# thing types config

bridge-type.config.openweathermap.weather-api.apikey.label = API Key
bridge-type.config.openweathermap.weather-api.apikey.description = API key to access the OpenWeatherMap API.
bridge-type.config.openweathermap.weather-api.apiVersion.label = One Call API Version
bridge-type.config.openweathermap.weather-api.apiVersion.description = One Call API version (defaults to 2.5, version 3.0 is available, but needs different subscription).
bridge-type.config.openweathermap.weather-api.apikey.label = API Key
bridge-type.config.openweathermap.weather-api.apikey.description = API key to access the OpenWeatherMap API.
bridge-type.config.openweathermap.weather-api.language.label = Language
bridge-type.config.openweathermap.weather-api.language.description = Language to be used by the OpenWeatherMap API.
bridge-type.config.openweathermap.weather-api.language.option.af = Afrikaans
Expand Down Expand Up @@ -136,12 +136,12 @@ thing-type.config.openweathermap.onecall-history.historyDay.label = History Day
thing-type.config.openweathermap.onecall-history.historyDay.description = Relative number of days in the past for historical data.
thing-type.config.openweathermap.onecall-history.location.label = Location of Weather
thing-type.config.openweathermap.onecall-history.location.description = Location of weather in geographical coordinates (latitude/longitude/altitude).
thing-type.config.openweathermap.onecall.forecastDays.label = Number of Days
thing-type.config.openweathermap.onecall.forecastDays.description = Number of days for daily forecast, including the current day.
thing-type.config.openweathermap.onecall.forecastHours.label = Number of Hours
thing-type.config.openweathermap.onecall.forecastHours.description = Number of hours for hourly forecast.
thing-type.config.openweathermap.onecall.forecastMinutes.label = Number of Minutes
thing-type.config.openweathermap.onecall.forecastMinutes.description = Number of minutes for minutely precipitation forecast.
thing-type.config.openweathermap.onecall.forecastDays.label = Number of Daily Forecast Channels
thing-type.config.openweathermap.onecall.forecastDays.description = Number of days for daily forecast, including the current day and determining how many daily channels are created.
thing-type.config.openweathermap.onecall.forecastHours.label = Number of Hourly Forecast Channels
thing-type.config.openweathermap.onecall.forecastHours.description = Number of hours for hourly forecast, determining how many hourly channels are created.
thing-type.config.openweathermap.onecall.forecastMinutes.label = Number of Minutely Forecast Channels
thing-type.config.openweathermap.onecall.forecastMinutes.description = Number of minutes for minutely precipitation forecast, determining how many minutely channels are created.
thing-type.config.openweathermap.onecall.location.label = Location of Weather
thing-type.config.openweathermap.onecall.location.description = Location of weather in geographical coordinates (latitude/longitude/altitude).
thing-type.config.openweathermap.onecall.numberOfAlerts.label = Number of Alerts
Expand Down Expand Up @@ -173,14 +173,20 @@ channel-group-type.openweathermap.oneCallCurrent.label = One Call API Current We
channel-group-type.openweathermap.oneCallCurrent.description = Current weather data from the One Call API.
channel-group-type.openweathermap.oneCallDaily.label = One Call API Daily Forecast
channel-group-type.openweathermap.oneCallDaily.description = Daily weather forecast delivered by the One Call API.
channel-group-type.openweathermap.oneCallDailyTimeSeries.label = One Call API Daily Forecast
channel-group-type.openweathermap.oneCallDailyTimeSeries.description = Daily weather forecast delivered by the One Call API.
channel-group-type.openweathermap.oneCallHistory.label = One Call API Historical Weather
channel-group-type.openweathermap.oneCallHistory.description = Historical weather data from the One Call API at this point in time the given day.
channel-group-type.openweathermap.oneCallHistoryHours.label = One Call API Hourly Historical Weather Data
channel-group-type.openweathermap.oneCallHistoryHours.description = Historical weather data from the One Call API per hour.
channel-group-type.openweathermap.oneCallHourly.label = One Call API Hourly Forecast
channel-group-type.openweathermap.oneCallHourly.description = Hourly weather forecast delivered by the One Call API.
channel-group-type.openweathermap.oneCallHourlyTimeSeries.label = One Call API Hourly Forecast
channel-group-type.openweathermap.oneCallHourlyTimeSeries.description = Hourly weather forecast delivered by the One Call API.
channel-group-type.openweathermap.oneCallMinutely.label = One Call API Minutely Forecast
channel-group-type.openweathermap.oneCallMinutely.description = Minutely precipitation delivered by the One Call API.
channel-group-type.openweathermap.oneCallMinutelyTimeSeries.label = One Call API Minutely Forecast
channel-group-type.openweathermap.oneCallMinutelyTimeSeries.description = Minutely precipitation delivered by the One Call API.
channel-group-type.openweathermap.station.label = Weather Station
channel-group-type.openweathermap.station.description = This is a weather station.
channel-group-type.openweathermap.station.channel.location.description = Location of the weather station or the city.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@
</channels>
</channel-group-type>

<channel-group-type id="oneCallMinutelyTimeSeries">
<label>One Call API Minutely Forecast</label>
<description>Minutely precipitation delivered by the One Call API.</description>
<channels>
<channel id="precipitation" typeId="precipitation"/>
</channels>
</channel-group-type>

<channel-group-type id="oneCallMinutely">
<label>One Call API Minutely Forecast</label>
<description>Minutely precipitation delivered by the One Call API.</description>
Expand All @@ -178,6 +186,30 @@
</channels>
</channel-group-type>

<channel-group-type id="oneCallHourlyTimeSeries">
<label>One Call API Hourly Forecast</label>
<description>Hourly weather forecast delivered by the One Call API.</description>
<channels>
<channel id="condition" typeId="condition"/>
<channel id="condition-id" typeId="condition-id"/>
<channel id="icon" typeId="condition-icon"/>
<channel id="icon-id" typeId="condition-icon-id"/>
<channel id="temperature" typeId="system.outdoor-temperature"/>
<channel id="apparent-temperature" typeId="apparent-temperature"/>
<channel id="pressure" typeId="system.barometric-pressure"/>
<channel id="humidity" typeId="system.atmospheric-humidity"/>
<channel id="dew-point" typeId="dew-point"/>
<channel id="wind-speed" typeId="system.wind-speed"/>
<channel id="wind-direction" typeId="system.wind-direction"/>
<channel id="gust-speed" typeId="gust-speed"/>
<channel id="cloudiness" typeId="cloudiness"/>
<channel id="precip-probability" typeId="precip-probability"/>
<channel id="rain" typeId="rain"/>
<channel id="snow" typeId="snow"/>
<channel id="visibility" typeId="visibility"/>
</channels>
</channel-group-type>

<channel-group-type id="oneCallHourly">
<label>One Call API Hourly Forecast</label>
<description>Hourly weather forecast delivered by the One Call API.</description>
Expand All @@ -203,6 +235,40 @@
</channels>
</channel-group-type>

<channel-group-type id="oneCallDailyTimeSeries">
<label>One Call API Daily Forecast</label>
<description>Daily weather forecast delivered by the One Call API.</description>
<channels>
<channel id="sunrise" typeId="sunrise"/>
<channel id="sunset" typeId="sunset"/>
<channel id="condition" typeId="condition"/>
<channel id="condition-id" typeId="condition-id"/>
<channel id="icon" typeId="condition-icon"/>
<channel id="icon-id" typeId="condition-icon-id"/>
<channel id="morning-temperature" typeId="morning-temperature"/>
<channel id="day-temperature" typeId="day-temperature"/>
<channel id="evening-temperature" typeId="evening-temperature"/>
<channel id="night-temperature" typeId="night-temperature"/>
<channel id="min-temperature" typeId="forecasted-min-outdoor-temperature"/>
<channel id="max-temperature" typeId="forecasted-max-outdoor-temperature"/>
<channel id="apparent-morning" typeId="apparent-morning"/>
<channel id="apparent-day" typeId="apparent-day"/>
<channel id="apparent-evening" typeId="apparent-evening"/>
<channel id="apparent-night" typeId="apparent-night"/>
<channel id="pressure" typeId="system.barometric-pressure"/>
<channel id="humidity" typeId="system.atmospheric-humidity"/>
<channel id="dew-point" typeId="dew-point"/>
<channel id="wind-speed" typeId="system.wind-speed"/>
<channel id="wind-direction" typeId="system.wind-direction"/>
<channel id="gust-speed" typeId="gust-speed"/>
<channel id="cloudiness" typeId="cloudiness"/>
<channel id="uvindex" typeId="forecasted-uvindex"/>
<channel id="precip-probability" typeId="precip-probability"/>
<channel id="rain" typeId="rain"/>
<channel id="snow" typeId="snow"/>
</channels>
</channel-group-type>

<channel-group-type id="oneCallDaily">
<label>One Call API Daily Forecast</label>
<description>Daily weather forecast delivered by the One Call API.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@

<channel-groups>
<channel-group id="current" typeId="oneCallCurrent"/>

<channel-group id="forecastMinutely" typeId="oneCallMinutelyTimeSeries"/>

<channel-group id="forecastMinutes01" typeId="oneCallMinutely"/>
<channel-group id="forecastMinutes02" typeId="oneCallMinutely"/>
<channel-group id="forecastMinutes03" typeId="oneCallMinutely"/>
Expand Down Expand Up @@ -208,6 +211,8 @@
<channel-group id="forecastMinutes59" typeId="oneCallMinutely"/>
<channel-group id="forecastMinutes60" typeId="oneCallMinutely"/>

<channel-group id="forecastHourly" typeId="oneCallHourlyTimeSeries"/>

<channel-group id="forecastHours01" typeId="oneCallHourly"/>
<channel-group id="forecastHours02" typeId="oneCallHourly"/>
<channel-group id="forecastHours03" typeId="oneCallHourly"/>
Expand All @@ -233,6 +238,8 @@
<channel-group id="forecastHours23" typeId="oneCallHourly"/>
<channel-group id="forecastHours24" typeId="oneCallHourly"/>

<channel-group id="forecastDaily" typeId="oneCallDailyTimeSeries"/>

<channel-group id="forecastToday" typeId="oneCallDaily">
<label>One Call API Todays Forecast</label>
<description>This is the weather forecast for today from the one call API.</description>
Expand Down Expand Up @@ -267,6 +274,9 @@
</channel-group>
</channel-groups>

<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>location</representation-property>

<config-description-ref uri="thing-type:openweathermap:onecall"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">

<thing-type uid="openweathermap:onecall">
<instruction-set targetVersion="1">
<add-channel id="precipitation" groupIds="forecastMinutely">
<type>openweathermap:precipitation</type>
</add-channel>

<add-channel id="condition" groupIds="forecastHourly">
<type>openweathermap:condition</type>
</add-channel>
<add-channel id="condition-id" groupIds="forecastHourly">
<type>openweathermap:condition-id</type>
</add-channel>
<add-channel id="icon" groupIds="forecastHourly">
<type>openweathermap:condition-icon</type>
</add-channel>
<add-channel id="icon-id" groupIds="forecastHourly">
<type>openweathermap:condition-icon-id</type>
</add-channel>
<add-channel id="temperature" groupIds="forecastHourly">
<type>system:outdoor-temperature</type>
</add-channel>
<add-channel id="apperent-temperature" groupIds="forecastHourly">
<type>openweathermap:apparent-temperature</type>
</add-channel>
<add-channel id="pressure" groupIds="forecastHourly">
<type>system:barometric-pressure</type>
</add-channel>
<add-channel id="humidity" groupIds="forecastHourly">
<type>system:atmospheric-humidity</type>
</add-channel>
<add-channel id="dew-point" groupIds="forecastHourly">
<type>openweathermap:dew-point</type>
</add-channel>
<add-channel id="wind-speed" groupIds="forecastHourly">
<type>system:wind-speed</type>
</add-channel>
<add-channel id="wind-direction" groupIds="forecastHourly">
<type>system:wind-direction</type>
</add-channel>
<add-channel id="gust-speed" groupIds="forecastHourly">
<type>openweathermap:gust-speed</type>
</add-channel>
<add-channel id="cloudiness" groupIds="forecastHourly">
<type>openweathermap:cloudiness</type>
</add-channel>
<add-channel id="precip-probability" groupIds="forecastHourly">
<type>openweathermap:precip-probability</type>
</add-channel>
<add-channel id="rain" groupIds="forecastHourly">
<type>openweathermap:rain</type>
</add-channel>
<add-channel id="snow" groupIds="forecastHourly">
<type>openweathermap:snow</type>
</add-channel>
<add-channel id="visbility" groupIds="forecastHourly">
<type>openweathermap:visibility</type>
</add-channel>

<add-channel id="sunrise" groupIds="forecastDaily">
<type>openweathermap:sunrise</type>
</add-channel>
<add-channel id="sunset" groupIds="forecastDaily">
<type>openweathermap:sunset</type>
</add-channel>
<add-channel id="condition" groupIds="forecastDaily">
<type>openweathermap:condition</type>
</add-channel>
<add-channel id="condition-id" groupIds="forecastDaily">
<type>openweathermap:condition-id</type>
</add-channel>
<add-channel id="icon" groupIds="forecastDaily">
<type>openweathermap:condition-icon</type>
</add-channel>
<add-channel id="icon-id" groupIds="forecastDaily">
<type>openweathermap:condition-icon-id</type>
</add-channel>
<add-channel id="morning-temperature" groupIds="forecastDaily">
<type>openweathermap:morning-temperature</type>
</add-channel>
<add-channel id="day-temperature" groupIds="forecastDaily">
<type>openweathermap:day-temperature</type>
</add-channel>
<add-channel id="evening-temperature" groupIds="forecastDaily">
<type>openweathermap:evening-temperature</type>
</add-channel>
<add-channel id="night-temperature" groupIds="forecastDaily">
<type>openweathermap:night-temperature</type>
</add-channel>
<add-channel id="min-temperature" groupIds="forecastDaily">
<type>openweathermap:forecasted-min-outdoor-temperature</type>
</add-channel>
<add-channel id="max-temperature" groupIds="forecastDaily">
<type>openweathermap:forecasted-max-outdoor-temperature</type>
</add-channel>
<add-channel id="apparent-morning" groupIds="forecastDaily">
<type>openweathermap:apparent-morning</type>
</add-channel>
<add-channel id="apparent-day" groupIds="forecastDaily">
<type>openweathermap:apparent-day</type>
</add-channel>
<add-channel id="apparent-evening" groupIds="forecastDaily">
<type>openweathermap:apparent-evening</type>
</add-channel>
<add-channel id="apparent-night" groupIds="forecastDaily">
<type>openweathermap:apparent-night</type>
</add-channel>
<add-channel id="pressure" groupIds="forecastDaily">
<type>system:barometric-pressure</type>
</add-channel>
<add-channel id="humidity" groupIds="forecastDaily">
<type>system:atmospheric-humidity</type>
</add-channel>
<add-channel id="dew-point" groupIds="forecastDaily">
<type>openweathermap:dew-point</type>
</add-channel>
<add-channel id="wind-speed" groupIds="forecastDaily">
<type>system:wind-speed</type>
</add-channel>
<add-channel id="wind-direction" groupIds="forecastDaily">
<type>system:wind-direction</type>
</add-channel>
<add-channel id="gust-speed" groupIds="forecastDaily">
<type>openweathermap:gust-speed</type>
</add-channel>
<add-channel id="cloudiness" groupIds="forecastDaily">
<type>openweathermap:cloudiness</type>
</add-channel>
<add-channel id="uvindex" groupIds="forecastDaily">
<type>openweathermap:forecasted-uvindex</type>
</add-channel>
<add-channel id="precip-probability" groupIds="forecastDaily">
<type>openweathermap:precip-probability</type>
</add-channel>
<add-channel id="rain" groupIds="forecastDaily">
<type>openweathermap:rain</type>
</add-channel>
<add-channel id="snow" groupIds="forecastDaily">
<type>openweathermap:snow</type>
</add-channel>
</instruction-set>
</thing-type>

</update:update-descriptions>