Local API

Local HTTP API

Every clock runs a small web server on your local network. It serves a settings page for your browser and a REST API for scripts and home automation (Home Assistant, Loxone, …). No cloud account is needed and nothing leaves your network.

The local API uses the same parameter names, value ranges and conventions as the Cloud API. This page covers only what is different or specific to the local interface. For the full parameter reference (names, allowed values, descriptions), see the Cloud API documentation.

Important

This page describes firmware 1.041 and newer. Firmware 1.034–1.040 listened on port 88 and offered only /v1/{parameter}. The settings page, /v1/settings, /v1/info and the Wi-Fi endpoints are new in 1.041. Update the clock in the mobile app to get them (Firmware Updates).


Connection

On your home network the clock listens on the standard HTTP port 80, so the URL has no port number. No authentication is required.

http://CLOCK_IP/

The clock also registers its name with your router, so this often works too (model name, dash, four-digit serial number):

http://zen-0467/

To find the clock's IP address, check your router's list of DHCP clients or the network information in the mobile app.

In setup mode the clock broadcasts its own Wi-Fi network (for example Zen-0467, no password). The same page and the same API are then available at:

http://192.168.0.1/

Most phones open the page by themselves after joining the clock's network. How to switch the clock to setup mode is described in Listening Mode.

Which firmware is the clock running?

curl http://192.168.1.100/v1/revision
{"ok":true,"status":200,"value":41}

41 means firmware 1.041. GET /v1/info also returns fw (for example "1.041") and api, the version of the local API (1 in firmware 1.041). The same API version can be read with GET /v1/webversion.


Settings page

GET / serves the settings page. It covers everything the mobile app offers: time format, time zone and daylight saving time, date display, digit transitions, cathode cleaning, colon tubes, system LED, lights of your model, day and night brightness with the weekly night-mode schedule, custom values, countdown, stopwatch, tube healing, Wi-Fi setup and clock information. Every change is saved immediately.


REST endpoints

Method and path Purpose
GET /v1/{parameter} Read one parameter
POST /v1/{parameter} Write one parameter
GET /v1/settings All settings in one reply
GET /v1/info Clock, network and system status
GET /v1/wifi/scan Wi-Fi networks in range
POST /v1/wifi Connect to a Wi-Fi network
POST /v1/wifi/forget Forget all Wi-Fi networks

Read one parameter

curl http://192.168.1.100/v1/transition
{"ok":true,"status":200,"value":2}

A value of 0 is a valid value and is returned with status 200.

Write one parameter

Send the new value as the request body, either as a plain value or as JSON:

curl -X POST http://192.168.1.100/v1/transition -d '3'
curl -X POST http://192.168.1.100/v1/transition -H "Content-Type: application/json" -d '{"value":3}'
{"ok":true,"status":200,"value":3}

String parameters (customdata, nmstr) take a string the same way:

curl -X POST http://192.168.1.100/v1/customdata -d '{"value":"12_34"}'

Stopwatch (counts up from 00:00:00): 1 start or continue, 0 pause, 2 back to 00:00:00. switchtotimemode returns to the time.

curl -X POST http://192.168.1.100/v1/stopwatch -d '1'

connectivitymode, reset, factoryreset and calibratertc run about 0.3 s after the reply has been sent, so the reply still arrives. Such a reply contains "deferred": true.

All settings at once

curl http://192.168.1.100/v1/settings
{"ok":true,"status":200,"settings":{"format":24,"leadingzero":1,...,"nmstr":"AAAA..."}}

The object contains every read-write parameter except rtccalibration, with the same values as the single-parameter calls.

Status

curl http://192.168.1.100/v1/info
{"ok":true,"status":200,"info":{"api":1,"mode":"sta","ssid":"...","ip":"192.168.1.100",...}}
Field Meaning
api Version of the local API
mode sta on your network, ap in setup mode
ssid, ip, hostname, rssi, mac Wi-Fi network, IP address, name, signal strength in dBm, MAC address
product, name, serial, hw, fw, sysfw, tubes Model number and name, serial number, hardware version, firmware, Device OS version, number of tubes
freemem, largestblock, watchdogevents, resetreason, resetreasondata Memory and restart diagnostics
ota, clockmode, connectivitymode, healingstate Firmware updates allowed, current display mode, online/offline mode, cathode cleaning state
ntpage Seconds since the last internet time sync, -1 = none yet
uptime Seconds since the clock started
now, timevalid UTC time (Unix timestamp) and whether it is set
lt, ld, wd Local time, local date, weekday (1 = Sunday)

Wi-Fi

GET  /v1/wifi/scan      {"ok":true,"status":200,"found":N,"networks":[{"ssid":"...","rssi":-60,"sec":3,"cipher":1,"ch":6},...]}
POST /v1/wifi           {"ssid":"...","password":"...","sec":3,"cipher":1}
POST /v1/wifi/forget    clears every saved network and switches the clock to setup mode

sec and cipher are optional (taken from the scan). Security: 0 open, 1 WEP, 2 WPA, 3 WPA2. Cipher: 1 AES, 2 TKIP, 3 both. In setup mode a successful POST /v1/wifi makes the clock join the network about a second later, and its own Wi-Fi disappears. On your home network the new network is used after a restart. The scan pauses the display for a few seconds.


Response format

All responses are JSON.

Field Type Description
ok boolean true on success, false on error
status integer HTTP status code (the same as the status of the HTTP response)
value integer or string Current value (single-parameter calls)
deferred boolean Present when the command runs a moment after the reply
message string Error description (on failure)

Error responses

Status Meaning
400 Missing or invalid value, malformed request
403 Parameter is not available on the local API (see below)
404 Unknown parameter or path
405 Wrong method (reading a write-only or writing a read-only parameter, POST to a read-only endpoint)
413 Request body larger than 512 bytes
431 Request line too long

Parameters

The parameter list is in the Cloud API reference. Locally most parameters have the same access (read-only, write-only, read-write), with these exceptions:

  • Read-only here: hardwareversion, serialnumber, latitudelength.
  • Not available here (403): testfreeze, cleareeprom, wifireset.

These remain available through the cloud.

Parameters not listed in the Cloud API reference

Parameter Access Description
rssi R Wi-Fi signal strength in dBm
freememory R Free memory in bytes
largestfreeblockheap R Largest contiguous free memory block in bytes
watchdogevents R Number of watchdog restarts
lastntpsyncmillis R Milliseconds since start at the last internet time sync, -1 = none yet
otaenabled R Whether firmware updates are currently allowed
macaddr-1, macaddr-2 R MAC address as two 32-bit integers
localip R Local IP address as a 32-bit integer
uptime R Seconds since the clock started
webversion R Version of the local API
nmstr RW Night-mode schedule as 42 letters A–P (see the Cloud API)
timesync RW Time source: 1 automatic (internet time), 2 manual (the time set with time is kept; models with a battery-backed clock chip keep it across power cuts)
reset W Write 1 to restart the clock (runs after the reply)
factoryreset W Write 1 to restore factory settings; Wi-Fi networks are kept (runs after the reply)
time W Set the time (Unix timestamp). With timesync = 1 an online clock syncs from the internet again within minutes, with timesync = 2 the value is kept
webstate, weberrors, webidle, webrebinds R Web server diagnostics

Brightness values

The brightness parameters use a non-linear scale. The API accepts and returns these values:

API value Label
1 Off
6 Very Low
71 Low
126 Medium
201 High
256 Full

This applies to both brightnessday and brightnessnight.


Compatibility

GET/POST /device/{parameter} (form body arg={value}, reply {"data":{"value":...},"ok":true,"status":200}) is the older interface of the mobile app's Direct connect mode. It is kept unchanged with its quirks: the time zone is shifted by one, localip is always 192.168.0.1, and a value of 0 is answered with status 503 and the message "Unknown or invalid settings". For scripts use /v1/….


Differences from the Cloud API

Aspect Cloud API Local API
Authentication OAuth token required None
Base URL https://api.daliborfarny.com/v1/ http://CLOCK_IP/v1/
Finding the clock GET /v1/devices Router client list, http://zen-0467/
Online check GET /v1/devices/{id}/online The request succeeds when the clock is reachable
Works without internet No Yes, also in setup mode at 192.168.0.1
Parameter names Identical Identical
Extra endpoints — /v1/settings, /v1/info, /v1/wifi…, settings page /