Skip to content

DFRobot RLY-8 8 channel PoE ethernet controller Python 3 Control Class and Example Code

License

Notifications You must be signed in to change notification settings

Fescron/DFRobot-RLY8-python3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DFRobot RLY-8 Python 3 Control Class and Example Code

This repository contains a control class and other example code for the RLY-8 8 channel PoE ethernet (and USB) relay controller by DFRobot. See this link to their wiki-page for more information about the device.

The code on this repository was originally written by Geréb Róbert in Python 2 (see this repository). I've ported it to Python 3 and added slightly more functionality and documentation.


Repository Files

  • RLY8Class.py: Control class for the relay
  • main.py: A basic Python-file which uses the RLY8Class.py file to control the relay
  • rly-8.py: Stand-alone example to control the relay
  • rly-8_simple.py: Stand-alone file to turn on/off relays by arguments (ex.: python rly-8_simple.py 1=on 2=off)

RLY8Class.py usage

from RLY8Class import RLY8

# Define the IP and port to connect to
# (DHCP is enabled by default, unfortunately the device doesn't have a hostname)
ADDR = ("192.168.0.202", 2000)

# Instantiate the RLY-8 object
rly8 = RLY8(ADDR)

# Print some information
print(rly8.name)
print(rly8.netconf)
print(rly8.version)
print(rly8.baudrate)

# Change some basic settings
rly8.setName("DFRobot2") # Default: "DFRobot"
rly8.setBaudrate(9600)   # Default: 115200

# Enable a relay (relays are numbered 1 to 8, states are "on" or "off")
rly8.setRelayStatus(1, "on")

# Print the status of a relay
print(rly8.relay1)

About

DFRobot RLY-8 8 channel PoE ethernet controller Python 3 Control Class and Example Code

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages