How to begin creating a Roomba wifi remote plugin?

Hi chuck1026,

very excited to see this - did not even know was possible. I use IR blaster to do similar things but not great result - this would be an ideal soloution for sure. many thnaks for getting this underway - look forward to see how things progress.

LightOn

Reading this http://burtonini.com/computing/gupnp-docs/server-tutorial.html and trying to learn…

Chuck

Careful: there are many cases where that doc will describe something similar-but-different from what the Vera expects, so don’t take it as gospel.

More confused ???

Try to find some example plugins on code.mios.com. Some good examples that helped me were WOLPlusPing, WPSwitch and RTCOA_Wifi. Download the code and study it bit by bit, google around for keywords, mine the MiCasaVerde wiki, and it will start to take shape.

watou

I still don’t understand how I create a uuid?

I never had to create a UUID in the Nest plugin. What documentation are you looking at?

Hello Chuck,

You do not require the UUID, so skip past this.

http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand

Break it down into smaller packages of work you need to do/achieve and it should make it easier for you to find answers.

[quote=“Brientim, post:28, topic:174190”]Hello Chuck,

You do not require the UUID, so skip past this.

http://wiki.micasaverde.com/index.php/Luup_Plugins_ByHand

Break it down into smaller packages of work you need to do/achieve and it should make it easier for you to find answers.[/quote]

Is there a way to test the “chunks” and is there a way to see what the GUI will display?

Thanks for the tips by the way. Stinks being a Newbie to Luup/Lua :-[ . Took BASIC and FORTRAN like 30 years ago and used to program a TI-99/4A in the same time frame!

Is there a service for a momentary switch? I sure could use one for my three mode switches (clean, spot and dock)…

Is a momentary switch in this case semantically identical to simply calling an action? A persistent or “stateful” switch is represented well enough by the SwitchPower service, but I think you are just looking for calling actions for clean, spot and dock. Maybe I’m missing something, though.

Is a momentary switch in this case semantically identical to simply calling an action? A persistent or “stateful” switch is represented well enough by the SwitchPower service, but I think you are just looking for calling actions for clean, spot and dock. Maybe I’m missing something, though.[/quote]

If I call an action, how do I create the “button (s)” and label it (them)? Still miles off but inching forward. More reading and searching and stumbling over some “dead ends”.

What is a good way to test some programming?

Go into your Vera web UI to Apps → Develop Apps → Luup files and download D_BinaryLight1.json for example. Read through the file and find the “Control” section. You will see the On and Off buttons for lights there. They probably shouldn’t be part of a ControlGroup since they are not acting like on/off radio buttons like you would have for a light switch, but a lot of the rest of it should be helpful in making your own D_Roomba.json file. Download other D_*.json files for lots of other examples.

I downloaded a Lua command-line interpreter for my desktop OS when I was first starting to get comfortable with it. You could end up with a fully functioning Roomba.lua program for testing purposes, and then copy over bits into your I_Roomba.xml file (or make a Lua module and put the code there). Should make for a quicker edit/test loop than uploading new I_Roomba.xml and restarting every time.

I hope this helps!

watou

Marching on thanks to watou :slight_smile:

Go Chuck!

One minor note: to be consistent with other things, you probably want to name your files like I_Roomba1.xml, D_Roomba1.json, etc. I keep forgetting about the “1” in the file names, and don’t want to add confusion. :slight_smile:

[quote=“watou, post:35, topic:174190”]Go Chuck!

One minor note: to be consistent with other things, you probably want to name your files like I_Roomba1.xml, D_Roomba1.json, etc. I keep forgetting about the “1” in the file names, and don’t want to add confusion. :)[/quote]

Renamed files as suggested. Have not found a good interpreter for Windows 7 yet. Guess I need to look harder. How can I run and preview json files to see the graphics? That would be helpful!

So how am I doing so far (with much spoon feeding)??? Stiull no idea how to handle the json file!!! Ugh.

My IP changed to 192.168.1.10 so I killed of the dynamic IP and locked Roomba in at this one (in case you’re wondering why 192.168.1.13 went away) .

Roomba_S

<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <actionList>
    <action>
      <name>Clean</name>
      <argumentList></argumentList>
    </action>
    <action>
      <name>Spot</name>
      <argumentList></argumentList>
    </action>
    <action>
      <name>Dock</name>
      <argumentList></argumentList>
    </action>
  </actionList>
</scpd>[/code]

Roomba_D
[code]<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:schemas-micasaverde-com:device:receiver:1</deviceType>
    <staticJson>D_Roomba.json</staticJson> 
    <friendlyName>Roomba</friendlyName>
    <manufacturer>iRobot</manufacturer>
    <manufacturerURL>http://www.iRobot.com</manufacturerURL>
    <modelDescription>Roomba</modelDescription>
    <modelName>700 Series</modelName>
    <modelNumber>790</modelNumber>
    <UDN>uuid:</UDN>
    <protocol>raw</protocol>
    <handleChildren>1</handleChildren>

    <implementationList>
        <implementationFile>I_Roomba1.xml</implementationFile>
    </implementationList>

    <serviceList>
      <service>
        <serviceType>urn:schemas-upnp-org:service:SwitchPower:1</serviceType>
        <serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
        <SCPDURL>S_SwitchPower1.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:micasaverde-com:service:DiscretePower:1</serviceType>
        <serviceId>urn:micasaverde-com:serviceId:DiscretePower1</serviceId>
        <SCPDURL>S_DiscretePower1.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:micasaverde-com:service:InputSelection:1</serviceType>
        <serviceId>urn:micasaverde-com:serviceId:InputSelection1</serviceId>
        <SCPDURL>S_InputSelection1.xml</SCPDURL>
      </service>

      <service>
        <serviceType>urn:micasaverde-com:service:MenuNavigation:1</serviceType>
        <serviceId>urn:micasaverde-com:serviceId:MenuNavigation1</serviceId>
        <SCPDURL>S_MenuNavigation1.xml</SCPDURL>
      </service>
    </serviceList>
  </device>
</root>

Roomba_I

[code]

<?xml version="1.0"?> function init(x) end -- well, not really but roughly init urn:chuck-org:serviceId:Roomba1 Clean luup.inet.wget("http://192.168.1.10/roomba.cgi?button=CLEAN") urn:chuck-org:serviceId:Roomba1 Spot luup.inet.wget("http://192.168.1.10/roomba.cgi?button=SPOT") urn:chuck-org:serviceId:Roomba1 Dock luup.inet.wget("http://192.168.1.10/roomba.cgi?button=DOCK") [/code]

You’re getting there! If I were you I would strip away any services you don’t yet need, and add them in after you have the basics working. Do you plan on having just one device represent just one Roomba? If so, you won’t have child devices so change 1 to 0. Also make sure all your file names are 1) of the proper form, and 2) your references to them in other files are correct. Sadly, programming is not enough like horseshoes and hand grenades.

Keep going, Chuck!

watou

Very helpful watou!

I am pretty sure I will want to add children later (sensors or other indications of operation available from the Roomba API) but for now I “0-ed” it out.

I had noticed after I posted I had other syntax errors to fix. I bet I am looking through a bunch but once I start testing / debugging they will show themselves. Computers are just so binary, LOL.

Now HOW do I write a json file? Don’t I need graphics ???

Hi Chuck,

Just offering further support! keep at it :slight_smile:

I am just about to purchase a board and reside in the UK so very very excited to see how you get on. I think I will use it in Vere in lost of ways but most likel to ensure a clean is only activated when the home alarm is not on and for it to take place ASAP after last clean time missed etc. Lots of possibilities outside of just schedulaed clean etc.

Realy excited wityh you and all on this project - just wish i coudl add more help on the codeing side ???