美文网首页
Huginn 监控天气情况

Huginn 监控天气情况

作者: Blankeer | 来源:发表于2017-12-25 21:14 被阅读200次

    需求

    监控天气是入门 agent 了,官方例子也有,我使用国内天气源,实现每两个小时通知我天气情况(温度,天气, pm2.5等)

    API

    天气情况当然得找 API 了,使用了这个 repo 里的

    实现

    {
      "expected_update_period_in_days": "2",
      "url": "http://tj.nineton.cn/Heart/index/all?city=替换成自己城市 code",
      "type": "json",
      "mode": "on_change",
      "extract": {
        "city_name": {
          "path": "weather[0].city_name"
        },
        "now_info": {
          "path": "weather[0].now.text"
        },
        "temperature": {
          "path": "weather[0].now.temperature"
        },
        "pm25": {
          "path": "weather[0].now.air_quality.city.pm25"
        },
        "air_quality": {
          "path": "weather[0].now.air_quality.city.quality"
        }
      }
    }
    

    通知

    通知到 slack / email 就可以了.

    相关文章

      网友评论

          本文标题:Huginn 监控天气情况

          本文链接:https://www.haomeiwen.com/subject/fujrgxtx.html