.. _configuring-sink-via-cli: =============================================== Wirepas sink configuration on the gateway (CLI) =============================================== Use the gateway's command line to inspect Wirepas sinks and set their parameters. Prerequisites ------------- This guide assumes you have already: 1. Connected to the gateway. 2. Deployed the :ref:`Wirepas gateway services ` on the gateway. 3. Connected the sink to the gateway. If these prerequisites are met, you can proceed with the configuration. Getting the Docker volume name ------------------------------ First, identify the Docker volume name associated with the D-Bus service: .. tab-set:: .. tab-item:: Command .. code:: console $ docker volume ls | grep "dbus" .. tab-item:: Output .. code:: console :class: no-copybutton docker volume ls | grep "dbus" local docker-compose_dbus-volume You'll use the volume name from the output, for example ``docker-compose_dbus-volume``, in the following commands. Command for setting the parameters ---------------------------------- Use the volume name in the command below. Replace ```` with it, in this example ``docker-compose_dbus-volume``. Replace ```` with one of the arguments described below. To list all available commands, use ``-h`` as ````. .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf {list,set} Listing the sinks on the gateway -------------------------------- To list the sinks connected to the gateway and their configurations, run: .. tab-set:: .. tab-item:: Command .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf list .. tab-item:: Output .. code:: console :class: no-copybutton docker run --rm -v docker-compose_dbus-volume:/var/run/dbus wirepas/gateway_transport_service wm-node-conf list List of sinks: ============== [sink1] =============== [sink_id]: sink1 [started]: True [node_address]: 1 [node_role]: SINK, CSMA_CA [network_address]: 1001 [network_channel]: 1 [max_ac]: 8000 [min_ac]: 2000 [max_ac_cur]: 8000 [min_ac_cur]: 2000 [max_ch]: 40 [min_ch]: 1 [max_mtu]: 102 [hw_magic]: 6 [stack_profile]: 1 [firmware_version]: [5, 3, 0, 89] [app_config_max_size]: 80 [are_keys_set]: False [app_config_seq]: 0 [app_config_diag]: 0 [app_config_data]: b'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' [stored_status]: ScratchpadStatus.SCRATCHPAD_STATUS_SUCCESS [stored_type]: ScratchpadType.SCRATCHPAD_TYPE_BLANK [stored_scratchpad]: {'seq': 0, 'crc': 0, 'len': 0} [processed_scratchpad]: {'seq': 255, 'crc': 65535, 'len': 16} [firmware_area_id]: 262 [target_and_action]: {'action': , 'target_sequence': 0, 'target_crc': 0, 'param': 0} [cost]: 0 =================================== Run this command before you start the configuration. It shows the ``sink_id`` of each sink. You need it in the configuration commands, so that the gateway knows which sink you want to configure when there is more than one. .. warning:: Stop the sink services before you reconfigure the parameters. If you're configuring the sink for the first time, the stack on the sink is already stopped. Setting the node address ------------------------ This command will help you to set the address of the node. ```` - Replace with the name of the volume ```` - Replace with integer number for the address of the node you want to configure. ```` - Replace with id of the sink that is to be configured. .. tab-set:: .. tab-item:: Command .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -n -s .. tab-item:: Output .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK Setting the node role --------------------- This command will help you to set the role of the node. .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -r -s **Parameters** - ```` — The name of the Docker volume to mount (where the D-Bus socket is located). - ```` — The node role, defined as a string combining: - one **base role**: ``sink`` | ``router`` | ``non-router`` - optional **flags** from the list ``[csma-ca, autorole]`` Example values: - ``-r "sink csma-ca"`` - ``-r "router csma-ca autorole"`` - ```` — The ID of the sink to be configured. If the configuration succeeds, you see: .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK Setting the network address --------------------------- This command will help you set the address of the network. .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -N -s ```` - Replace with the name of the volume. ```` - Network address as an int. For example: ``-N 0xA1B2C3`` or ``-N 123456`` ```` - Replace with id of the sink that is to be configured. If the configuration succeeds, you see: .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK Setting the network channel --------------------------- .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -c -s ```` - Replace with the name of the volume. ```` - Network channel as an int. For example: ``-c 5`` ```` - Replace with id of the sink that is to be configured. If the configuration succeeds, you see: .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK Setting the authentication key ------------------------------ .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -ak -s ```` - Replace with the name of the volume. ```` - Network wide 128 bytes authentication key. For example: ``-ak 112233445566778899AABBCCDDEEFF11`` or ``-ak 11,22,33,44,55,66,77,88,99,AA,BB,CC,DD,EE,FF,11`` ```` - Replace with id of the sink that is to be configured. If the configuration succeeds, you see: .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK Setting the cipher key ---------------------- .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -ck -s ```` - Replace with the name of the volume. ```` - Network wide cipher key. For example: ``-ck 112233445566778899AABBCCDDEEFF11`` or ``-ck 11,22,33,44,55,66,77,88,99,AA,BB,CC,DD,EE,FF,11`` ```` - Replace with id of the sink that is to be configured. If the configuration succeeds, you see: .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK Starting and stopping the sink ------------------------------ .. code:: console $ docker run --rm -v :/var/run/dbus wirepas/gateway_transport_service wm-node-conf set -S -s ```` - Replace with the name of the volume. ```` - True/False to start/stop sink. For example: ``-S true`` ```` - Replace with id of the sink that is to be configured. If the configuration succeeds, you see: .. code:: console :class: no-copybutton Configuration done with result = GatewayResultCode.GW_RES_OK