Push Notification Guide

消息推送使用指南

Use SmartHouse push notifications to trigger app actions, request immediate reports, adjust selected client settings, and build interactive automations from Home Assistant.

通过 SmartHouse 消息推送,你可以触发应用动作、立即请求上报、调整部分客户端配置,并从 Home Assistant 构建可交互自动化。

1. Enable push in the app first

1. 先在应用中开启推送

To execute app actions or change app configuration through notifications, enable push in App Settings -> Push Notification Beta first.

如果你希望通过通知执行应用动作或修改应用配置,需要先在 APP 设置 -> 消息推送 beta 中开启推送。

2. Common message commands

2. 常用消息命令

Immediately report currently enabled sensors:

立即上报当前已开启的传感器状态:

action: notify.mobile_app_XXX
data:
  message: command_update_sensors

Request an immediate location update, even if the location switch is currently off:

立即请求一次当前位置上报,即使定位开关当前未开启:

action: notify.mobile_app_XXX
data:
  message: request_location_update

3. Change app configuration from Home Assistant

3. 从 Home Assistant 修改应用配置

The current configuration payload supports options such as enableLocation, locationAccuracyHigh, enableKeepLocation, walk, wifiSensor, ble, and batterySensor.

当前支持的配置项包括 enableLocationlocationAccuracyHighenableKeepLocationwalkwifiSensorblebatterySensor 等。

action: notify.mobile_app_XXX
metadata: {}
data:
  message: smart_house_config
  title: Modify SmartHouse Config
  data:
    config:
      enableLocation: true
      enableKeepLocation: false
      walk: false
      ble: false
The notification title is optional. If you omit it, the config can still be applied silently.
通知标题是可选的。不设置标题时,也可以静默修改配置。

4. Send text or image notifications

4. 发送文本或图片通知

Text push:

文本通知:

action: notify.mobile_app_XXX
data:
  message: "All devices have been turned off"
  title: "Nobody is home"

Image push is currently Android only:

图片通知目前仅支持 Android:

action: notify.mobile_app_XXX
data:
  message: "Show image"
  title: "Test push"
  data:
    push_img: https://example.com/example.png

5. Open pages, entities, services, or media with notification actions

5. 通过通知动作打开页面、实体、服务或媒体

SmartHouse supports URI actions such as entityId:<entity_id>, callService:domain/service/service_data/json/target/json, media-source://..., and generic URIs such as web pages or deep links.

SmartHouse 支持多种 URI 动作,例如 entityId:<实体ID>callService:domain/service/service_data/json/target/jsonmedia-source://...,以及网页或应用深链等通用 URI。

action: notify.mobile_app_XXX
data:
  message: "Open entity page"
  title: "Test push"
  data:
    actions:
      - action: URI
        uri: entityId:light.yeelight_ceil26_0x158027b8
        title: Open entity

For SmartHouse-specific service execution, keep the slash separators even when one segment is empty.

使用 SmartHouse 特有的服务调用 URI 时,即使某一段为空,也要保留斜杠分隔。

actions:
  - alias: Send push
    data:
      message: Should the heater be turned on?
      data:
        actions:
          - action: URI
            uri: 'callService:switch/turn_on//{"entity_id": "switch.living_room_heater"}'
            title: Turn on
      title: test
    action: notify.mobile_app_XXX

6. Action buttons and automations

6. 按钮动作与自动化

Android supports actionable notification buttons. One route is the official mobile_app_notification_action event workflow. Another route is SmartHouse's URI-based shortcut buttons, which can directly call services or open media.

Android 支持带按钮的通知。一种做法是使用官方的 mobile_app_notification_action 事件流;另一种做法是直接使用 SmartHouse 的 URI 按钮,触发服务调用或打开媒体内容。

On iOS, only one action per push is supported in the original note, and compatibility was not fully verified.
原始说明中提到 iOS 每条推送仅支持一个 action,且未做完整兼容验证。

7. Advanced camera and doorbell workflow

7. 摄像头与门铃高级示例

This guide keeps the most commonly used camera and doorbell notification patterns, including image push, saved video playback, and service-triggered actions.

这里保留了摄像头和门铃通知里最常用的模式,包括图片推送、已保存视频回放,以及服务调用类动作。