corb555 / iot_bridge

Provides a bridge between the Robot Operating System - ROS and the OpenHAB Home-Automation system.
BSD 3-Clause "New" or "Revised" License
23 stars 10 forks source link

OpenHAB Group "ROS" is required #5

Open 130s opened 7 years ago

130s commented 7 years ago

This line with 'GROUP_NAME = "ROS"', the request URL always becomes http://%IOTSERVER_IPADDR%:8080/rest/items/ROS, which means ROS is assumed to be running on the IoT (e.g. OpenHAB) server side. I don't know if that's what we always want.

corb555 commented 7 years ago

It should definitely allow them to be on different hosts and that would probably be the normal case.

130s commented 7 years ago

Let me rephrase. Do you expect any ROS-related service running on OpenHAB side? Using a running OpenHAB2 server that I recently installed:

This made me wonder if this package currently requires a special OpenHAB module (binding? I'm not sure the right term for that) to be running on OpenHAB server side.

130s commented 7 years ago

I think figured out by myself. I think the code referred to in my first post assumes that there's a OpenHAB Group called "ROS" existent on OpenHAB server (I think that portion of code is taken from Samples REST).

I'll try to think of a way to handle both cases (with and without ROS Group).

corb555 commented 7 years ago

When you set up items in OpenHab (light switches, etc) you can put them in an arbitrary number of groups. For the iot_bridge, you place the items you want to report to ROS in the group "ROS". This allows you to have a number of IoT items being controlled by OpenHAB but only have some of them report status to ROS.

130s commented 7 years ago

Thanks for the input. I'll try to set up "ROS" group to see how that works.

While I can see that there are situations where grouping for ROS is convenient, setting up something specific to ROS on OpenHAB's would limit usecases; some users (like me) might not want to set anything related to ROS on IoT side. As I implied in https://github.com/corb555/iot_bridge/issues/5#issuecomment-309923957, I'll think of way that covers both needs and open a pull request.

130s commented 7 years ago

Thanks for the input. I'll try to set up "ROS" group to see how that works.

After having created ROS group on openHAB, though, running script, which tries to access http://my_ohserver:8080/rest/items/ROS_status/state, leads to 404.

This line requests ROS_status.

Is *_status supposed to be set by openHAB automatically (if this is the case I still need learn openHAB)?

Modifying code to remove _status still doesn't work; http://my_ohserver:8080/rest/items/ROS/state leads to "bad request". Opening that page results in "NULL".

corb555 commented 7 years ago

On OH1, it should be: /rest/items/ROS. I used the documentation from here:
https://github.com/openhab/openhab1-addons/wiki/Samples-REST