-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Topic and payload format
Let we use all small letters and words sepearted by "_" for all topic and payload.
And since it is request and response model, let we use QoS 1.
For mqtt5 version:
Topic : openmeteo/v1/mqtt5/requests/weather_api
Properities:
- response topic: /* Topic to respond */
- correlation data: /* data to uniquely identify the response */
Payload :
Same as REST api of openmeteo. Reference: https://open-meteo.com/en/docs#api_documentation. Below is example of payload. Note: latitude and longitude are required as per open-meteo.
{
"data": {
"latitude": 11,
"longitude": 11,
"cell_selection": "land",
"forecast_days": 3,
"past_days": 0,
"daily": [
"temperature_2m_min",
"temperature_2m_max",
"rain_sum",
"showers_sum",
"snowfall_sum",
"weather_code",
"wind_speed_10m_max",
"wind_direction_10m_dominant",
"wind_gusts_10m_max",
"sunrise",
"sunset",
"daylight_duration",
"sunshine_duration"
]
}
}
Response:
forwarded the response from openmeta to the client along with correlation data in the requested topic.
For mqtt3 version:
Topic : openmeteo/v1/mqtt3/requests/weather_api
Payload :
Same as REST api of openmeteo. Reference: https://open-meteo.com/en/docs#api_documentation. Below is example of payload. Note: latitude and longitude are required as per open-meteo. In addtion, the payload should contain two additonal fields - response topic and correlation data.
{
"response_topic" : "example/response"
"correlation_data": 12
"data": {
"latitude": 11,
"longitude": 11,
"cell_selection": "land",
"forecast_days": 3,
"past_days": 0,
"daily": [
"temperature_2m_min",
"temperature_2m_max",
"rain_sum",
"showers_sum",
"snowfall_sum",
"weather_code",
"wind_speed_10m_max",
"wind_direction_10m_dominant",
"wind_gusts_10m_max",
"sunrise",
"sunset",
"daylight_duration",
"sunshine_duration"
]
}
}
Response:
forwarded the response from openmeta to the requested client with topic as given in the payload + / + correlation data. For the above example, the topic will be example/response/12