@actionsflow/trigger-weather 中文文档教程
@actionsflow/trigger-weather
这是使用 ActionsflowOpenweathermap API 的天气触发器>。 您可以使用此触发器观看某些城市的天气更新。
这是一个官方触发器,您不需要手动安装它。
Usage
07:00温度低于13°C时每天早上:
on:
weather:
apiKey: ${{ secrets.OPENWEATHERMAP_API_KEY }}
params:
lat: 51.509865
lon: -0.118092
units: metric
every: "0 7 * * *"
timeZone: UTC
filter:
"current.temp":
$lt: 13
今天什么时候下雨:
on:
weather:
apiKey: ${{ secrets.OPENWEATHERMAP_API_KEY }}
params:
lat: 51.509865
lon: -0.118092
units: metric
every: "0 7 * * *"
timeZone: UTC
filter:
"daily.0.weather.0.main":
$eq: Rain
Options
apiKey
,必填,Openweathermap API 密钥,你应该从 Openweathermap API 获取Keysapi
,可选,默认值为onecall
,您还可以使用Openweathermap提供的其他API。params
,可选,获取天气API参数,参见One Call API,或者Weather API(如果您使用其他API)对于
onecall
,您必须提供lat,lon
字段,例如:
params:
lat: 51.509865
lon: -0.118092
endpoint
,可选,默认值为https://api.openweathermap.org/data/2.5/
every
,可选,on.
的别名.config.every < code>timeZone,可选,
on.
.config.timeZone filter
,可选,on.
的别名;.config.filter
你可以使用 Ge Actionsflow Trigger 的 neral Config 用于更多自定义。
Outputs
此触发器的输出将是以下结果的项目。
onecall
输出示例:
{
"lat": 40.12,
"lon": -96.66,
"timezone": "America/Chicago",
"timezone_offset": -18000,
"current": {
"dt": 1595243443,
"sunrise": 1595243663,
"sunset": 1595296278,
"temp": 293.28,
"feels_like": 293.82,
"pressure": 1016,
"humidity": 100,
"dew_point": 293.28,
"uvi": 10.64,
"clouds": 90,
"visibility": 10000,
"wind_speed": 4.6,
"wind_deg": 310,
"weather": [
{
"id": 501,
"main": "Rain",
"description": "moderate rain",
"icon": "10n"
},
{
"id": 201,
"main": "Thunderstorm",
"description": "thunderstorm with rain",
"icon": "11n"
}
],
"rain": {
"1h": 2.93
}
},
"minutely": [
{
"dt": 1595243460,
"precipitation": 2.928
},
...
},
"hourly": [
{
"dt": 1595242800,
"temp": 293.28,
"feels_like": 293.82,
"pressure": 1016,
"humidity": 100,
"dew_point": 293.28,
"clouds": 90,
"visibility": 10000,
"wind_speed": 4.6,
"wind_deg": 123,
"weather": [
{
"id": 501,
"main": "Rain",
"description": "moderate rain",
"icon": "10n"
}
],
"pop": 0.99,
"rain": {
"1h": 2.46
}
},
...
}
"daily": [
{
"dt": 1595268000,
"sunrise": 1595243663,
"sunset": 1595296278,
"temp": {
"day": 298.82,
"min": 293.25,
"max": 301.9,
"night": 293.25,
"eve": 299.72,
"morn": 293.48
},
"feels_like": {
"day": 300.06,
"night": 292.46,
"eve": 300.87,
"morn": 293.75
},
"pressure": 1014,
"humidity": 82,
"dew_point": 295.52,
"wind_speed": 5.22,
"wind_deg": 146,
"weather": [
{
"id": 502,
"main": "Rain",
"description": "heavy intensity rain",
"icon": "10d"
}
],
"clouds": 97,
"pop": 1,
"rain": 12.57,
"uvi": 10.64
},
...
},
"alerts": [
{
"sender_name": "NWS Tulsa (Eastern Oklahoma)",
"event": "Heat Advisory",
"start": 1597341600,
"end": 1597366800,
"description": "...HEAT ADVISORY REMAINS IN EFFECT FROM 1 PM THIS AFTERNOON TO\n8 PM CDT THIS EVENING...\n* WHAT...Heat index values of 105 to 109 degrees expected.\n* WHERE...Creek, Okfuskee, Okmulgee, McIntosh, Pittsburg,\nLatimer, Pushmataha, and Choctaw Counties.\n* WHEN...From 1 PM to 8 PM CDT Thursday.\n* IMPACTS...The combination of hot temperatures and high\nhumidity will combine to create a dangerous situation in which\nheat illnesses are possible."
},
...
]
您可以像这样使用输出:
on:
weather:
apiKey: ${{ secrets.OPENWEATHERMAP_API_KEY }}
params:
lat: 51.509865
lon: -0.118092
units: metric
every: 0
filter:
"current.temp":
$lt: 13
jobs:
print:
name: Print
runs-on: ubuntu-latest
steps:
- name: Print Outputs
env:
current_temp: ${{ on.weather.outputs.current.temp }}
run: |
echo current_temp: $current_temp
对于其他 API 输出,请参见此处
@actionsflow/trigger-weather
This is a weather trigger using Openweathermap API of Actionsflow. You can watch some city's weather updates by using this trigger.
This is an official trigger, you don't need to install it manually.
Usage
When the temperature is below 13°C at 07:00 AM every morning:
on:
weather:
apiKey: ${{ secrets.OPENWEATHERMAP_API_KEY }}
params:
lat: 51.509865
lon: -0.118092
units: metric
every: "0 7 * * *"
timeZone: UTC
filter:
"current.temp":
$lt: 13
When it will rain today:
on:
weather:
apiKey: ${{ secrets.OPENWEATHERMAP_API_KEY }}
params:
lat: 51.509865
lon: -0.118092
units: metric
every: "0 7 * * *"
timeZone: UTC
filter:
"daily.0.weather.0.main":
$eq: Rain
Options
apiKey
, required, Openweathermap API key, you should get it from Openweathermap API Keysapi
, optional, the default value isonecall
, you can also use the other APIs provided by the Openweathermap.params
, optional, fetch weather API params, See One Call API, or Weather API(If you use the other API)For
onecall
, you must providelat,lon
field, for example:
params:
lat: 51.509865
lon: -0.118092
endpoint
, optional, the default value ishttps://api.openweathermap.org/data/2.5/
every
, optional, alias ofon.<trigger>.config.every
timeZone
, optional, alias ofon.<trigger>.config.timeZone
filter
, optional, alias ofon.<trigger>.config.filter
You can use General Config for Actionsflow Trigger for more customization.
Outputs
This trigger's outputs will be the item of the following results.
An onecall
outputs example:
{
"lat": 40.12,
"lon": -96.66,
"timezone": "America/Chicago",
"timezone_offset": -18000,
"current": {
"dt": 1595243443,
"sunrise": 1595243663,
"sunset": 1595296278,
"temp": 293.28,
"feels_like": 293.82,
"pressure": 1016,
"humidity": 100,
"dew_point": 293.28,
"uvi": 10.64,
"clouds": 90,
"visibility": 10000,
"wind_speed": 4.6,
"wind_deg": 310,
"weather": [
{
"id": 501,
"main": "Rain",
"description": "moderate rain",
"icon": "10n"
},
{
"id": 201,
"main": "Thunderstorm",
"description": "thunderstorm with rain",
"icon": "11n"
}
],
"rain": {
"1h": 2.93
}
},
"minutely": [
{
"dt": 1595243460,
"precipitation": 2.928
},
...
},
"hourly": [
{
"dt": 1595242800,
"temp": 293.28,
"feels_like": 293.82,
"pressure": 1016,
"humidity": 100,
"dew_point": 293.28,
"clouds": 90,
"visibility": 10000,
"wind_speed": 4.6,
"wind_deg": 123,
"weather": [
{
"id": 501,
"main": "Rain",
"description": "moderate rain",
"icon": "10n"
}
],
"pop": 0.99,
"rain": {
"1h": 2.46
}
},
...
}
"daily": [
{
"dt": 1595268000,
"sunrise": 1595243663,
"sunset": 1595296278,
"temp": {
"day": 298.82,
"min": 293.25,
"max": 301.9,
"night": 293.25,
"eve": 299.72,
"morn": 293.48
},
"feels_like": {
"day": 300.06,
"night": 292.46,
"eve": 300.87,
"morn": 293.75
},
"pressure": 1014,
"humidity": 82,
"dew_point": 295.52,
"wind_speed": 5.22,
"wind_deg": 146,
"weather": [
{
"id": 502,
"main": "Rain",
"description": "heavy intensity rain",
"icon": "10d"
}
],
"clouds": 97,
"pop": 1,
"rain": 12.57,
"uvi": 10.64
},
...
},
"alerts": [
{
"sender_name": "NWS Tulsa (Eastern Oklahoma)",
"event": "Heat Advisory",
"start": 1597341600,
"end": 1597366800,
"description": "...HEAT ADVISORY REMAINS IN EFFECT FROM 1 PM THIS AFTERNOON TO\n8 PM CDT THIS EVENING...\n* WHAT...Heat index values of 105 to 109 degrees expected.\n* WHERE...Creek, Okfuskee, Okmulgee, McIntosh, Pittsburg,\nLatimer, Pushmataha, and Choctaw Counties.\n* WHEN...From 1 PM to 8 PM CDT Thursday.\n* IMPACTS...The combination of hot temperatures and high\nhumidity will combine to create a dangerous situation in which\nheat illnesses are possible."
},
...
]
You can use the outputs like this:
on:
weather:
apiKey: ${{ secrets.OPENWEATHERMAP_API_KEY }}
params:
lat: 51.509865
lon: -0.118092
units: metric
every: 0
filter:
"current.temp":
$lt: 13
jobs:
print:
name: Print
runs-on: ubuntu-latest
steps:
- name: Print Outputs
env:
current_temp: ${{ on.weather.outputs.current.temp }}
run: |
echo current_temp: $current_temp
For the other API outputs, please see here
你可能也喜欢
- @0x-lerna-fork/listable 中文文档教程
- @0xkilo/localhost 中文文档教程
- @100tal-seg/seg-vue-material-template 中文文档教程
- @4geit/rct-project-builder 中文文档教程
- @555platform/555parser.ts 中文文档教程
- @8base/apollo-links 中文文档教程
- @aaa-backend-stack/devtools 中文文档教程
- @aappddeevv/dynamics-client 中文文档教程
- @abdevs/console-manager 中文文档教程
- @abdulghani/routerhelper 中文文档教程