A python library to communicate with Risco Cloud.
Project description
PyRisco
A python interface to Risco alarm systems through Risco Cloud.
Installation
You can install pyrisco from PyPI:
pip3 install pyrisco
Python 3.7 and above are supported.
How to use
Cloud
from pyrisco import RiscoCloud
r = RiscoCloud("<username>", "<password>", "<pincode>")
# you can also pass your own session to login. It will not be closed
await r.login()
alarm = await r.get_state()
# partitions and zones are zero-based in Cloud
print(alarm.partitions[0].armed)
events = await r.get_events("2020-06-17T00:00:00Z", 10)
print(events[0].name)
print(alarm.zones[0].name)
print(alarm.zones[0].triggered)
print(alarm.zones[0].bypassed)
# arm partition 0
await r.partitions[0].arm()
# and disarm it
await r.partitions[0].disarm()
# Partial arming
await r.partitions[0].partial_arm()
# Group arming
await r.partitions[0].group_arm("B")
# or a zero based index
await r.partitions[0].group_arm(1)
# Don't forget to close when you're done
await r.close()
Local
from pyrisco import RiscoLocal
r = RiscoLocal("<host>", <port>, "<pincode>")
await r.connect()
# Register handlers
async def _error(error):
print(f'Error handler: {error}')
remove_error = r.add_error_handler(_error)
async def _event(event):
print(f'Event handler: {event}')
remove_event = r.add_event_handler(_event)
async def _default(command, result, *params):
print(f'Default handler: {command}, {result}, {params}')
remove_default = r.add_default_handler(_default)
async def _zone(zone_id, zone):
print(f'Zone handler: {zone_id}, {vars(zone)}')
remove_zone = r.add_zone_handler(_zone)
async def _partition(partition_id, partition):
print(f'Partition handler: {partition_id}, {vars(partition)}')
remove_partition = r.add_partition_handler(_partition)
await r.connect()
# partitions and zones are one-based in Cloud
print(r.partitions[1].armed)
print(r.zones[1].name)
print(r.zones[1].triggered)
print(r.zones[1].bypassed)
# arm partition 1
await r.partitions[1].arm()
# and disarm it
await r.partitions[1].disarm()
# Partial arming
await r.partitions[1].partial_arm()
# Group arming
await r.partitions[1].group_arm("B")
# or a zero based index
await r.partitions[1].group_arm(1)
# Don't forget to close when you're done
await r.disconnect()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyrisco-0.6.5.tar.gz
(14.9 kB
view details)
Built Distribution
pyrisco-0.6.5-py3-none-any.whl
(17.3 kB
view details)
File details
Details for the file pyrisco-0.6.5.tar.gz
.
File metadata
- Download URL: pyrisco-0.6.5.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 547a1946fbd2b286ebaf6ce3c2746eb57d925839f381379d8234650f56fd7d61 |
|
MD5 | 1c3e718ebf4c4e64957e0682ce2eedbe |
|
BLAKE2b-256 | ead991f8eda5c53b7000af886baf76d26032ed1d534b39671566a75f0ba4fc81 |
File details
Details for the file pyrisco-0.6.5-py3-none-any.whl
.
File metadata
- Download URL: pyrisco-0.6.5-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 021ba1c40830ffb3961fc891f90cf9859e6173b4ec98f744dc7a4a10f2de43d7 |
|
MD5 | febd22af887ad626c65ce4dd1ccd7b38 |
|
BLAKE2b-256 | df767394af38036854376472e14641da84340bd4af1059dcca497d69ceeb0e85 |