Smart-home notifications
The front door opened, a leak sensor tripped, the washing machine finished — you want to know about such events right away, not once the floor is already wet. Notifly is easy to connect both to Home Assistant and straight to MQTT — your own push infrastructure with no third-party clouds.
Home Assistant: a REST command
Section titled “Home Assistant: a REST command”Describe Notifly as a rest_command in configuration.yaml — and call it from
any automation:
rest_command: notifly: url: "https://your-notifly.example.com/message?token=AGdjfk_L.dKe8q" method: POST content_type: "application/json" payload: '{"title": "{{ title }}", "message": "{{ message }}", "priority": {{ priority }}}'An automation for “front door opened”:
- alias: "Notifly: front door opened" trigger: - platform: state entity_id: binary_sensor.front_door to: "on" action: - service: rest_command.notifly data: title: "🚪 Входная дверь открыта" message: "Время: {{ now().strftime('%H:%M') }}" priority: 7A leak sensor — at max priority already, so it gets through even in DND:
- alias: "Notifly: water leak" trigger: - platform: state entity_id: binary_sensor.leak_kitchen to: "on" action: - service: rest_command.notifly data: title: "💧 Протечка на кухне!" message: "Датчик сработал — перекройте воду." priority: 10The washing machine finished (by a drop in power draw):
- alias: "Notifly: washing done" trigger: - platform: numeric_state entity_id: sensor.washer_power below: 5 for: "00:03:00" condition: - condition: state entity_id: input_boolean.washer_running state: "on" action: - service: rest_command.notifly data: title: "🧺 Стирка закончена" message: "Можно развешивать." priority: 5 - service: input_boolean.turn_off target: entity_id: input_boolean.washer_runningHome Assistant: shell_command
Section titled “Home Assistant: shell_command”If you’d rather reuse the shared wrapper, call notifly-send through a
shell_command (the script must be accessible to the user HA runs as):
shell_command: notifly: '/usr/local/bin/notifly-send "{{ title }}" "{{ message }}" {{ priority }}'MQTT bridge: topic → push
Section titled “MQTT bridge: topic → push”No Home Assistant, but you have an MQTT broker (Zigbee2MQTT, ESPHome, DIY on ESP32)? A small subscriber turns topic messages into pushes:
#!/usr/bin/env bash# /usr/local/bin/notifly-mqtt — MQTT → Notifly bridgeset -euset -a; source /etc/notifly.env; set +a
# Listen to the topics you need. -v prints "topic payload".mosquitto_sub -h 192.168.1.10 -t 'home/#' -v | while read -r TOPIC PAYLOAD; do case "$TOPIC" in home/door/front) [[ "$PAYLOAD" == *'"contact":false'* ]] && \ notifly-send "🚪 Входная дверь открыта" "" 7 ;; home/leak/*) [[ "$PAYLOAD" == *'"water_leak":true'* ]] && \ notifly-send "💧 Протечка: $TOPIC" "Перекройте воду!" 10 ;; home/washer/done) notifly-send "🧺 Стирка закончена" "$PAYLOAD" 5 ;; esacdoneKeep the bridge alive with systemd — /etc/systemd/system/notifly-mqtt.service:
[Unit]Description=Notifly MQTT bridgeAfter=network-online.target
[Service]ExecStart=/usr/local/bin/notifly-mqttRestart=alwaysRestartSec=5
[Install]WantedBy=multi-user.targetsudo systemctl enable --now notifly-mqttWindows: PowerShell for local events
Section titled “Windows: PowerShell for local events”If your smart-home controller runs on Windows (say, a script polls the hub’s
API), send a push with the same
function Send-Notifly:
# a snippet polling the door stateif ($door.state -eq "open" -and $prev -eq "closed") { Send-Notifly -Title "🚪 Входная дверь открыта" ` -Message "Время: $((Get-Date).ToString('HH:mm'))" -Priority 7}Benefits
Section titled “Benefits”- Your own push with no third-party cloud. Home events go to your infrastructure.
- Priorities by importance. A leak is 10 (gets through DND), a door is 7, a wash is 5 (see priorities).
- A single point. Your phone, laptop and tablet get the same notification at the same time.
Further improvements
Section titled “Further improvements”- Send a snapshot from the door camera via extra fields.
- Separate channels for “home” and “cottage” to split pushes by address.
- Tie it to monitoring: if the smart-home hub goes silent — a separate alert that the system itself is down.