|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
| Name | Deps |
|---|---|
| jsk_fetch_startup |
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
| Name | Deps |
|---|---|
| jsk_fetch_startup |
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
Messages
Services
Plugins
Recent questions tagged switchbot_ros at Robotics Stack Exchange
|
switchbot_ros package from jsk_3rdparty repovoicevox zdepth chaplus_ros emotion_analyzer gdrive_ros google_chat_ros influxdb_store jsk_power_switching_tools nfc_ros respeaker_ros ros_speech_recognition rospatlite rosping sesame_ros switchbot_ros zdepth_image_transport |
ROS Distro
|
Package Summary
| Version | 3.0.1 |
| License | BSD-3-Clause |
| Build type | CATKIN |
| Use | RECOMMENDED |
Repository Summary
| Checkout URI | https://github.com/jsk-ros-pkg/jsk_3rdparty.git |
| VCS Type | git |
| VCS Version | master |
| Last Updated | 2026-11-18 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Kei Okada
- Yoshiki Obinata
Authors
- Yoshiki Obinata
switchbot_ros
Controls SwitchBot devices from ROS through the
SwitchBot API. switchbot_ros_server.py publishes the list of
your devices and provides an action to send commands to them (press a Bot, turn on a light, an infrared remote, …);
switchbot_status_publisher.py publishes the status of one device (a meter, a plug, a bot, …) periodically.
Client libraries for rospy/rclpy and roseus are included.
System Component

JSK members can edit the original file here.
Requirements
- Install the SwitchBot app on your phone (iPhone, Android) and create your SwitchBot account.
-
Set up the SwitchBot devices with the app. Give each device a name (the
device_nameof the action) and enable the cloud service. Devices which talk Bluetooth only (e.g. a Bot) need a SwitchBot Hub to be controlled from the cloud. - Get your token and secret: in the app, open Profile > Preferences (Settings), tap the app version 10 times; the developer options show the token and the secret key. With a secret, the nodes use the SwitchBot API v1.1; without it (empty), the API v1.0. The token and the secret can be given as they are or as the path of a file of them.
For JSK members, please see this slide for the account, the token and the SwitchBots installed in our lab.
The nodes need the internet; the Python package requests (python3-requests) is used.
Usage
ROS 2
colcon build --packages-up-to switchbot_ros
source install/setup.bash
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET
# with the status publisher of one device
ros2 launch switchbot_ros switchbot.launch.xml token:=YOUR_TOKEN secret:=YOUR_SECRET \
pub_status:=true pub_device_name:=YOUR_DEVICE_NAME
See the devices and send a command:
ros2 topic echo --once /switchbot_ros/devices
ros2 action send_goal --feedback /switchbot_ros/switch switchbot_ros/action/SwitchBotCommand \
"{device_name: '/myroom/light', command: 'turnOn'}"
ros2 topic echo /switchbot_status_publisher/YOUR_DEVICE_NAME
Without the launch file:
ros2 run switchbot_ros switchbot_ros_server.py --ros-args -r __node:=switchbot_ros \
-p token:=YOUR_TOKEN -p secret:=YOUR_SECRET
ROS 1
roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN secret:=YOUR_SECRET
rostopic echo -n 1 /switchbot_ros/devices
rostopic pub -1 /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal \
"{goal: {device_name: '/myroom/light', command: 'turnOn', parameter: '', command_type: ''}}"
rostopic echo /switchbot_ros/switch/result
Launch arguments
switchbot.launch (ROS 1) and switchbot.launch.xml (ROS 2) have the same arguments:
| Argument | Default | Meaning |
|---|---|---|
token |
(required) | the token, or the path of a file of it |
secret |
'' |
the secret key, or the path of a file of it; empty uses the API v1.0 |
respawn |
true |
respawn the nodes |
pub_status |
false |
also start switchbot_status_publisher
|
pub_status_rate |
0.1 |
the rate [Hz] of the status publisher |
pub_device_name |
bot74a |
the device of the status publisher |
Interface
switchbot_ros_server.py
The node is named switchbot_ros by the launch files (switchbot when run without them).
Published topics:
-
~devices(switchbot_ros/DeviceArray, latched): thenameandtypeof your devices and infrared remotes, published once the API client is ready.
Actions:
File truncated at 100 lines see the full file
Changelog for package switchbot_ros
3.0.1 (2026-11-10)
- Merge pull request #583 from k-okada/rosdistro-55247-review rosdistro#55247 review: rename power_switching_tools_ros to jsk_power_switching_tools, fix licenses
- use SPDX license identifiers (BSD-3-Clause, Apache-2.0) in package.xml BSD -> BSD-3-Clause and Apache / "Apache License, Version 2.0" -> Apache-2.0 in all packages (ros/rosdistro#55247 review). The LICENSE files of all of them are BSD 3-Clause and Apache 2.0 respectively. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
- Contributors: Kei Okada
3.0.0 (2026-11-06)
-
Merge pull request #581 from k-okada/ros2-buildfarm-ros-environment Fix ROS2 buildfarm binary jobs: ros_environment, bundled flac, numpy wheel
-
[voicevox, chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, ros_speech_recognition, rospatlite, sesame_ros, switchbot_ros] depend on ros_environment for ROS2 buildfarm The buildfarm builds each package with only its own build dependencies, so without ros_environment $ROS_VERSION is empty and CMakeLists.txt takes the ROS1 branch (same as jsk_common#1835). voicevox also guesses ROS_VERSION from AMENT_PREFIX_PATH when it is unset. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into fix_hoya
-
Merge branch 'master' into voicevox-ros1-ros2
-
AMENT_IGNORE: do not add AMENT_IGNORE to packages already ported to ROS2 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros and switchbot_ros are already ROS2 packages on master, so this PR must not AMENT_IGNORE them. Also remove ros_speech_recognition/AMENT_IGNORE, as this PR ports it to ROS2. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
Merge branch 'master' into ros2-speech-recognition-only
-
Merge pull request #575 from k-okada/ros2-support Add ROS2 (jazzy) support to chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, respeaker_ros, rospatlite, sesame_ros, switchbot_ros
-
AMENT_IGNORE packages ported to ROS2 in jsk-ros-pkg/jsk_3rdparty#575 chaplus_ros, emotion_analyzer, gdrive_ros, google_chat_ros, influxdb_store, power_switching_tools_ros, rospatlite, sesame_ros and switchbot_ros are ROS1 only here, so the ROS2 CI skips them until #575. Co-Authored-By: Claude Opus 5.5 <<noreply@anthropic.com>>
-
[switchbot_ros] add ROS2 support Single package.xml/CMakeLists.txt branched on $ROS_VERSION, same as chaplus_ros and jsk_common's ROS2-ported packages.
- CMakeLists.txt: the ROS2 block is prepended and the ROS1 original is wrapped in else()/endif() unchanged. ROS2 generates msg/*.msg and action/SwitchBotCommand.action with rosidl_generate_interfaces(), installs src/switchbot_ros/switchbot.py next to the generated python package (rosidl already does ament_python_install_package() for the same name), and installs switchbot_ros_server.py / switchbot_status_publisher.py with a python3 shebang. ROS2 uses the system python3-requests instead of catkin_virtualenv (ROS1 only).
- msg/*.msg: Header -> std_msgs/Header (required by rosidl, equally valid for ROS1).
- switchbot_ros_server.py / switchbot_status_publisher.py: use jsk_ros1_ros2_compat's rospy_rclpy_compat (get_param, log*, Rate, is_shutdown, stamp_now), with the same rospy-forwarding fallback as chaplus_ros when jsk_ros1_ros2_compat (jsk_common >= 3.0) is not available. Latched topics use create_publisher/create_subscription (latch=True), and rospy.logwarn_once becomes ros_compat.logwarn_once. The status values from the JSON API are converted with float() for float64 fields, since ROS2 messages reject int there.
- launch/switchbot.launch.xml: ROS2 counterpart of switchbot.launch.
- The ROS2 scripts are installed with jsk_ros1_ros2_compat's jsk_ros1_ros2_compat_install_python() (python3 shebang), from jsk-ros-pkg/jsk_common#1832, as a ROS2-only buildtool_depend (>= 3.0.2) that stays off rosidl's build dependencies. Make the actionlib parts dual ROS1/ROS2 with jsk_ros1_ros2_compat (>= 3.0.2, jsk-ros-pkg/jsk_common#1831):
- switchbot_ros_server.py: ros_compat.create_simple_action_server() (actionlib.SimpleActionServer on ROS1, rclpy ActionServer on ROS2) replaces the ROS2-only ActionServer code, so execute_cb() is the same for both and the same as master except for rospy.Rate/logerr.
- switchbot_ros_client.py (SwitchBotROSClient) and
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
- launch/switchbot.launch
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]
- launch/switchbot.launch.xml
-
- token
- secret [default: '']
- respawn [default: true]
- pub_status [default: false]
- pub_status_rate [default: 0.1]
- pub_device_name [default: bot74a]