Fibaro Home Center 2 Plugin

Thanks and special mention to Jelle Kalf for the development made and this plugin!

Following the steps shown below you can control your Roomba through Fibaro Home Center 2 and RooWifi:

Step 1

Create a virtual device, in this case we will call it Roomba:

Fibaro Home Center 2 Creating New Virtual Device for RooWifi Roomba Wi-Fi Adapter

Step 2

Create four simple buttons for Clean, Dock, Spot and to know the Charge status, let’s call it Status.

Step 3

The last step, then, the only that you need to do is attach the following scripts to the buttons created in the previous step and remember to change the IP 111.222.333.444 for the IP assigned that you assigned to your RooWifi: Wi-Fi Adapter and…That’s All!

Script for CLEAN Button

-- Setting up the connection data
  ROOMBA = Net.FHttp("111.222.333.444", 80)

-- geting info about specific device
  response = ROOMBA:GET("/roomba.cgi?button=CLEAN")

-- decoding json string to table
  result = response;
  Fibaro.log(result);

 Script for DOCK Button

-- Setting up the connection data
  ROOMBA = Net.FHttp("111.222.333.444", 80)

-- geting info about specific device
  response = ROOMBA:GET("/roomba.cgi?button=DOCK")

-- decoding json string to table
  result = response;
  Fibaro.log(result);

Script for SPOT Button

-- Setting up the connection data
  ROOMBA = Net.FHttp("111.222.333.444", 80)

-- geting info about specific device
  response = ROOMBA:GET("/roomba.cgi?button=SPOT")

-- decoding json string to table
  result = response;
  Fibaro.log(result);

Script for STATUS Button (Charge Status)

-- Setting up the connection data
  ROOMBA = Net.FHttp("111.222.333.444", 80)

-- geting info about specific device
  response = ROOMBA:GET("/roomba.json")

-- decoding json string to table
  extractedjson = json.decode(response)

-- Special usecase of [""] for json tree items with a - in it.
-- Be aware not to use a . infront of the [ !!
-- The following JSON codes can be extracted
-- All that needs to be done is replace the rX value and rename the variable to whatever you liek
--
-- "r0": "Bumps Wheeldrops"
-- "r1": "Wall"
-- "r2": "Cliff Left"
-- "r3": "Cliff Front Left"
-- "r4": "Cliff Front Right"
-- "r5": "'Cliff Right'"
-- "r6": "Virtual Wall"
-- "r7": "Motor Overcurrents"
-- "r8": "Dirt Detector - Left"
-- "r9": "Dirt Detector - Right"
-- "r10": "Remote Opcode"
-- "r11": "Buttons"
-- "r12": "Distance"
-- "r13": "'Angle'"
-- "r14": "Charging State"
-- "r15": "Voltage"
-- "r16": "Current"
-- "r17": "Temperature"
-- "r18": "Charge"
-- "r19": "Capacity"
  motorovercurrents = extractedjson.response.r7.value
  distance = extractedjson.response.r12.value
  chargingstate = extractedjson.response.r14.value
  voltage = extractedjson.response.r15.value
  current = extractedjson.response.r16.value
  temperature = extractedjson.response.r17.value
  charge = extractedjson.response.r18.value
  capacity = extractedjson.response.r19.value

-- output to resultline and globalvariable
  fibaro:log(charge)
  fibaro:setGlobal("roombacharge", charge);

This is how you can have a basic control of your Roomba with RooWifi integrated with Fibaro Home Center 2 easyly and working pretty well.

Picture in Fibaro Home Center 2:

Roomba Fibaro Home Center 2 With RooWifi

Other developments in progress in this forum: Domotique Fibaro fr