Hour Advantage Connect
Connect sits between time clocks and your systems. Clocks talk to it in their own protocol. Your systems get JSON events in one format, and one API to send commands back. This is the same whatever the clock’s vendor.
Connect reports what happened at the clocks, and it does what it is told. It never decides whether a person should exist, or what their time is worth. See headless.
-
Packages do the vendor work. Each protocol package lists the messages a device sends and the commands it accepts. It translates both. Every package has scenario tests that cover each message and command. See protocol packages.
-
Each tenant’s decisions are its own policy package. At a few moments, the endpoint’s policy package says what to do. It uses the same APIs a caller has. The moments are:
- a punch with several routes;
- a clock joining, moving or coming back;
- a person enrolled at a clock.
See policy packages. Everything else is your own system, reacting to events.
-
One vocabulary for every vendor. Events use neutral fields. What a device says in its own terms is kept apart under
vendor. The standard actions mean the same on every device whose package offers them. They includeupsert_user,set_cards,change_user_id,set_biometricandreboot. -
Several instances share one database. All of them are active, behind any load balancer.
The Quick start runs Connect on your own machine. It walks a pretend clock through first contact, a punch and a command, with no clock hardware. To run it for real, see deploy.
How it behaves
Section titled “How it behaves”| Stored before acknowledged | Connect commits a message’s events to Postgres before the clock gets its OK. It commits everything else the message changes in the same step. If Connect cannot store them, it does not acknowledge the clock, and the clock sends again. |
| In order, at least once, per sink | Each sink gets its events in the order they were stored. Connect sends the same batch again until the sink answers 2xx. A sink that is down holds up only itself. An event can arrive twice. Deduplicate on id. The same device record always gets the same id. Order punches by time. |
| One writer per clock | Connect handles a clock’s messages one at a time, whichever instance receives them. |
| Commands survive restarts | Connect stores a command when you queue it. It hands the command to the clock at most once. If a command is never answered, Connect reports it. Any instance can match the clock’s answer to its command, even after a restart. A request key makes queuing safe to repeat. |
| No affinity needed | Any instance answers any clock. A command queued on one instance reaches the clock through whichever instance it polls next. |
This holds for packages with delivery = "ack". Every bundled package uses it. Writing packages describes the other modes.
Concepts
Section titled “Concepts”| Piece | What it is |
|---|---|
| tenant | Whoever operates clocks through the install: a dealer, a software vendor or an employer. Every piece below belongs to a tenant. Ids are unique within a tenant. A fresh install has the tenant default. See tenants. |
| listener | Where traffic arrives. An http listener binds a port. An mqtt listener connects to a broker and subscribes. See MQTT. |
| endpoint | Where a set of devices is served. Traffic on this listener under this path (or topic) uses this package, these options and these sinks. Paths and topics can capture parts of themselves, such as /site/{site} or clocks/{device}/events. |
| device | A clock. Each endpoint identifies a device by the id its package reads: a serial number, a MAC address, a cloud id or a topic segment. The same id on two endpoints is two devices. A device is allowed, pending or blocked, and may have a key. See devices. |
| package | A protocol implementation. You push it as a bundle, and Connect keeps it in the database. An endpoint names it as [email protected], zk-push@3 or an exact version. |
| policy package | A tenant’s decisions at its hooks: route, joined, moved, back and enrolled. It is either the tenant’s own or a shared one it adopted. An endpoint names it as its policy. |
| route | Where a person’s punches go: a receiving system, a tenant in it, and the person’s id there. You set routes as defaults on a sync group or endpoint, or on the person. See routes. |
| label | A key = value pair on an endpoint, a device or a person. Selectors pick by label, for example region ^= west/nevada and kind != kiosk. |
| action | What Connect sends to a device. It is a standard action, which is the same for every vendor, or one of the package’s own actions or commands. See actions. |
| job | One action run over many devices, in waves. You pick the devices by endpoint, selector or id. An abort threshold pauses the job. See jobs. |
| var, secret | Named values a package reads, such as a cloud URL or an API password. You set them per tenant. Secrets are sealed in the database. See environments. |
| sink | A webhook that receives events. See sinks. An endpoint can have several sinks, or none. Connect stores its events either way, and you can pull them. |
| sync group | A named set of endpoints. Their allowed devices keep chosen data the same, whatever their vendor. The data can be people, access, lists, settings or punches. Every endpoint is in exactly one group. An endpoint that names none gets a group of its own that keeps nothing. A person enrolled at a clock becomes the group’s person. The person stays unlinked until you set an id. See sync groups. |
Sizing
Section titled “Sizing”Connect is built for tens of thousands of clocks on one install. You spread them over as many instances as you run. Operations covers how to size the instances and the database.