#Niagara
Ntfy_Notify v2: ntfy push notifications from a Niagara 4 station
A ProgramObject that sends a push notification to an ntfy server (ntfy.sh or self-hosted) on a boolean edge or a message change, without ever blocking the station: queue, dedicated thread, retries.
- date
- 23 October 2026
- tested with
- Niagara 4 · ntfy.sh or self-hosted ntfy server
- license
- MIT
- tags
- #ntfy,#notification,#programobject,#alarm,#http

What it does
It sends a push notification to an ntfy server (JSON POST). The scan (every Scan_Period seconds) only detects events and puts them in an in-memory queue. A dedicated thread (Ntfy_<component name>) empties the queue and makes the HTTP calls: even if ntfy doesn’t answer, the station Clock is never blocked.

Drop the .bog into your station, fill in Topic, compile. If N4 says “Program is not signed”, see here.
Inputs
- Connection:
Ntfy_Server(defaulthttps://ntfy.sh, without the topic),Topic,Access_Token(optional). - Content:
Title,Message(rising edge or watched message),Message_Off(back to normal, empty = nothing),ValueandValue_Decimals,Priority(1 to 5),Tags,Click_Url(https://added if missing),Markdown. - Triggering:
Mode_Change,Trigger,Force(test send). - Settings:
Scan_Period(live),Confirm_Delay(debounce),Min_Interval(only the latest state goes out),Startup_Delay(default 30 s),Send_On_Startup,Max_Queue(default 20, oldest dropped),Enable_Debug_Logs.
Variables in Title, Message, Message_Off and Click_Url: {time}, {date}, {station}, {state} (ON/OFF), {value}.
Outputs
Notifier_Okgoesfalseas soon as a send fails and back totrueon the first success: link it to a point with an alarm.Last_Http_Code(-1 = network or config error),Last_Execution,Error_Message.Sent_Count,Fail_Count(consecutive failures),Dropped_Count,Queue_Size.
The two modes
- Trigger (
Mode_Change = false): rising edge ofTrigger→Message; falling edge →Message_Offif not empty. ATriggerthat is faulty, offline, stale or null keeps the previous state. - Change (
Mode_Change = true):Messagegoes out when it is not empty and differs from the previous one. Comparison is on the raw text, before variables: a moving{time}or{value}triggers nothing.
Force sends a test right away, even during Startup_Delay, retries the queue, then resets to false by itself. At startup nothing goes out during Startup_Delay, then the current state becomes the reference: no spurious notification on restart.
Errors and retries
- Network error, HTTP 3xx/408/429/5xx or config error: retry after 5 s, 30 s, 2 min, then every 10 min.
- Other 4xx (400, 401, 403, 413…): message dropped, counted in
Dropped_Count. - Detected upfront: empty topic, URL without
http(s),http://ntfy.sh, topic inside the URL. Redirects are not followed, and the detail returned by ntfy is shown (e.g.unauthorized). - Messages cut around 3.9 KB (above 4 KB, ntfy turns them into an attachment).
Limits
- The queue lives in memory: pending messages are lost on Stop or station restart.
- A
Triggerpulse shorter thanScan_Periodis missed. - In Change mode, a change of
Valuealone triggers nothing: the value is read when a message goes out. - No line breaks yet (Niagara field is single-line): Markdown is limited to bold, italic, code and links.
- On public ntfy.sh, a short topic is guessable: use a long random name, or a token.