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.6.tar.gz
(15.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyrisco-0.6.6-py3-none-any.whl
(17.5 kB
view details)
File details
Details for the file pyrisco-0.6.6.tar.gz.
File metadata
- Download URL: pyrisco-0.6.6.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75a7703912edbac2932a2916792b3c84e6870fdfa315e276ddda81f2641e3922
|
|
| MD5 |
78a4d9a9f3e45e42d9e4bf513c6d3c6f
|
|
| BLAKE2b-256 |
e37d822293fdae4f14949630ba2dccde974e640ae6bbbf4e28ab5e7144ec00ee
|
File details
Details for the file pyrisco-0.6.6-py3-none-any.whl.
File metadata
- Download URL: pyrisco-0.6.6-py3-none-any.whl
- Upload date:
- Size: 17.5 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 |
7f610163892c5cddbcb9eec2fb13e0ff84cc3966e742dfa56113b2627c810eb3
|
|
| MD5 |
59a29a073e23604fae566c27fc66b911
|
|
| BLAKE2b-256 |
91ff055c72c4704d96bb79380be0e5e6a1f57bb312b1581be7a8c9e9da5f0547
|