Internet Watchdog — MQTT & Home Assistant Reference

PF-WATCHDOG-001 MQTT topics, state payloads, commands, and Home Assistant auto-discovery entities.
Broker: any MQTT 3.1.1 broker on the LAN. No TLS. No authentication required (configurable).

For platform base MQTT topics (availability, relay, telemetry, power), see the Platform MQTT/HA Reference.

VersionDateNotes
1.02026-02-11Initial release


Overview

The Internet Watchdog adds 2 publish topics and 3 command topics on top of the platform's base MQTT surface. It also registers 8 Home Assistant discovery entities for automatic dashboard integration.

Topic prefix

All topics use the device's configured MQTT base topic:

{mqtt_topic}/watchdog/...

Where {mqtt_topic} is set during provisioning (default: pumpfuse/<device_id>).

Topics at a Glance

TopicDirectionRetainedPurpose
{mqtt_topic}/watchdog/stateDevice → BrokerYesState payload (14 fields)
{mqtt_topic}/watchdog/eventDevice → BrokerNoEvent notifications
{mqtt_topic}/watchdog/enabled/setBroker → DeviceEnable/disable monitoring
{mqtt_topic}/watchdog/reboot/setBroker → DeviceTrigger manual reboot
{mqtt_topic}/watchdog/stats/reset/setBroker → DeviceReset cumulative statistics

State Payload

Topic: {mqtt_topic}/watchdog/state
Retained: Yes
QoS: 0
Cadence: On every state change and every 60 seconds (heartbeat)

Payload

{
  "state": "monitoring",
  "internet_up": true,
  "enabled": true,
  "relay": true,
  "reboot_count": 0,
  "total_reboots": 5,
  "total_outages": 3,
  "consecutive_fails": 0,
  "scheduled_reboot": "04:00",
  "uptime_percent": 99.7,
  "last_check": "2026-02-11T10:30:00Z",
  "last_outage": "2026-02-10T03:15:22Z",
  "last_reboot": "2026-02-10T03:17:52Z"
}

Fields

FieldTypeDescription
statestringState machine state: "monitoring", "grace_period", "rebooting", "post_reboot_grace", "cooldown", "max_retries_exceeded", "disabled"
internet_upbooleanWhether the last ping round succeeded
enabledbooleanMaster enable/disable switch
relaybooleanRelay state: true = closed (power on)
reboot_countintegerReboots in current failure cycle (resets when internet restored)
total_rebootsintegerCumulative lifetime reboots
total_outagesintegerCumulative lifetime outages
consecutive_failsintegerCurrent streak of failed ping rounds
scheduled_rebootstring | null"HH:MM" if daily reboot configured, otherwise null
uptime_percentfloat100 × (1 − downtime / monitoring_time)
last_checkstring | nullISO 8601 UTC of most recent ping check
last_outagestring | nullISO 8601 UTC of most recent outage
last_rebootstring | nullISO 8601 UTC of most recent router reboot

When state is published


Event Payload

Topic: {mqtt_topic}/watchdog/event
Retained: No
QoS: 0

Published at the moment an event occurs. Fire-and-forget.

Payload

{
  "event": "outage_detected",
  "reboot_count": 0
}

Fields

FieldTypeDescription
eventstringEvent type (see table below)
reboot_countintegerReboots at the time of this event

Event types

EventWhen published
device_onlineDevice booted and started monitoring
outage_detectedAll ping targets failed for fail_threshold consecutive rounds
reboot_startedRouter power-cycle initiated (relay opened)
internet_restoredConnectivity recovered after an outage
max_retries_exceededAll retry attempts exhausted
scheduled_rebootDaily scheduled reboot triggered
manual_rebootUser-initiated reboot (any interface)
enabledMonitoring was enabled
disabledMonitoring was disabled

Commands

Enable / Disable Monitoring

Topic: {mqtt_topic}/watchdog/enabled/set
Payload: ON or OFF (case-insensitive)

PayloadEffect
ONEnters monitoring state, resets consecutive_fails and reboot_count, pushes enabled event
OFFEnters disabled state, turns relay on (ensures router stays powered), pushes disabled event

Publishes updated state immediately after.

Trigger Router Reboot

Topic: {mqtt_topic}/watchdog/reboot/set
Payload: PRESS

Triggers a manual router power-cycle. Ignored if device is already in rebooting or post_reboot_grace state.

Publishes manual_reboot event and updated state.

Reset Statistics

Topic: {mqtt_topic}/watchdog/stats/reset/set
Payload: PRESS

Resets all cumulative statistics to zero (total_reboots, total_outages, uptime counters, timestamps). Persists to NVS.

Publishes updated state immediately after.


Home Assistant Auto-Discovery

The device publishes HA discovery configs on MQTT connect. Discovery topics follow the standard pattern:

homeassistant/<component>/<unique_id>/config

All entities include:

Entities

1. Internet Status (Binary Sensor)

PropertyValue
Componentbinary_sensor
IDinternet_up
NameInternet
Iconmdi:web
Device classconnectivity
State topic{mqtt_topic}/watchdog/state
Value template{{ 'ON' if value_json.internet_up else 'OFF' }}

Shows as Connected / Disconnected in HA.

2. Watchdog State (Sensor)

PropertyValue
Componentsensor
IDwatchdog_state
NameWatchdog State
Iconmdi:shield-check
State topic{mqtt_topic}/watchdog/state
Value template{{ value_json.state }}

Displays the current state machine state as text.

3. Total Reboots (Sensor)

PropertyValue
Componentsensor
IDtotal_reboots
NameTotal Reboots
Iconmdi:restart
State topic{mqtt_topic}/watchdog/state
Value template{{ value_json.total_reboots }}

4. Uptime Percentage (Sensor)

PropertyValue
Componentsensor
IDuptime_percent
NameUptime
Iconmdi:percent
Unit%
State topic{mqtt_topic}/watchdog/state
Value template{{ value_json.uptime_percent | default(100) | round(1) }}

5. Scheduled Reboot (Sensor)

PropertyValue
Componentsensor
IDscheduled_reboot
NameScheduled Reboot
Iconmdi:clock-outline
State topic{mqtt_topic}/watchdog/state
Value template{{ value_json.scheduled_reboot | default('Disabled', true) }}

Displays "04:00" or "Disabled".

6. Monitoring Switch

PropertyValue
Componentswitch
IDwatchdog_enabled
NameMonitoring
Iconmdi:eye
State topic{mqtt_topic}/watchdog/state
Command topic{mqtt_topic}/watchdog/enabled/set
Value template{{ 'ON' if value_json.enabled else 'OFF' }}
Payload on/offON / OFF

Toggle switch in HA to enable/disable monitoring.

7. Reboot Router Button

PropertyValue
Componentbutton
IDtrigger_reboot
NameReboot Router
Iconmdi:restart-alert
Command topic{mqtt_topic}/watchdog/reboot/set
Payload pressPRESS

One-tap button in HA to trigger a manual router reboot.

8. Reset Statistics Button

PropertyValue
Componentbutton
IDreset_stats
NameReset Statistics
Iconmdi:chart-line-stacked
Command topic{mqtt_topic}/watchdog/stats/reset/set
Payload pressPRESS

One-tap button in HA to zero all cumulative stats.


Example Home Assistant Automations

Push Notifications for All Events

This single automation covers all 9 watchdog event types. Each event sends a descriptive push notification to your phone via the Home Assistant Companion App.

Prerequisites:

alias: PumpFuse Internet Watchdog Alerts
triggers:
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: internet_restored
    id: restored
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: max_retries_exceeded
    id: max_retries
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: outage_detected
    id: outage
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: manual_reboot
    id: manual
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: scheduled_reboot
    id: scheduled
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: reboot_started
    id: reboot_started
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: enabled
    id: enabled
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: disabled
    id: disabled
  - trigger: mqtt
    topic: pumpfuse/+/watchdog/event
    value_template: "{{ value_json.event }}"
    payload: device_online
    id: device_online
conditions: []
actions:
  - action: notify.mobile_app_your_phone
    data:
      title: Internet Watchdog
      message: >-
        {% if trigger.id == 'restored' %}
          Internet restored after {{ trigger.payload_json.reboot_count }} reboot(s)
        {% elif trigger.id == 'max_retries' %}
          Internet still down after {{ trigger.payload_json.reboot_count }} reboots — needs attention
        {% elif trigger.id == 'outage' %}
          Internet outage detected — monitoring
        {% elif trigger.id == 'manual' %}
          Manual reboot triggered — router restarting
        {% elif trigger.id == 'scheduled' %}
          Scheduled reboot — router restarting
        {% elif trigger.id == 'reboot_started' %}
          Router power cycled (reboot #{{ trigger.payload_json.reboot_count }})
        {% elif trigger.id == 'enabled' %}
          Watchdog monitoring enabled
        {% elif trigger.id == 'disabled' %}
          Watchdog monitoring disabled
        {% elif trigger.id == 'device_online' %}
          PumpFuse device came online
        {% endif %}
mode: parallel
max: 5

Notes:

Dashboard Card (Lovelace)

type: entities
title: Internet Watchdog
entities:
  - entity: binary_sensor.<device>_internet_up
    name: Internet Status
  - entity: sensor.<device>_watchdog_state
    name: State
  - entity: sensor.<device>_uptime_percent
    name: Uptime
  - entity: sensor.<device>_total_reboots
    name: Lifetime Reboots
  - entity: sensor.<device>_scheduled_reboot
    name: Scheduled Reboot
  - entity: switch.<device>_watchdog_enabled
    name: Monitoring
  - entity: button.<device>_trigger_reboot
    name: Reboot Router
  - entity: button.<device>_reset_stats
    name: Reset Stats

Replace <device> with the device's object ID prefix (derived from device name).


Common Notes

Platform base topics

The platform publishes additional MQTT topics that are always available regardless of product:

TopicPurpose
{mqtt_topic}/availabilityonline / offline (LWT)
{mqtt_topic}/statusPlatform status JSON (retained, 60s heartbeat)
{mqtt_topic}/relay/stateRelay ON/OFF
{mqtt_topic}/relay/setRelay command
{mqtt_topic}/telemetry/stateTelemetry config
{mqtt_topic}/powerPower readings stream

Stale retained messages

After OTA firmware update, the previous watchdog/state retained message persists until the device publishes a new one (within 60 seconds of boot, or immediately on first state change).

MQTT broker configuration

The MQTT broker host, port, username, and password are configured at the platform level via BLE provisioning or REST API (POST /api/v1/config). The watchdog product does not add any MQTT-specific configuration — it uses the platform's connection.