Skip to content

Controlling actuators

Actuators only obey senders they have been taught in with (see Teach-in). Commands are sent from the module's base ID, or another ID of its range with sender=.

from enocean import BlindActuator, SerialCommunicator, SwitchActuator

communicator = SerialCommunicator(port='/dev/ttyUSB0')
communicator.start()

light = SwitchActuator(communicator, '05:99:77:AF')  # D2-01-12 by default
light.turn_on(channel=1)
light.set_output(50, channel=0)  # dimmers: 0 to 100 %
light.query_status()  # the actuator answers with a status telegram (command 4)

cover = BlindActuator(communicator, '05:97:BA:73')  # D2-05-00 by default
cover.go_to(position=50)  # 0: fully open / up
cover.stop()
cover.query_position()

Replies arrive like any other telegram; with the actuators in the communicator's device registry they come decoded (packet.parsed['OV'], packet.parsed['POS']…).

Channels are 0-based; ALL_CHANNELS (the default of SwitchActuator) addresses every output.

Other telegrams

Any telegram can be built from its profile's fields with RadioPacket.create() (see EEP().describe() for the fields), then sent with communicator.send():

from enocean import RORG, RadioPacket

# D2-01-12, command 1 (Actuator Set Output): switch output channel 1 on
packet = RadioPacket.create(
    rorg=RORG.VLD,
    rorg_func=0x01,
    rorg_type=0x12,
    command=1,
    destination=[0x05, 0x99, 0x77, 0xAF],
    sender=[0xFF, 0xC3, 0x6F, 0x80],  # the module's base ID
    IO=1,
    OV=100,
)
print(bytes(packet.build()).hex(' '))  # the ESP3 bytes written to the module
print(packet.parsed['OV']['value'])  # Output value 1% to 100% or ON: 100
assert packet.data[1:4] == [0x01, 0x01, 0x64]