No version for distro humble showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro jazzy showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro kilted showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro lyrical showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro rolling showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro github showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro galactic showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

No version for distro iron showing melodic. Known supported distros are highlighted in the buttons above.

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange

Package Summary

Version 3.0.1
License BSD-3-Clause
Build type CATKIN
Use RECOMMENDED

Repository Summary

Description
Checkout URI https://github.com/jsk-ros-pkg/jsk_3rdparty.git
VCS Type git
VCS Version master
Last Updated 2026-11-13
Dev Status DEVELOPED
Released RELEASED
Contributing Help Wanted (-)
Good First Issues (-)
Pull Requests to Review (-)

Package Description

use switchbot with ros

Maintainers

  • Kei Okada
  • Yoshiki Obinata

Authors

  • Yoshiki Obinata

switchbot_ros

This is the package for using switchbot by ROS.

System Component

Screenshot from 2021-07-17 12-43-06 JSK members can edit the original file here.

How to use?

Setup switchbot

  1. Install the switchbot app to your phone(iPhone, Android) and create your switchbot account.
  2. Prepare the switchbot devices and setup by your phone.

Especially, please set your device name and enable cloud service.

  1. Get your token
    On switchbot App, profile -> settings, and press version for 10 times and you can get token.

For JSK members, please see this slide for account and token details and installed switchbots for our lab.

How to launch switchbot ros

Execute roslaunch switchbot_ros switchbot.launch token:=YOUR_TOKEN and publish ActionGoal.

ROS API

The switchbot_ros node provides APIs below.

~/devices topic ( Type: switchbot_ros/DeviceArray )

This topic provides devices list available with switchbot_ros server.

~/switch action ( Type: switchbot_ros/SwitchBotcommandAction )

This action provide command interface to switchbot devices.

From command line

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/eng2/7f/73b2/test/button'
  command: 'press'
  parameter: ''
  command_type: ''"

rostopic pub /switchbot_ros/switch/goal switchbot_ros/SwitchBotCommandActionGoal "header:
  seq: 0
  stamp:
    secs: 0
    nsecs: 0
  frame_id: ''
goal_id:
  stamp:
    secs: 0
    nsecs: 0
  id: ''
goal:
  device_name: '/myroom/light'
  command: 'turnOn'
  parameter: ''
  command_type: ''"

Please see here for command details.

Client libraries

There are rospy/roseus client libraries for switchbot_ros server.

roseus

(setq msg (get-devices)) ;; get device list
(dolist (device (send msg :devices)) (format t "name: ~A, type: ~A~%" (send device :name) (send device :type))) ;; print device list
(control-device "/eng2/7f/73b2/light/upper/switch" "turnOn") ;; control some device
(control-device "/eng2/7f/73b2/light/lower/switch" "turnOn")

rospy

```python import rospy from switchbot_ros.switchbot_ros_client import SwitchBotROSClient

rospy.init_node(‘hoge’) client = SwitchBotROSClient()

devices = client.get_devices() print(devices)

File truncated at 100 lines see the full file

CHANGELOG

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

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]

Services

No service files found

Plugins

No plugins found.

Recent questions tagged switchbot_ros at Robotics Stack Exchange