Skip to main content

A package for NRC devices

Project description

Nrcpy

Nrcpy is a Python package for working with NRC devices. It provides a convenient interface to connect to an NRC device, send commands, and retrieve information from the device.

🔥 Installation

You can install nrcpy using pip:

pip install nrcpy

🪧 Usage

Here is an example of how to use nrcpy to connect to an NRC device and control the relays:

from nrcpy import NrcDevice

# Configure the device
ip = '192.168.1.200'
port = 23
username = 'admin'
password = 'admin'

# Create an instance of NrcDevice
nrc = NrcDevice((ip, port, username, password))

# Open connection
nrc.connect()

# Login
if nrc.login():
    # Control the relays
    nrc.relayContact(1, 500)
    nrc.relayContact(2, 1000)
    nrc.relayOff(1)
    nrc.relayOn(2)

    # Get relays status
    relays_status = nrc.getRelaysValues()
    relay_1_status = nrc.getRelayValue(1)
    relay_2_status = nrc.getRelayValue(2)

    print(f'Relays Status (hex): {relays_status}')
    print(f'Relay 1 Status: {relay_1_status}')
    print(f'Relay 2 Status: {relay_2_status}')
else:
    print('Error in login')

# Close connection
nrc.disconnect()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nrcpy-1.2.3.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

nrcpy-1.2.3-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page