Quick start
In this guide you run Hour Advantage on your own machine. You see a real event in a few minutes. You need no clock hardware, because curl plays the part of a ZKTeco clock.
Hour Advantage fits several business models. You can run your own company’s time and attendance. You can run a multi-tenant service for your customers. You can look after clocks as a dealer. Or you can build one engine into your own platform. Business models shows how each one fits.
You need:
- The Hour Advantage programs and the official package bundles. Both come with the Hour Advantage distribution.
- Docker, for a throwaway Postgres database.
curl. On Windows, usecurl.exe. It comes with Windows 10 and later.
Ports 8080, 9090 and 55432 on 127.0.0.1 must be free.
1. Get Hour Advantage
Section titled “1. Get Hour Advantage”The Hour Advantage distribution gives you:
| The programs | Three programs for your platform. hourd is the server. hourctl is the command line client. It also builds and tests packages on your machine. houradm handles installation and maintenance. This guide uses hourd and hourctl. Put them on your PATH. |
| The official package bundles | One .tar.gz file for each package, ready to push. You use them in step 4. |
The houradvantage container image | The same three programs, running as a non-root user, with the official package bundles inside. Deploy shows how to run it. |
The sources of the example packages are in the public repository hour-advantage-examples. Packages explains how to build bundles from them.
Check the programs:
hourd --version2. Start Postgres
Section titled “2. Start Postgres”Start a throwaway Postgres 17 database named houradvantage-quickstart. It listens on port 55432 of loopback only:
docker run -d --name houradvantage-quickstart -e POSTGRES_USER=houradvantage -e POSTGRES_PASSWORD=houradvantage -e POSTGRES_DB=houradvantage -p 127.0.0.1:55432:5432 postgres:17-alpine -c tcp_keepalives_idle=10 -c tcp_keepalives_interval=5 -c tcp_keepalives_count=3 -c tcp_user_timeout=30sThe three -c settings are limits the gateway asks of its database. The gateway refuses to start without them. See Operations, Database role settings.
3. Run the gateway
Section titled “3. Run the gateway”In a terminal of its own:
# PowerShellhourd run# bashexport HOURADVANTAGE_DATABASE_URL=postgres://houradvantage:houradvantage@127.0.0.1:55432/houradvantagehourd runThe gateway waits for Postgres to accept connections. Then it creates its tables and opens the admin API on 127.0.0.1:9090. An admin API on loopback needs no login. So hourctl on this machine reaches it with no settings. Leave the gateway running.
The log warns that HOURADVANTAGE_SECRET_KEY is not set. That is fine for this guide, because it keeps no secret. But the gateway refuses to store your first secret until the key is set. A secret can be a delivery key, a sink’s secret for Time and Attendance, or a broker password. When you go on, make a key first with houradm gen-secret-key. Give it to hourd run as HOURADVANTAGE_SECRET_KEY. See secrets at rest.
In a second terminal, check it:
hourctl statusgateway running at http://127.0.0.1:9090, version 0.1.0, instance <host>listeners 0 (0 running, 0 stopped, 0 failed)endpoints 0 (0 stopped)devices 0 (0 allowed, 0 pending, 0 blocked)sinks 0 (0 events waiting, 0 failing)4. Push the packages
Section titled “4. Push the packages”A fresh database has no packages. Push the official bundles and activate them. Run this in the folder that holds the distribution’s bundles, the .tar.gz files:
# PowerShellhourctl pkg push --activate (Get-ChildItem *.tar.gz).FullNamehourctl pkg list# bashhourctl pkg push --activate *.tar.gzhourctl pkg listYou can use bundles built from the example packages instead. Build them in a checkout of hour-advantage-examples. Building runs each package’s scenarios. Then push them:
# PowerShellhourctl pkg build . -o disthourctl pkg push --activate (Get-ChildItem dist\*.tar.gz).FullName# bashhourctl pkg build . -o disthourctl pkg push --activate dist/*.tar.gzhourctl pkg list shows each package line and the revision that runs. One of them is [email protected]. Packages covers bundles, revisions and lines.
5. Set up a listener and an endpoint
Section titled “5. Set up a listener and an endpoint”Save this as quickstart.toml:
[[listener]]id = "devices"type = "http"listen = "127.0.0.1:8080"
[[endpoint]]id = "office"listener = "devices"path = "/office"new_devices = "allow"options = { timezone = "America/Chicago" }The listener takes HTTP on 127.0.0.1:8080. The endpoint office serves every request under /office. It uses the ZK PUSH 3.4 package and the America/Chicago time zone. It lets in any device that calls, because of new_devices = "allow". Outside a trial, use "hold". See devices. Apply it:
hourctl apply quickstart.tomllistener devices: createdendpoint office: createdwarning: port 8080 is one no listener of this setup used before: a load balancer or a published port that clocks reach it by needs it too (docker compose: a haproxy.cfg frontend and a ports: line; Kubernetes: the devices Service; `hourctl export lb` prints them). Another tenant's listener cannot share the portapplied on 1/1 instances (config version 13)The warning is for deployments behind a load balancer or published ports. You have none here. The config version is your gateway’s own count of changes, so your number differs.
In a third terminal, follow the events as the gateway stores them:
hourctl events --follow6. Be a clock
Section titled “6. Be a clock”Now a ZK clock with serial number TEST0001 calls in. Each request below is what a real clock sends to a server set to 127.0.0.1, port 8080, path /office.
# PowerShell# First contact: the clock asks for its options.curl.exe -s "http://127.0.0.1:8080/office/iclock/cdata?SN=TEST0001&options=all&pushver=3.4.0"# Heartbeat: "anything for me?"curl.exe -s "http://127.0.0.1:8080/office/iclock/getrequest?SN=TEST0001"# A punch: user 1001 checks in by fingerprint.curl.exe -s --data-binary "1001`t2026-10-01 08:00:00`t0`t1`t0`t0`t0`n" "http://127.0.0.1:8080/office/iclock/cdata?SN=TEST0001&table=ATTLOG&Stamp=2026-10-01T08:00:00"# bash# First contact: the clock asks for its options.curl -s "http://127.0.0.1:8080/office/iclock/cdata?SN=TEST0001&options=all&pushver=3.4.0"# Heartbeat: "anything for me?"curl -s "http://127.0.0.1:8080/office/iclock/getrequest?SN=TEST0001"# A punch: user 1001 checks in by fingerprint.printf '1001\t2026-10-01 08:00:00\t0\t1\t0\t0\t0\n' | curl -s --data-binary @- "http://127.0.0.1:8080/office/iclock/cdata?SN=TEST0001&table=ATTLOG&Stamp=2026-10-01T08:00:00"The first answer is the clock’s settings: GET OPTION FROM: TEST0001, TimeZone=-05:00, the upload stamps, and more. The heartbeat and the punch are each answered OK. The gateway stored the punch before it told the clock so.
7. See what happened
Section titled “7. See what happened”The device registered itself. List devices:
hourctl devicesENDPOINT DEVICE STATUS KEY PRESENTED LAST SEEN REMOTE IP MESSAGES ERRORS LABELSoffice TEST0001 allowed none none 2026-10-04T18:00:26.747Z 127.0.0.1 3 0 -The events terminal shows three events:
- A
device.newevent. - A
device.joinedevent. The clock was let in, so it joined its tenant and its endpoint’s group. - The punch.
Each line shows the event’s sequence number, when it was stored, its type, the endpoint and device, and its data. hourctl events lists them again. They come after the package.updated events, ids 1 to 7, that pushing the bundles’ policy packages made:
8 2026-10-04T18:00:26.702959Z device.new office/TEST0001 {"device_id":1,"key_presented":"none","remote_ip":"127.0.0.1","status":"allowed"}9 2026-10-04T18:00:26.703114Z device.joined office/TEST0001 {"device_id":1,"group":"office"}10 2026-10-04T18:00:26.752848Z punch office/TEST0001 {"dst_ambiguous":false,"local_time":"2026-10-01 08:00:00","state_name":"check_in","time":"2026-10-01T08:00:00-05:00","time_zone":"America/Chicago","user_id":"1001", ... ,"verify_name":"fingerprint", ...}The punch uses neutral terms: user_id, time, state_name and verify_name. What the clock said in its own terms is under vendor.zk. Events describes every field.
8. Send the clock an action
Section titled “8. Send the clock an action”Ask the clock to report what it is. Use the standard action get_info:
hourctl action office TEST0001 get_infoaction #1 get_info for office/TEST0001: queued (commands #1136802001)The command waits until the clock next calls in. Send another heartbeat, the same getrequest as in step 6. This time the answer is the command, with its id:
C:1136802001:INFOA real clock carries out the command and posts the result. Play that part too. Use the id from your own answer in place of 1136802001:
# PowerShellcurl.exe -s --data-binary "ID=1136802001&Return=0&CMD=INFO`n~DeviceName=Demo Clock`nFWVersion=Ver 1.0.0`nUserCount=1`n" "http://127.0.0.1:8080/office/iclock/devicecmd?SN=TEST0001"# bashprintf 'ID=1136802001&Return=0&CMD=INFO\n~DeviceName=Demo Clock\nFWVersion=Ver 1.0.0\nUserCount=1\n' | curl -s --data-binary @- "http://127.0.0.1:8080/office/iclock/devicecmd?SN=TEST0001"The answer is OK. The action is done. The events terminal shows a command.result event and an action.result event. The device’s record holds what the clock reported:
hourctl actions office TEST0001hourctl device show office TEST0001ID ACTION STATUS STEPS LANE CREATED1 get_info done 1 interactive 2026-10-04T18:00:29.971Zdevice show lists the reported values on its info line:
info firmware=Ver 1.0.0, model=Demo Clock, push_version=3.4.0, user_count=1Clean up
Section titled “Clean up”Stop the gateway with Ctrl-C in its terminal. Then remove the database:
docker rm -f houradvantage-quickstartNext steps
Section titled “Next steps”| Deploy | Run Hour Advantage as a container, as a Docker Compose cluster, on Kubernetes, or as a service. |
| Networking | Listeners, endpoints, ports and the load balancer in front. |
| Devices | Letting devices in, keys, and new_devices = "hold". |
| Packages | Building, pushing and activating packages; ZKTeco PUSH for ZK clocks. |
| Actions | Every standard action, and how actions reach devices. |
| Jobs | One action over many devices, in waves. |
| Sync groups | Keeping people, access and punches the same on clocks of any vendor. |
| Admin API | The HTTP API hourctl uses. |
| Command line | Every hourd, hourctl and houradm command. |