Skip to content

From a clock to a timecard

A clock’s punch needs a few things in place to reach a timecard. If one is missing, the punch waits somewhere you can’t see it on the timecard. This page goes through them in order.

The examples use a Connect tenant default. Its sync group office has an endpoint office for the clocks. The quick start makes them. The examples also use a Time and Attendance tenant acme.

  1. A secret key. The delivery key in step 3 is a secret. An instance with no HOURADVANTAGE_SECRET_KEY refuses to keep it (409). Make a key with houradm gen-secret-key. Give it to every hourd run as HOURADVANTAGE_SECRET_KEY. See secrets at rest. hourd dev keeps everything in memory and needs no key. Start the instance with HOURADVANTAGE_ATTEND=on. See running it.

  2. A tenant with a time zone. Without a time zone, no one can be worked out. Their punches are kept, and the ledger waits.

    Terminal window
    hourctl attend tenants create acme --name "Acme Manufacturing"
    hourctl -t acme attend setup set zone zone '"America/Chicago"'

    Any argument that takes JSON also takes @FILE, to read it from a file. It also takes -, for standard input. PowerShell strips the double quotes from a JSON string given in single quotes. In PowerShell, give the value as a file:

    Terminal window
    Set-Content -Encoding ascii zone.json '"America/Chicago"'
    hourctl -t acme attend setup set zone zone '@zone.json'

    You don’t need a policy for a first timecard. Pay periods are weekly. Time is counted plainly until a policy says otherwise. The walk-through adds one.

  1. A sink that speaks for the system. A sink is where Connect delivers events. This one hands punches to Time and Attendance. This sink carries a delivery key that the tenant issued. It has --system attendance as well as the receiver. The endpoint feeds it:

    Terminal window
    export KEY=$(hourctl -t acme attend delivery-keys create --label "time sink")
    hourctl sink add acme-time --receiver attendance --receiver-tenant acme \
    --system attendance --secret-env KEY --event punch
    hourctl endpoint set office --sink acme-time

    In PowerShell:

    Terminal window
    $env:KEY = hourctl -t acme attend delivery-keys create --label "time sink"
    hourctl sink add acme-time --receiver attendance --receiver-tenant acme `
    --system attendance --secret-env KEY --event punch
    hourctl endpoint set office --sink acme-time

    endpoint set --sink replaces the endpoint’s list of sinks. Name its other sinks too. Without --system, the punch arrives without the id that the system knows the person by. See delivery keys.

  2. The sync group keeps people. That means people is among its domains. Then the clock’s user is a person of the group:

    Terminal window
    hourctl sync set office domains=people

    Without it, the punch’s sender is only the clock’s user id. The punch lands as an unlinked person of the tenant.

  3. The person is known. Some clocks report their users. A ZK clock sends them when someone is enrolled. For such a clock, the person appears in the group by itself. Other clocks do not report users. For those, and for a bench clock played by curl, write the person yourself. Give the id they have in Time and Attendance as their external id for the system:

    Terminal window
    hourctl sync person set office 1001 name="Ann Lee" --external-id attendance=104552

    A punch for a user the group does not have is set aside as unknown_person (step 6). It stays set aside until the person exists.

  4. A route sends the punches there. Use a default route for the group. It uses each person’s external id for the system. Or use a person’s own route:

    Terminal window
    hourctl route add --group office --system attendance --to acme
    hourctl route add --person office/1001 --system attendance --to acme --person-id 104552

    Without a route, the punch is set aside unrouted in Connect (hourctl unrouted list office). It goes nowhere. Adding the route sends the punches set aside. See routes. Punches already routed to another id stay under that id.

  5. The punch can be read. It has a time, a device and a user. A punch without all three is kept as it came, among the tenant’s unreadable punches. The reason is kept, and a warning is logged:

    Terminal window
    hourctl -t acme attend unreadable list
    hourctl -t acme attend unreadable forget ID

    See a punch that cannot be read.

Then the day shows in the person’s ledger. Here is an example:

Terminal window
hourctl -t acme attend ledger 104552 --day 2026-10-07

If the ledger is not there, the message says why. It gives one of three reasons:

  • The tenant holds no fact about the person.
  • The person waits to be worked out.
  • The person can’t be worked out without a time zone. The message then gives the command that sets one.

None of these makes a delivery fail. So the sink shows nothing waiting. hourctl sinks counts what is not placed. For a sink feeding a tenant, it says “N punches delivered but unreadable”. For a sink that speaks for a system, it says “N punches set aside unrouted”. Counts stop at 1000 and show 1000+.

hourctl sink add and set warn when a sink names a system that no default route sends to. hourctl -t acme attend pending lists who waits to be worked out. It also says why a try failed, for example no time zone set up.