Metadata-Version: 2.1
Name: hik_check
Version: 0.5.1
Summary: A script for hikvision device management
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.0

# hik_check

A command-line tool for Hikvision device management.

## Installation

```bash
pip install hik_check
```

## Requirements

- Python >= 3.7
- `requests` library (installed automatically)

## Usage

```bash
hik_check [options]
```

### action_push

Fetch access events from devices (or a JSON file) and re-push them to the client service.

```bash
hik_check action_push
```

1. **Bulk push** - all events in a time range from the selected devices
2. **Single user push** - same, filtered by `employeeNoString`
3. **Push from JSON file** - analyses the file (raw device events, already-converted payloads, or hik_check backups; raw events are converted and need a device IP), then pushes

Each device event is converted to the client format and pushed:

```json
{"ipAddress": "192.168.1.165", "dateTime": "<time>", "eventType": "AccessControllerEvent",
 "AccessControllerEvent": {"majorEventType": 5, "subEventType": 75, "employeeNoString": "...",
   "doorNo": 1, "attendanceStatus": "checkIn", "name": "...", "cardNo": "", "cardType": 1,
   "cardReaderNo": 1, "serialNo": 25, "userType": "normal", "currentVerifyMode": "...",
   "label": "Check In", "mask": "unknown", "pictureURL": "..."}}
```

Fields the device doesn't send are omitted (`cardNo` defaults to `""`); temperature, face-rect and
thermal fields are not forwarded.

Each mode shows a summary and asks for confirmation before pushing. Client IP, port (default 5000),
major/minor filter (default 5/75 = successful access, 0/0 = all), timezone and device lists are
remembered in `~/.config/hikcheck/action_push.json`. Fetched events are backed up under
`./hikcheck_action_push/<timestamp>/`; events that fail to push are saved to `failed_pushes.json`
in that folder and can be re-pushed with option 3.

## Developer

Migara Mewantha
