Skip to content

xyzmos/hass_push_nextrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hass_push_nextrt

Home Assistant 自定义集成:将 NEXT Push 接入为 notify 实体,使用 notify.send_message 服务发送消息。

特性

  • 基于 Home Assistant 新版 notify entity 模型
  • 支持 notify.send_message
  • 支持配置默认 channelrender_mode
  • 支持在服务调用 data 中覆盖:channeltokenurlrender_modecontent
  • 配置流内置连接测试

目录结构

  • custom_components/hass_push_nextrt/
    • manifest.json
    • config_flow.py
    • notify.py
    • api.py

安装

通过 HACS 自定义仓库

  1. 打开 HACS
  2. 进入 右上角菜单 -> 自定义仓库
  3. 添加本仓库 URL,分类选择 Integration
  4. 搜索并安装 hass_push_nextrt
  5. 重启 Home Assistant

手动安装

  1. custom_components/hass_push_nextrt 目录复制到 Home Assistant 配置目录下的 custom_components
  2. 重启 Home Assistant

配置

  1. 进入 设置 -> 设备与服务 -> 添加集成
  2. 搜索 消息推送
  3. 填写:
    • name 实体名称
    • username NextRT Push 用户名
    • token NextRT Push Token
    • channel 默认通道 可选
    • render_mode 默认渲染模式 可选,推荐 markdown

使用方式

本集成仅支持新版实体通知服务,不再兼容旧式 notify.<service> 调用。

示例 1 纯文本

action:
  - service: notify.send_message
    target:
      entity_id: notify.消息推送
    data:
      message: 设备在线

示例 2 带标题

action:
  - service: notify.send_message
    target:
      entity_id: notify.消息推送
    data:
      title: Home Assistant 告警
      message: 门磁已触发

示例 3 覆盖通道和渲染模式

action:
  - service: notify.send_message
    target:
      entity_id: notify.消息推送
    data:
      title: 每日摘要
      message: 今日能耗 5.2kWh
      data:
        channel: email
        render_mode: raw

示例 4 发送 Markdown 内容

action:
  - service: notify.send_message
    target:
      entity_id: notify.消息推送
    data:
      message: 占位描述
      data:
        content: |
          ## 系统状态
          - CPU 45%
          - 内存 61%
        channel: corp
        render_mode: markdown

参数说明

notify.send_message 顶层字段:

  • message 必填
  • title 可选

data 扩展字段:

  • channel 可选
  • token 可选,不建议常用
  • url 可选
  • render_mode 可选,markdownrawcode
  • content 可选,建议与 description 语义二选一

故障排查

  • 配置保存失败:检查 usernametoken
  • 发送失败:检查通道名是否为你平台内已配置的通道名称
  • 自动化调用失败:确认服务使用 notify.send_message 且包含 target.entity_id

About

Home Assistant 消息推送工具

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages