-
Notifications
You must be signed in to change notification settings - Fork 66
/
device.py
25 lines (19 loc) · 843 Bytes
/
device.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from dali.address import Short
###############################################################################
# XXX: There exists a package names device. so this module is a relict???
###############################################################################
class Device(object):
"""Any DALI slave device that has been configured with a short
address.
"""
def __init__(self, address, name=None, bus=None):
if not isinstance(address, int) or address < 0 or address > 63:
raise ValueError("address must be an integer in the range 0..63")
self.address = address
self._addressobj = Short(address)
self.bus = None
if bus:
self.bind(bus)
def bind(self, bus):
"""Bind this device object to a particular DALI bus."""
bus.add_device(self)