Thanks for working on this. The binding works great! I haven’t worked with java or any language since college 10+ years ago because I took my career in a different direction. But OpenHAB and this project specifically have inspired me to take up the hobby again so thank you. Although I have no experience with Eclipse/Maven and Github didn’t exist when I was in school…
More to the point, I’ve been trying to add my own effort to this project but I’m not getting very far so I figured I’d share what I’ve learned so far and hopefully it will be of some use. If you have any thoughts on how to accomplish this stuff, let me know.
I have a Roomba i7 which uses smart maps and has extra arguments it expects to see for room-specific cleaning. I’ve had no problem sending commands through node with dorita980 and javascript. I actually got the Roomba to do room-specific tasks directly after observing the MQTT broker logs and using what I found in your RoombaHandler.java and from dorita980. See below:
Javascript
...
const args = {
"ordered": 1, //Binary switch
"pmap_id": "7BWzb9_ZRNmbNZe4rkE0fw", //Main Floor
"regions": [
{"region_id": "21", "type": "rid"}, //Master Bedroom
{"region_id": "25", "type": "rid"}, //Master Bathroom
{"region_id": "20", "type": "rid"}, //Office
{"region_id": "19", "type": "rid"}, //Guest Bath
{"region_id": "1", "type": "rid"}, //Hallway
{"region_id": "22", "type": "rid"} //Living Room
],
"user_pmapv_id": "201006T004121" //MapIterationCreationDate
};
myRobotViaLocal.cleanRoom(args)
...
Based on how your code is written, I think the “start” command can still be used. I don’t think you need the cleanRoom command to execute the additional arguments. Just need to add a couple request.put lines in RoombaHandler.java under the JSONObject for CMD_CLEAN. But while trying to add that code to the binding, I hit some roadblocks. Basic syntax and operational stuff. I’m sure I could remember the proper syntax if I kept at it but the biggest challenge was simply creating the jar file. I’ve been stuck there for several days and the guides I’ve found online have not helped at all.
Ultimately, I think my contribution may be more useful by providing information rather than actually coding this, given how rusty I am. So, my findings on the Roomba i7 requests are below. I don’t think it would be too difficult to implement these but like I said, I haven’t touched Java in a long while.
Message Log
"lastCommand": {
"command": "start",
"initiator": "localApp",
"time": 1602439782,
"ordered": 1,
"pmap_id": "7BWzb9_ZRNmbNZe4rkE0fw",
"regions": [
{
"region_id": "24",
"type": "rid"
},
{
"region_id": "1",
"type": "rid"
},
{
"region_id": "19",
"type": "rid"
}
],
"user_pmapv_id": "201006T004121",
"robot_id": null,
"select_all": null
},
Definitions
-
“ordered” is a binary value to execute regions in order of appearance but it can be sent even if there is only one region in the array. I don’t see a reason to ever change this from 1 so could likely be hardcoded instead of a string.
-
“pmap_id” is the ID of the map file itself. Could probably just be a setting in the thing config like the device password
-
“regions” is an array of rooms. There are other array variables but region_id and type are all that are needed. The IDs are unique and would need to be defined and labeled in OpenHAB by the user.
-
“user_pmapv_id” is the current iteration of the map file being used for the task. It’s basically just a time stamp of it’s creation date. It should be a user-defined value as well because it may change often.
-
robot_id and select_all seem to only be defined when initiating from the remote app and should not be sent from the binding.
When you set all values to null, it performs a whole home cleaning so null should be default and we would not need to create multiple request templates. These values could possibly be discovered automatically but that would obviously require a bit more work and seems unnecessary at the moment.
I imagine the request.put lines that should be added look like the following and then just let the strings be defined elsewhere in the binding.
request.put("ordered", 1);
request.put("pmap_id", mapid);
request.put("regions", regionid[]);
request.put("user_pmapv_id", mapvid);
This is about where I left off. Me trying to stumble through creating arrays, variables, and binding config isn’t useful when I can’t even figure out how to export a jar to test. I hope this information helps add to the functionality of the binding. I’m happy to provide more info, if needed. I can perform testing for the i7 too, if that helps.
It sounds like you’re the only one working on this so I’m happy to help you out in any way moving forward. I know you said this project is now a low priority for you so just let me know when you have some more time for it and when you are able to share your thoughts. Thanks!