『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 27661|回复: 22

[进阶教程] 新手进阶:hass之软硬结合应用大法-彩云天气的应用实例一

[复制链接]

62

主题

603

帖子

6388

积分

论坛元老

Rank: 8Rank: 8

积分
6388
金钱
5710
HASS币
240

教程狂人论坛风云人物

发表于 2018-1-7 22:36:05 | 显示全部楼层 |阅读模式
本帖最后由 antsunzj 于 2018-1-8 10:40 编辑

      年关已至,忙成狗。所以很久没有写过帖子,也没有时间给以前写的帖子回答大家的疑问。今晚粗略的浏览一下,那些问题,其实论坛都是能找到答案的。善用搜索。
    不知不觉,玩hass已经有半年多了。从最初的装系统,到把各种设备接入或者diy,再到各种语音方案的应用包括:接入homekit使唤siri开关灯,后来的吃灰叮咚音箱死而复生,还有若琪+小爱+天猫等。hass就是设备接入+声控。还好,论坛有L大为代表的大神们,不断给我们写各种插件,hass的使用打开另外一层新天地:自动化+软硬结合。我觉得这应该是hass兼容万物之外,更深层次的优点。今晚,我想把我过去一段时间用的比较顺的彩云天气的应用实例跟大家分享一下。

一、彩云天气+微信插件
1.基础:必须要安装好L大写的彩云天气插件+微信插件。具体自己去论坛学习。
2.应用背景:小区邻居关系比较好,平时都是大家的父母带小孩在院子里面玩,还有一些人习惯把衣服晾在天台。所以对天气的变化的感知很大的需求。
所以,我建立了个微信群,小区里面的有需要的邻居和楼栋的物业管家加进来,设定了定期预报天气+突发天气状况(空气质量警报+气温变化警报+下雨警报等)的package。具体例子如下:


pm预报.png
定时预报.png
package相关代码:
  • 建立微信发送对象的相关脚本
script:
  wechat_to_panpuwan:  
    sequence:  
      - service: notify.wechatnotify
        data_template:
          target: 
            - 泮浦湾天气预报群#group#            
            - 萝卜
          message: '{{ msg }}'

  • 自动化一:最近半个小时下雨概率大于60%提醒
automation:
  - alias: 'weather_report_start'
    trigger:
      - platform: numeric_state
        entity_id: sensor.caiyun_minutely_probability_0
        above: 60
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_minutely_probability_0
        above: 70
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_minutely_probability_0
        above: 80
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_minutely_probability_0
        above: 90
        value_template: '{{ state.state }}'                
    condition:
      condition: time
      after: '06:00:00'
      before: '23:00:00'   
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: '请各位邻居留意这个天气预报(仅覆盖泮浦湾方圆三公里,以下消息仅供参考):最近半个小时有{{states.sensor.caiyun_minutely_probability_0.state}}%的概率会下雨。'

  • PM2.5预警提醒

  - alias: 'weather_report_start'
    trigger:
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_pm25
        above: 50
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_pm25
        above: 100
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_pm25
        above: 150
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_pm25
        above: 180
        value_template: '{{ state.state }}'    
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_pm25
        below: 40
        value_template: '{{ state.state }}'               
    condition:
      condition: time
      after: '06:00:00'
      before: '23:00:00'   
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: >
            请各位邻居留意这个空气质量预报(仅覆盖泮浦湾方圆三公里,以下消息仅供参考):
            {%- if states.sensor.caiyun_realtime_pm25.state | float >= 115 and states.sensor.caiyun_realtime_pm25.state | float < 1000 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,中度甚至重度污染。可能对健康人群心脏、呼吸系统有影响,建议疾病患者避免长时间、高强度的户外锻练,一般人群适量减少户外运动。
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 75 and states.sensor.caiyun_realtime_pm25.state | float < 115 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,轻度污染。建议儿童、老年人及心脏病、呼吸系统疾病患者应减少长时间、高强度的户外锻炼。           
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 35 and states.sensor.caiyun_realtime_pm25.state | float < 75 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,空气属于良。某些污染物可能对极少数异常敏感人群健康有较弱影响,建议极少数异常敏感人群应减少户外活动。
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 10 and states.sensor.caiyun_realtime_pm25.state | float < 35 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,空气状况属于优。质量令人满意,基本无空气污染,各类人群可正常活动,可以打开家里的门窗换气。
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 0 and states.sensor.caiyun_realtime_pm25.state | float < 10 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,此时空气简直好的让人不敢相信呀,让我门愉快的玩耍吧。            
            {%- endif %}

  • 温度预警提醒
  - alias: 'temp_warning_cool'
    trigger:
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_temperature
        above: 28
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_temperature
        below: 18
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_temperature
        below: 15
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_realtime_temperature
        below: 10
        value_template: '{{ state.state }}'                
    condition:
      condition: time
      after: '06:00:00'
      before: '00:00:00'   
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: >
            {%- if states.sensor.caiyun_realtime_temperature.state | float >= 28 and states.sensor.caiyun_realtime_temperature.state | float < 35 -%}          
            各位领居请注意这个气温预警:目前是{{states('sensor.caiyun_realtime_temperature')}}°C,非常炎热,穿衣建议:盛夏着装,轻棉织物制作的短衣、短裤、薄短裙、短裙;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 24 and states.sensor.caiyun_realtime_temperature.state | float < 28 -%}
            各位领居请注意这个气温预警:目前是{{states('sensor.caiyun_realtime_temperature')}}°C,热舒适,穿衣建议:夏季着装,棉麻面料的衬衫、长裤、薄长裙、薄T恤;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 20 and states.sensor.caiyun_realtime_temperature.state | float < 24 -%}
            各位领居请注意这个气温预警:目前只有{{states('sensor.caiyun_realtime_temperature')}}°C,有点凉快,穿衣建议:春秋过渡装,单层棉麻面料的短套装、T恤衫、薄牛仔衫裤、休闲服、职业套装;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 15 and states.sensor.caiyun_realtime_temperature.state | float < 20 -%}
            各位领居请注意这个气温预警:目前只有{{states('sensor.caiyun_realtime_temperature')}}°C,已经比较冷了,穿衣建议:秋冬过度装,风衣、大衣、夹大衣、外套、毛衣、毛套装、西装、防寒服;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 10 and states.sensor.caiyun_realtime_temperature.state | float < 15 -%}
            各位领居请注意这个气温预警:目前只有{{states('sensor.caiyun_realtime_temperature')}}°C,已经非常冷了,穿衣建议:秋冬着装,毛衣、风衣、毛套装、西服套装;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 0 and states.sensor.caiyun_realtime_temperature.state | float < 10 -%}
            各位领居请注意这个气温预警:目前只有{{states('sensor.caiyun_realtime_temperature')}}°C,冷到没人性,穿衣建议:冬季着装,棉衣、冬大衣、皮夹克、厚呢外套、呢帽、手套、羽绒服、皮袄;
            {%- endif %}        

  • 停雨提醒
  - alias: 'weather_report_stop'
    trigger:
      platform: numeric_state
      entity_id: sensor.caiyun_minutely_probability_0
      below: 60
      value_template: '{{ state.state }}'
    condition:
      condition: time
      after: '06:00:00'
      before: '00:00:00' 
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: >
            请各位邻居留意这个天气预报(仅覆盖泮浦湾方圆三公里,以下消息仅供参考):
            {{states.sensor.caiyun_minutely_description.state}}。

  • 最近下雨带提醒
  - alias: 'weather_report_distance'
    trigger:
      - platform: numeric_state
        entity_id: sensor.caiyun_precipitation_nearest_precipitation_distance
        below: 3
        value_template: '{{ state.state }}'
      - platform: numeric_state
        entity_id: sensor.caiyun_precipitation_nearest_precipitation_distance
        below: 10
        value_template: '{{ state.state }}'
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: >
            请各位邻居留意这个天气预报(仅覆盖泮浦湾方圆三公里,以下消息仅供参考):
            附近正在下雨,现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。

  • 定时推送天气预报
  - alias: 'weather_report_time_01'
    initial_state: true
    trigger:
      - platform: time
        at: '07:08:00'
      - platform: time
        at: '12:08:00'
      - platform: time
        at: '17:08:00'
      - platform: time
        at: '20:08:00'
      - platform: time
        at: '22:08:00'
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: >
            各位邻居好,小萝卜为大家播报天气(仅覆盖泮浦湾方圆三公里,以下消息仅供参考):
            当前泮浦湾大致{{states('sensor.caiyun_realtime_skycon')}}; 
            当前室外空气质量指数为{{states('sensor.caiyun_realtime_aqi')}},
            {%- if states.sensor.caiyun_realtime_pm25.state | float >= 115 and states.sensor.caiyun_realtime_pm25.state | float < 1000 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,中度甚至重度污染。可能对健康人群心脏、呼吸系统有影响,建议疾病患者避免长时间、高强度的户外锻练,一般人群适量减少户外运动;
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 75 and states.sensor.caiyun_realtime_pm25.state | float < 115 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,轻度污染。建议儿童、老年人及心脏病、呼吸系统疾病患者应减少长时间、高强度的户外锻炼。;            
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 35 and states.sensor.caiyun_realtime_pm25.state | float < 75 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,空气属于良。某些污染物可能对极少数异常敏感人群健康有较弱影响,建议极少数异常敏感人群应减少户外活动;
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 10 and states.sensor.caiyun_realtime_pm25.state | float < 35 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,空气状况属于优。质量令人满意,基本无空气污染,各类人群可正常活动;
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 0 and states.sensor.caiyun_realtime_pm25.state | float < 10 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,此时空气简直好的让人不敢相信呀;            
            {%- endif %}
            {%- if states.sensor.caiyun_realtime_humidity.state | float >= 70 and states.sensor.caiyun_realtime_humidity.state | float < 100 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,准备多几套内衣裤吧;
            {%- elif states.sensor.caiyun_realtime_humidity.state | float >= 40 and states.sensor.caiyun_realtime_humidity.state | float < 70 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,现在很舒适;
            {%- elif states.sensor.caiyun_realtime_humidity.state | float >= 10 and states.sensor.caiyun_realtime_humidity.state | float < 40 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,非常干燥,大家记得多喝水;
            {%- elif states.sensor.caiyun_realtime_humidity.state | float >= 0 and states.sensor.caiyun_realtime_humidity.state | float < 10 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,大家记得多喝水;                        
            {%- endif %} 
            {%- if states.sensor.caiyun_realtime_temperature.state | float >= 28 and states.sensor.caiyun_realtime_temperature.state | float < 35 -%}
            目前温度是{{states('sensor.caiyun_realtime_temperature')}}°C,非常炎热,穿衣建议:盛夏着装,轻棉织物制作的短衣、短裤、薄短裙、短裙;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 24 and states.sensor.caiyun_realtime_temperature.state | float < 28 -%}
            目前温度是{{states('sensor.caiyun_realtime_temperature')}}°C,热舒适,穿衣建议:夏季着装,棉麻面料的衬衫、长裤、薄长裙、薄T恤;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 20 and states.sensor.caiyun_realtime_temperature.state | float < 24 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,有点凉快,穿衣建议:春秋过渡装,单层棉麻面料的短套装、T恤衫、薄牛仔衫裤、休闲服、职业套装;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 15 and states.sensor.caiyun_realtime_temperature.state | float < 20 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,天气已经比较冷了,穿衣建议:秋冬过度装,风衣、大衣、夹大衣、外套、毛衣、毛套装、西装、防寒服;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 10 and states.sensor.caiyun_realtime_temperature.state | float < 15 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,天气已经非常冷了,穿衣建议:秋冬着装,毛衣、风衣、毛套装、西服套装;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 0 and states.sensor.caiyun_realtime_temperature.state | float < 10 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,天气冷到没人性,穿衣建议:冬季着装,棉衣、冬大衣、皮夹克、厚呢外套、呢帽、手套、羽绒服、皮袄;
            {%- endif %}  
            风向为{{states('sensor.caiyun_precipitation_wind_direction')}},
            当前风速为{{states('sensor.caiyun_precipitation_wind_speed')}}KM/H;            
            紫外强度:{{states('sensor.caiyun_daily_ultraviolet')}};
            感冒概率:{{states('sensor.caiyun_daily_coldrisk')}};     
            当前洗车建议{{states('sensor.caiyun_daily_carwashing')}}。
            {%- if states.sensor.caiyun_hourly_precipitation8h.state | float >= 0 and states.sensor.caiyun_hourly_precipitation8h.state | float < 0.05 -%}
            请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- elif states.sensor.caiyun_hourly_precipitation8h.state | float > 0.05 and states.sensor.caiyun_hourly_precipitation8h.state | float < 0.9 -%}
            不过得注意了,接下来8小时内可能会下小雨。请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- elif states.sensor.caiyun_hourly_precipitation8h.state | float > 0.9 and states.sensor.caiyun_hourly_precipitation8h.state | float < 2.87 -%}
            不过得注意了,8小时内可能会下中雨。请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- elif states.sensor.caiyun_hourly_precipitation8h.state | float > 2.87 -%}
            不过得注意了,8小时内可能会下好大的雨呀。请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- endif %} 

  • 手动推送天气预报
  - alias: 'input_boolean_wechat_to_panpuwan02'
    initial_state: true
    trigger:
      platform: state
      entity_id: input_boolean.wechat_to_panpuwan02
      to: 'on'
    action:  
      - service: script.wechat_to_panpuwan
        data_template:
          msg: >
            各位邻居好,小萝卜为大家播报天气(仅覆盖泮浦湾方圆三公里,以下消息仅供参考):
            当前泮浦湾大致{{states('sensor.caiyun_realtime_skycon')}}; 
            当前室外空气质量指数为{{states('sensor.caiyun_realtime_aqi')}},
            {%- if states.sensor.caiyun_realtime_pm25.state | float >= 115 and states.sensor.caiyun_realtime_pm25.state | float < 1000 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,中度甚至重度污染。可能对健康人群心脏、呼吸系统有影响,建议疾病患者避免长时间、高强度的户外锻练,一般人群适量减少户外运动;
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 75 and states.sensor.caiyun_realtime_pm25.state | float < 115 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,轻度污染。建议儿童、老年人及心脏病、呼吸系统疾病患者应减少长时间、高强度的户外锻炼。;            
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 35 and states.sensor.caiyun_realtime_pm25.state | float < 75 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,空气属于良。某些污染物可能对极少数异常敏感人群健康有较弱影响,建议极少数异常敏感人群应减少户外活动;
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 10 and states.sensor.caiyun_realtime_pm25.state | float < 35 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,空气状况属于优。质量令人满意,基本无空气污染,各类人群可正常活动;
            {%- elif states.sensor.caiyun_realtime_pm25.state | float >= 0 and states.sensor.caiyun_realtime_pm25.state | float < 10 -%}
            PM2.5为{{states('sensor.caiyun_realtime_pm25')}}ug/m3,此时空气简直好的让人不敢相信呀;            
            {%- endif %}
            {%- if states.sensor.caiyun_realtime_humidity.state | float >= 70 and states.sensor.caiyun_realtime_humidity.state | float < 100 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,准备多几套内衣裤吧;
            {%- elif states.sensor.caiyun_realtime_humidity.state | float >= 40 and states.sensor.caiyun_realtime_humidity.state | float < 70 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,现在很舒适;
            {%- elif states.sensor.caiyun_realtime_humidity.state | float >= 10 and states.sensor.caiyun_realtime_humidity.state | float < 40 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,非常干燥,大家记得多喝水;
            {%- elif states.sensor.caiyun_realtime_humidity.state | float >= 0 and states.sensor.caiyun_realtime_humidity.state | float < 10 -%}
            湿度为{{states('sensor.caiyun_realtime_humidity')}}%,大家记得多喝水;                        
            {%- endif %} 
            {%- if states.sensor.caiyun_realtime_temperature.state | float >= 28 and states.sensor.caiyun_realtime_temperature.state | float < 35 -%}
            目前温度是{{states('sensor.caiyun_realtime_temperature')}}°C,非常炎热,穿衣建议:盛夏着装,轻棉织物制作的短衣、短裤、薄短裙、短裙;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 24 and states.sensor.caiyun_realtime_temperature.state | float < 28 -%}
            目前温度是{{states('sensor.caiyun_realtime_temperature')}}°C,热舒适,穿衣建议:夏季着装,棉麻面料的衬衫、长裤、薄长裙、薄T恤;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 20 and states.sensor.caiyun_realtime_temperature.state | float < 24 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,有点凉快,穿衣建议:春秋过渡装,单层棉麻面料的短套装、T恤衫、薄牛仔衫裤、休闲服、职业套装;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 15 and states.sensor.caiyun_realtime_temperature.state | float < 20 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,天气已经比较冷了,穿衣建议:秋冬过度装,风衣、大衣、夹大衣、外套、毛衣、毛套装、西装、防寒服;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 10 and states.sensor.caiyun_realtime_temperature.state | float < 15 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,天气已经非常冷了,穿衣建议:秋冬着装,毛衣、风衣、毛套装、西服套装;
            {%- elif states.sensor.caiyun_realtime_temperature.state | float >= 0 and states.sensor.caiyun_realtime_temperature.state | float < 10 -%}
            目前温度只有{{states('sensor.caiyun_realtime_temperature')}}°C,天气冷到没人性,穿衣建议:冬季着装,棉衣、冬大衣、皮夹克、厚呢外套、呢帽、手套、羽绒服、皮袄;
            {%- endif %}  
            风向为{{states('sensor.caiyun_precipitation_wind_direction')}},
            当前风速为{{states('sensor.caiyun_precipitation_wind_speed')}}KM/H;            
            紫外强度:{{states('sensor.caiyun_daily_ultraviolet')}};
            感冒概率:{{states('sensor.caiyun_daily_coldrisk')}};     
            当前洗车建议{{states('sensor.caiyun_daily_carwashing')}}。
            {%- if states.sensor.caiyun_hourly_precipitation8h.state | float >= 0 and states.sensor.caiyun_hourly_precipitation8h.state | float < 0.05 -%}
            请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- elif states.sensor.caiyun_hourly_precipitation8h.state | float > 0.05 and states.sensor.caiyun_hourly_precipitation8h.state | float < 0.9 -%}
            不过得注意了,接下来8小时内可能会下小雨。请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- elif states.sensor.caiyun_hourly_precipitation8h.state | float > 0.9 and states.sensor.caiyun_hourly_precipitation8h.state | float < 2.87 -%}
            不过得注意了,8小时内可能会下中雨。请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- elif states.sensor.caiyun_hourly_precipitation8h.state | float > 2.87 -%}
            不过得注意了,8小时内可能会下好大的雨呀。请留意这个即时天气预报:{{states('sensor.caiyun_minutely_description')}},现在最近的降雨带离我们这{{states('sensor.caiyun_precipitation_nearest_precipitation_distance')}}公里。
            {%- endif %} 
      - delay:
          seconds: 0.5
      - service: input_boolean.turn_off
        entity_id: input_boolean.wechat_to_panpuwan02

  • 手动推送天气预报按键和汉化
input_boolean:
  wechat_to_panpuwan02:
    initial: off
homeassistant:
  customize:
    input_boolean.wechat_to_panpuwan02:
      friendly_name: 发送天气测试
      homebridge_hidden: true


以上代码仅供参考。我自己写好的package,如果你装好了彩云天气插件+微信插件,只要下载附件,丢进package文件夹,根据自己的情况修改一下,重启hass就可以了。



scene_test_weather_report_to_panpuwan.zip

2.87 KB, 阅读权限: 10, 下载次数: 82

评分

参与人数 3金钱 +39 收起 理由
令狐鸣 + 1 膜拜大神!
Roger + 20 专门注册账号来顶你!
+ 18 我来瀚思就为看你!

查看全部评分

尝试过萝卜,我想你一定会忘记青瓜
回复

使用道具 举报

123

主题

4661

帖子

1万

积分

管理员

囧死

Rank: 9Rank: 9Rank: 9

积分
16412
金钱
11666
HASS币
45
发表于 2018-1-7 22:41:42 | 显示全部楼层
学以致用才是最高境界!向萝卜哥致敬!
回复

使用道具 举报

62

主题

603

帖子

6388

积分

论坛元老

Rank: 8Rank: 8

积分
6388
金钱
5710
HASS币
240

教程狂人论坛风云人物

 楼主| 发表于 2018-1-7 22:44:01 | 显示全部楼层
Jones 发表于 2018-1-7 22:41
学以致用才是最高境界!向萝卜哥致敬!

我们都要谢谢囧帅给我们提供这么好玩和交流的平台
尝试过萝卜,我想你一定会忘记青瓜
回复

使用道具 举报

0

主题

61

帖子

1399

积分

金牌会员

Rank: 6Rank: 6

积分
1399
金钱
1338
HASS币
0
发表于 2018-1-7 22:44:49 | 显示全部楼层
謝謝分享
回复

使用道具 举报

123

主题

4661

帖子

1万

积分

管理员

囧死

Rank: 9Rank: 9Rank: 9

积分
16412
金钱
11666
HASS币
45
发表于 2018-1-7 22:55:57 | 显示全部楼层
antsunzj 发表于 2018-1-7 22:44
我们都要谢谢囧帅给我们提供这么好玩和交流的平台

大家玩起来才是真的好!

话说,现在微信通知稳定吗?不会封号了?
回复

使用道具 举报

62

主题

603

帖子

6388

积分

论坛元老

Rank: 8Rank: 8

积分
6388
金钱
5710
HASS币
240

教程狂人论坛风云人物

 楼主| 发表于 2018-1-7 23:02:00 | 显示全部楼层
Jones 发表于 2018-1-7 22:55
大家玩起来才是真的好!

话说,现在微信通知稳定吗?不会封号了?

不要经常去上线下线 一般没有问题。我连续用了几个月了。不过是用了前两年注册的小号。
尝试过萝卜,我想你一定会忘记青瓜
回复

使用道具 举报

16

主题

277

帖子

4004

积分

论坛元老

Rank: 8Rank: 8

积分
4004
金钱
3722
HASS币
0
发表于 2018-1-7 23:06:40 | 显示全部楼层
学习,看看,感谢版主
回复

使用道具 举报

6

主题

386

帖子

2045

积分

金牌会员

Rank: 6Rank: 6

积分
2045
金钱
1657
HASS币
0
发表于 2018-1-8 03:16:49 | 显示全部楼层
玩的这么666666
回复

使用道具 举报

40

主题

3056

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11149
金钱
8042
HASS币
182
发表于 2018-1-8 08:33:15 | 显示全部楼层
做你邻居真好啊。
Nero
回复

使用道具 举报

0

主题

71

帖子

438

积分

中级会员

Rank: 3Rank: 3

积分
438
金钱
367
HASS币
0
发表于 2018-1-8 09:42:53 | 显示全部楼层
学习一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-27 15:38 , Processed in 0.070089 second(s), 36 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表