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

 找回密码
 立即注册
楼主: cheny95

和风天气 Home Assistant 插件

[复制链接]

3

主题

136

帖子

1478

积分

金牌会员

Rank: 6Rank: 6

积分
1478
金钱
1342
HASS币
0
发表于 2022-6-24 16:08:07 | 显示全部楼层
cheny95 发表于 2022-6-23 16:58
最新版请查看下github,需要开发者的key了。因为增加了格点天气之类的接口。 ...

发者的key了。? 没懂 文档中也没写呀
回复

使用道具 举报

7

主题

162

帖子

1244

积分

论坛技术达人

积分
1244
金钱
1077
HASS币
60
发表于 2022-7-4 17:25:24 | 显示全部楼层
本帖最后由 arthurfsy 于 2022-7-6 15:39 编辑

难怪不成功,原来是要验证个人开发。今天申请通过了,就可以正常使用了
回复

使用道具 举报

7

主题

162

帖子

1244

积分

论坛技术达人

积分
1244
金钱
1077
HASS币
60
发表于 2022-7-6 10:37:40 | 显示全部楼层
请问LZ用什么卡片展示比较好?
回复

使用道具 举报

5

主题

48

帖子

632

积分

论坛DIY达人

积分
632
金钱
579
HASS币
20
 楼主| 发表于 2022-7-7 12:47:08 | 显示全部楼层
arthurfsy 发表于 2022-7-6 10:37
请问LZ用什么卡片展示比较好?

我没用用卡片,我需求不大,只是开发给群友用的。一般就直接mushroom显示个温度和天气。
回复

使用道具 举报

2

主题

90

帖子

890

积分

高级会员

Rank: 4

积分
890
金钱
800
HASS币
0
发表于 2022-7-11 21:26:15 | 显示全部楼层
基于楼主插件的脚本范例分享

最高气温与最低气温,写入辅助元素,用于第二天判断升降温
alias: 0.定时 - 记录 - 今日气温 PM 23:59
description: ''
trigger:
  - platform: time
    at: '23:59:00'
condition: []
action:
  - service: input_text.set_value
    data:
      value: >-
        {{
        states.weather.hefeng.attributes["forecast"][0]["templow"]|float|round(1)
        }}
    target:
      entity_id: input_text.zuo_ri_zui_di_qi_wen
  - service: input_text.set_value
    data:
      value: >-
        {{
        states.weather.hefeng.attributes["forecast"][0]["temperature"]|float|round(1)
        }}
    target:
      entity_id: input_text.zuo_ri_zui_gao_qi_wen
mode: single
升降温判断(需配合第一条自动化)
alias: 5.判断 - 温差变化
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{  states("input_text.zuo_ri_zui_gao_qi_wen") |float -
              states.weather.hefeng.attributes["forecast"][0]["temperature"]> 5
              }}
        sequence:
          - service: script.2_2
            data: {}
      - conditions:
          - condition: template
            value_template: >-
              {{ ( states.weather.hefeng.attributes["forecast"][0]["templow"]
              |float - states("input_text.zuo_ri_zui_di_qi_wen") |float  )|
              round(1) >5 }}
        sequence:
          - service: script.2_4
            data: {}
    default: []
mode: single

雨雾天气或预警信号判断
alias: 5.判断 - 雨雾天气
sequence:
  - choose:
      - conditions:
          - condition: not
            conditions:
              - condition: template
                value_template: >-
                  {{
                  states.weather.hefeng.attributes["weather_warning"][0]["text"]
                  in ("当前无灾害预警")}}
        sequence:
          - service: script.2_5
            data: {}
      - conditions:
          - condition: template
            value_template: >-
              {{ states.weather.hefeng.attributes["forecast"][0]["condition_cn"]
              in
              ("大风","强风","疾风","烈风","飓风","龙卷风","热带风暴","狂暴风","风暴","雨","毛毛雨","小雨","中雨","大雨","阵雨","强阵雨","雷阵雨","极端降雨","强雷阵雨","雷阵雨伴有冰雹","小雨","中雨","大雨","暴雨","大暴雨","特大暴雨","冻雨","雪","小雪","中雪","大雪","暴雪","雨夹雪","雨雪天气","阵雨夹雪","阵雪","雾","薄雾")}}
        sequence:
          - service: script.1649344230289
            data: {}
    default: []
mode: single


评分

参与人数 1金钱 +5 收起 理由
cheny95 + 5 高手,这是高手!

查看全部评分

回复

使用道具 举报

14

主题

77

帖子

409

积分

中级会员

Rank: 3Rank: 3

积分
409
金钱
332
HASS币
0
发表于 2022-7-12 11:44:28 | 显示全部楼层
真是好东西,支持一下
回复

使用道具 举报

2

主题

90

帖子

890

积分

高级会员

Rank: 4

积分
890
金钱
800
HASS币
0
发表于 2022-7-14 21:22:30 | 显示全部楼层
本帖最后由 tty228 于 2022-7-14 21:44 编辑

2022.7.4 之后报错了
不过我顺手还原了,忘了复制报错信息
------------
还原到 2022.7.3 之后还是打不开,有点奇怪

Logger: homeassistant.components.weather
Source: custom_components/qweather/weather.py:81
Integration: Weather (documentation, issues)
First occurred: 21:42:22 (1 occurrences)
Last logged: 21:42:22

qweather: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 446, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 702, in async_device_update
    await task
  File "/config/custom_components/qweather/weather.py", line 81, in async_update
    self._current = json_data["now"]
KeyError: 'now'


Logger: homeassistant.components.weather
Source: components/weather/__init__.py:308
Integration: Weather (documentation, issues)
First occurred: 21:42:18 (1 occurrences)
Last logged: 21:42:18

custom_components.qweather.weather::QWeather is overriding deprecated methods on an instance of WeatherEntity, this is not valid and will be unsupported from Home Assistant 2023.1. Please report it to the custom component author.

回复

使用道具 举报

5

主题

48

帖子

632

积分

论坛DIY达人

积分
632
金钱
579
HASS币
20
 楼主| 发表于 2022-7-15 13:06:12 | 显示全部楼层
tty228 发表于 2022-7-14 21:22
2022.7.4 之后报错了
不过我顺手还原了,忘了复制报错信息
------------

这个好像是因为版本升级有些覆盖weather实体的方法不能用了吧,抽空我去看看新的文档。。。主要是我也不太会python
回复

使用道具 举报

5

主题

48

帖子

632

积分

论坛DIY达人

积分
632
金钱
579
HASS币
20
 楼主| 发表于 2022-7-28 18:21:20 | 显示全部楼层
0.06版本发布,修复了新版本报错的问题
回复

使用道具 举报

2

主题

90

帖子

890

积分

高级会员

Rank: 4

积分
890
金钱
800
HASS币
0
发表于 2022-8-10 15:50:41 | 显示全部楼层
当天的预报信息没有 text 信息,不好做音箱的 TTS 通知,楼主有空可以改一下吗
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-27 08:04 , Processed in 0.079263 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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