Skip to content

Commit

Permalink
Add docs article about Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
bdragon300 committed Oct 26, 2024
1 parent dd434ae commit fbecb78
Showing 1 changed file with 78 additions and 2 deletions.
80 changes: 78 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Let's look how to use this package in your code.

## Quick start


```python
from pyzkaccess import ZKAccess

Expand Down Expand Up @@ -32,7 +31,7 @@ zk.restart()
zk.disconnect()
```

## Working with a device
## Working with library

#### Use as context manager

Expand Down Expand Up @@ -168,3 +167,80 @@ zk.door[0].reader.events.only(card='123456', event_type=27).poll()
# Take all records from log with given card which was occur after 2010-10-11 14:28:04
zk.events.only(card='123456').after_time(datetime(2010, 10, 11, 14, 28, 4))
```

# Parameters

Device parameters are the way to manipulate the device settings. There are two groups of parameters on the device.

The first group is device parameters, which are related to the device itself. They are:

| Name | Type | Flags |
|----------------------------|---------------------------|------------|
| serial_number | str | read-only |
| lock_count | int | read-only |
| reader_count | int | read-only |
| aux_in_count | int | read-only |
| aux_out_count | int | read-only |
| communication_password | str | |
| ip_address | str | |
| netmask | str | |
| gateway_ip_address | str | |
| rs232_baud_rate | int | |
| watchdog_enabled | bool | |
| door4_to_door2 | bool | |
| backup_hour | int | |
| reboot | bool | write-only |
| reader_direction | str | |
| display_daylight_saving | bool | |
| enable_daylight_saving | bool | |
| daylight_saving_mode | int | |
| fingerprint_version | int | read-only |
| anti_passback_rule | int | |
| interlock | int | |
| spring_daylight_time_mode1 | DaylightSavingMomentMode1 | |
| fall_daylight_time_mode1 | DaylightSavingMomentMode1 | |
| spring_daylight_time_mode2 | DaylightSavingMomentMode2 | |
| fall_daylight_time_mode2 | DaylightSavingMomentMode2 | |
| datetime | datetime | |

The following code show how to get or set a parameter value, and how to get a description about each one:

```python
from pyzkaccess import ZKAccess

connstr = 'protocol=TCP,ipaddress=192.168.1.201,port=4370,timeout=4000,passwd='
zk = ZKAccess(connstr=connstr)
print(zk.parameters.ip_address) # Get a value
zk.parameters.ip_address = "192.168.1.2" # Set a value
print(zk.parameters.ip_address.__doc__) # Get description
```

The second group is door parameters, which are related to the door settings. They are:

| Name | Type | Flags |
|-----------------------|------------|-------|
| duress_password | str | |
| emergency_password | str | |
| lock_on_close | bool | |
| sensor_type | SensorType | |
| lock_driver_time | int | |
| magnet_alarm_duration | int | |
| verify_mode | VerifyMode | |
| multi_card_open | bool | |
| first_card_open | bool | |
| active_time_tz | int | |
| open_time_tz | int | |
| punch_interval | int | |
| cancel_open_day | int | |

The following code show how to get or set a door parameter value, and how to get a description about each one:

```python
from pyzkaccess import ZKAccess

connstr = 'protocol=TCP,ipaddress=192.168.1.201,port=4370,timeout=4000,passwd='
zk = ZKAccess(connstr=connstr)
print(zk.doors[0].parameters.verify_mode) # Get a parameter value of the first door
zk.doors[0].parameters.verify_mode = 1 # Set a parameter value of the first door
print(zk.doors[0].parameters.verify_mode.__doc__) # Get a parameter description
```

0 comments on commit fbecb78

Please sign in to comment.