[Documentation] [TitleIndex] [WordIndex

Only released in EOL distros:  

Package Summary

The iot_bridge provides a bi-directional bridge between ROS and the OpenHAB Home Automation system. This allows a ROS robot to connect to a vast variety of IoT devices such as motion detectors, Z-Wave devices, lighting, door locks, etc.

Package Summary

The iot_bridge provides a bi-directional bridge between ROS and the OpenHAB Home Automation system. This allows a ROS robot to connect to a vast variety of IoT devices such as motion detectors, Z-Wave devices, lighting, door locks, etc.

Package Summary

The iot_bridge provides a bi-directional bridge between ROS and the OpenHAB Home Automation system. This allows a ROS robot to connect to a vast variety of IoT devices such as motion detectors, Z-Wave devices, lighting, door locks, etc.

Package Summary

The iot_bridge provides a bi-directional bridge between ROS and the OpenHAB Home Automation system. This allows a ROS robot to connect to a vast variety of IoT devices such as motion detectors, Z-Wave devices, lighting, door locks, etc.

Overview

The IoT Bridge provides a bridge between ROS and the openHAB Home-Automation system.

Connect your robot to the wider world

With the iot_bridge, any openHAB device can be easily setup to publish updates to the iot_updates topic in ROS, giving a ROS robot knowledge of any Home Automation device. ROS can publish to the iot_set topic (or iot_command) and the device in openHAB will be set to the new value (or act on the specified command).

Different access to REST APIs of openHAB 2 and openHAB 3

There is a different access to the REST APIs of openHAB 2 and openHAB 3. Specifically, this means that the header has changed.

The iot_bridge for openHAB 2 can be found at https://github.com/corb555/iot_bridge. For openHAB 3 there is a fork at https://github.com/Michdo93/iot_bridge.

Installing

  1. Install openHAB from openhab

  2. Install iot bridge for openHAB 2 or iot bridge for openHAB 3 on the ROS system:

    • Go to iot bridge for openHAB 2 or iot bridge for openHAB 3 and find the GIT clone address

    • On your ROS system:
              cd catkin_ws/src
              git clone address-from-above
              cd ..
              catkin_make
  3. Edit iot_bridge/config/items.yaml:
    • Update host address and port to match your openHAB server
  4. Edit openHAB's item file
    • Create the ROS group: Group ROS (All)
    • Add the (ROS) group to each item that should send status updates to ROS.

Note that the items must be directly in a (ROS) group, not in a sub-group of the (ROS) group. Note, this is only needed for status updates to go from openHAB to ROS - you can send commands from ROS to any openHAB item regardless of what group it is in.

Sample Open_HAB item definition:

NOTE: you must have two or more items defined in the ROS group.

Group ROS (All)
String ROS_Status "ROS [%s]"
Switch Light_GF_Corridor_Ceiling  "Ceiling"  (GF_Corridor, Lights, ROS)
Switch Light_GF_Bathroom (GF_Bathroom, Lights, ROS)

Launch

  1. Launch
    • roslaunch iot_bridge iot.launch

  2. Test:
    • Test receiving from openHAB
      • In your browser, go to http://localhost:8080/rest/items/ROS

      • You should see an XML response with the state of the items you have put in the ROS group
      • In the console, type
               rostopic echo /iot_updates
      • Bring up the openHAB demo site in your browser and change an item in the ROS group
      • You should see the new state in the rostopic echo console
    • Test sending to openHAB
          cd catkin_ws/src/iot_bridge/scripts
          ./iot_test  item_name item_value
      • You should see the message logged where you did the roslaunch.
      • If you have the openHAB demo site in your browser, you should see the item you named changed to your specified value.
      • The value must be valid for that device (number, or ON/OFF, or OPEN/CLOSED). See openHAB/items for a summary of valid values.

  3. Statistics
    • You can place the ROS_Status item in your openHAB sitemap. It will display the
    • time of the last update (to nearest minute) and counts of messages and errors.
    • Place the following in demo.sitemap:
      •            Text item=ROS_Status label="ROS [%s]"

Interfaces

Send a Command to an openHAB item

When iot_bridge receives a name/value pair from the ROS iot_command topic, it publishes those to openHAB and openHAB sends that command to the device specified. The value must be valid for that device. See openHAB/items for a summary of valid values.

For Example:

A ROS program wants to turn on a ceiling light. It publishes the following to the iot_command topic:

This will turn on the Ground Floor Corridor ceiling light. See sample code in iot_test.

Set Status for an openHAB Item

When the iot_bridge receives a name/value pair from the ROS iot_set topic, it publishes those to openHAB and openHAB updates the status for the item specified (e.g. indicate that a switch is now ON).

For Example:

A ROS program running Facial Detection detects that Sarah is present. It publishes the following to the iot_set topic:

This will set the facedetection item in openHAB to Sarah, indicating Sarah has been detected. See sample code in iot_test.

Receive item updates from openHAB

The IoT bridge receives updates from openHAB and publishes those as name/value pairs to the iot_updates ROS topic.

To see updates from the command line, type:

rostopic echo iot_updates

For example: A motion detector is triggered in openHAB. The openHAB bridge will publish the following to the iot_updates topic in ROS

Request Refresh of all Item states

ROS topic subscribed by iot_bridge:

For Example:

A ROS program publishes the following to the iot_command topic:

openHAB will send the current status of every item in the (ROS) group to the iot_updates topic. Subsequent status will continue to send only when they change.

An example for each item type

If you want to test e.g. ROS and openHAB, but have not yet installed the corresponding devices and items, you can try the Static Examples. These are so-called unbound items for each item type of openHAB.

Bug Reports & Feature Requests

Use GitHub to report bugs or submit feature requests.

We appreciate the time and effort spent submitting bug reports.


2024-11-16 14:40