Git Product home page Git Product logo

osdp-python's Introduction

OSDP Python

OSDP Python is a python framework implementation of the Open Supervised Device Protocol (OSDP). This protocol has been adopted by the Security Industry Association(SIA) to standardize communication to access control hardware. Further information can be found at http://www.osdp-connect.com.

This project is highly inspired by @bytedreamer's OSDP.Net <https://github.com/bytedreamer/OSDP.Net>

License

  • Apache

Quick Start

Installation

To install OSDP, use pip3 or pipenv:

$ pip3 install -U osdp

This module depends on

  • pycryptodome
  • pyserial

Example Usage

>>> from osdp import *
>>> conn = SerialPortOsdpConnection(port='/dev/tty.wchusbserial1420', baud_rate=9600)
>>> cp = ControlPanel()
>>> bus_id = cp.start_connection(conn)
>>> cp.add_device(connection_id=bus_id, address=0x7F, use_crc=True, use_secure_channel=False)
>>> id_report = cp.id_report(connection_id=bus_id, address=0x7F)
>>> device_capabilities = cp.device_capabilities(connection_id=bus_id, address=0x7F)
>>> local_status = cp.local_status(connection_id=bus_id, address=0x7F)
>>> input_status = cp.input_status(connection_id=bus_id, address=0x7F)
>>> output_status = cp.output_status(connection_id=bus_id, address=0x7F)
>>> cp.shutdown()

osdp-python's People

Contributors

fabien-verkada avatar ryanhz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osdp-python's Issues

ControlPanel.output_control issue

I was not able to run the ControlPanel.output_control() before I changed the class OutputControls into the following form:

class OutputControls:

    def __init__(self, controls):
            self.controls = controls

    def build_data(self) -> bytes:
            data = bytearray()
            # for control in controls:
            for control in self.controls:
                    # data.extend(control.build_data())
                    data.append(control)
            return bytes(data)

What do you think?

Running on Pi 4

I have created a new Debian installation on a PI 4.
I have installed using pip install -U osdp
It installs successfully into the python2.7/site-packages/osdp
When I enter python and try to run

from osdp import *
Traceback (most recent call last):
File <"stdin>". line 1, in
File"home/pi/.local/lib/python2.7/site-packages/osdp/init.py", line 14 in from .-types_import(
File "/home/pi/.local/lib/python2.7/site-packages/osdp/_types.py", line 39
def init(self, sequence: init, use_crc: bool, has_security_control_block: bool):
^
SyntaxError: invalid syntax

Hardware Direction change

I am trying to use the library with a hat. I am using GPIO 14&15 and using RTS (GPIPO 17) as the direction change. I can see data on the UART, no state change to change the direction on the RS485 transceiver.
Is there a method to change the transceiver direction. I realise if you are using a USB 485 transceiver this is not an issue, or it is handle directly by the hardware.

Private classes - name 'SerialPortOsdpConnection' is not defined

Following your example code python throws a name error:
conn = SerialPortOsdpConnection(port='/dev/tty.wchusbserial1420', baud_rate=9600)
NameError: name 'SerialPortOsdpConnection' is not defined
I'm not python expert but it seems that all classes in the packare are private (due to the underscore naming)
also tried different import methods but failed - any help welcome

Wrong property references

In _device.py _secure_channel somewhere is called _secureChannel and server_random_number is serverRandomNumber.

When adding multiple devices that are offline the serial port is blocking waiting for timeout

Hi Ryan,

I've been inspired by your project, and im trying to create a OSDP control panel with some OSDP readers i have laying around.
However when i try to add multiple devices the serial port is blocked while waiting for the device to respond (this is when device is offline).
cp.add_device(connection_id=bus_id, address=2, use_crc=False, use_secure_channel=False) cp.add_device(connection_id=bus_id, address=1, use_crc=False, use_secure_channel=False)

The traceback looks like this:
Traceback (most recent call last): File "C:\Users\Kenneth\PycharmProjects\OSDP\venv\lib\site-packages\osdp\_bus.py", line 95, in run_polling_loop reply = self.send_command_and_receive_reply(data, command, device) File "C:\Users\Kenneth\PycharmProjects\OSDP\venv\lib\site-packages\osdp\_bus.py", line 158, in send_command_and_receive_reply raise TimeoutError("Timeout waiting for reply message") TimeoutError: Timeout waiting for reply message

Could you please advice in case im doing something silly?
Thank you in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.