Ishraq Ibne Ashraf
and 1 contributors

NAME

Tinkerforge::BrickletRemoteSwitch - Controls remote mains switches

CONSTANTS

DEVICE_IDENTIFIER

This constant is used to identify a Remote Switch Bricklet.

The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.

DEVICE_DISPLAY_NAME

This constant represents the display name of a Remote Switch Bricklet.

CALLBACK_SWITCHING_DONE

This constant is used with the register_callback() subroutine to specify the CALLBACK_SWITCHING_DONE callback.

FUNCTION_SWITCH_SOCKET

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_SWITCHING_STATE

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SET_REPEATS

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_REPEATS

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SWITCH_SOCKET_A

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SWITCH_SOCKET_B

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_DIM_SOCKET_B

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_SWITCH_SOCKET_C

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTION_GET_IDENTITY

This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.

FUNCTIONS

new()

Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.

switch_socket()

This function is deprecated, use :func:`Switch Socket A` instead.

get_switching_state()

Returns the current switching state. If the current state is busy, the Bricklet is currently sending a code to switch a socket. It will not accept any calls of :func:`Switch Socket` until the state changes to ready.

How long the switching takes is dependent on the number of repeats, see :func:`Set Repeats`.

set_repeats()

Sets the number of times the code is send when of the :func:`Switch Socket` functions is called. The repeats basically correspond to the amount of time that a button of the remote is pressed.

Some dimmers are controlled by the length of a button pressed, this can be simulated by increasing the repeats.

The default value is 5.

get_repeats()

Returns the number of repeats as set by :func:`Set Repeats`.

switch_socket_a()

To switch a type A socket you have to give the house code, receiver code and the state (on or off) you want to switch to.

The house code and receiver code have a range of 0 to 31 (5bit).

A detailed description on how you can figure out the house and receiver code can be found :ref:`here <remote_switch_bricklet_type_a_house_and_receiver_code>`.

.. versionadded:: 2.0.1$nbsp;(Plugin)

switch_socket_b()

To switch a type B socket you have to give the address, unit and the state (on or off) you want to switch to.

The address has a range of 0 to 67108863 (26bit) and the unit has a range of 0 to 15 (4bit). To switch all devices with the same address use 255 for the unit.

A detailed description on how you can teach a socket the address and unit can be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.

.. versionadded:: 2.0.1$nbsp;(Plugin)

dim_socket_b()

To control a type B dimmer you have to give the address, unit and the dim value you want to set the dimmer to.

The address has a range of 0 to 67108863 (26bit), the unit and the dim value has a range of 0 to 15 (4bit).

A detailed description on how you can teach a dimmer the address and unit can be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`.

.. versionadded:: 2.0.1$nbsp;(Plugin)

switch_socket_c()

To switch a type C socket you have to give the system code, device code and the state (on or off) you want to switch to.

The system code has a range of 'A' to 'P' (4bit) and the device code has a range of 1 to 16 (4bit).

A detailed description on how you can figure out the system and device code can be found :ref:`here <remote_switch_bricklet_type_c_system_and_device_code>`.

.. versionadded:: 2.0.1$nbsp;(Plugin)

get_identity()

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c' or 'd'.

The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|