Making my first plugin : ThinkingCleaner for Roomba

Plugins that users have built. NOTE: plugins that were developed for Indigo versions older than 2022.1 will have to be updated to work with Indigo 2022.1 (Python 3 - see this blog post for details). If the plugin listed here is not in the Plugin Store (which will show updated plugins) then you will need to ask on the appropriate thread below if it has been updated and where you get get the update.
User avatar
haavarda
Posts: 702
Joined: Sat Aug 18, 2012 4:40 am
Location: Norway

Making my first plugin : ThinkingCleaner for Roomba

Post by haavarda »

Since it doesn't look like anyone else has made or shared a plugin for the thinkingcleaner wifi add on for roomba, I am going to try for my self.
This will then be my first plugin, so I hope someone can point me in the right direction.

The thinkingcleaner has a well defined (in my opinion) API that can be found here : http://www.thinkingcleaner.com/setup/api/#API
As far as I can see sending commands can be done through sending a "http command"

Example:

Code: Select all

Clean
This command starts a cleaning cycle like pressing the 'Clean' button on the Roomba. When Roomba is
sleeping this command will wake Roomba first and execute the Dock command. When Roomba is cleaning,
this command will stop the Roomba.
Example:
http://thinking.local/command.json?command=clean
returns:
{
 "action" : "clean",
 "result" : "success
}
So I thought I should start playing around a little with this. I have also gone through the Indigo documentation: http://wiki.indigodomo.com/doku.php?id= ... ugin_guide

So my first question is what software is recommended for this kind of programming? And if anyone has some useful tips, please share them :)
Håvard
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by howartp »

Are you Mac or Windows?

Use the integrated scripting shell from Indigo to test lines of code live. Eg exploring the return value of that example, so you know your URL call is correct, and you can parse the JSON. Quicker than re-running your plugin every few lines.


Sent from my iPhone using Tapatalk
User avatar
haavarda
Posts: 702
Joined: Sat Aug 18, 2012 4:40 am
Location: Norway

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by haavarda »

I am on a mac. And I dont understand what you are saying about the JSON
So there you have my level for this project :)
Håvard
User avatar
jheddings
Posts: 149
Joined: Sun Dec 01, 2013 10:26 pm
Location: Denver, CO

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by jheddings »

All plugins are done in Python. A nice advantage of this approach is that you can use any text editor you like and even make changes to your plugin on the fly. The best way to get started is use the SDK, which contains plugin examples. Many of the plugins you would want to create can be derived from those examples.

Also, be sure to study the Plugin Tutorial carefully... There is a lot of good information in there.
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by jay (support) »

haavarda wrote:So I thought I should start playing around a little with this. I have also gone through the Indigo documentation: http://wiki.indigodomo.com/doku.php?id= ... ugin_guide

So my first question is what software is recommended for this kind of programming? And if anyone has some useful tips, please share them :)
Note: the link above is to the Indigo 5 docs, so you'll want the Indigo 6 version.

As others have pointed out, plugins are just a structured directory with some files in it. For simple plugins, I use BBEdit (though TextWrangler would work as well) and for more complex plugins I use PyCharm - it's not cheap, but is an amazingly good Python IDE. Any plain text editor will work - just make sure it's meant for plain text editing so it doesn't do things like make quotes smart, etc. (TextEdit is not particularly good because it wants to do rich text).
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by howartp »

haavarda wrote:And I dont understand what you are saying about the JSON
So there you have my level for this project :)
Don't take this wrong, but you're going to have fun then!

However the sense of achievement when you publish the plugin and others start using it will be worth the time you've put into it.

When I started the Evohome plugin, I'd forgotten about the scripting shell you can launch from indigo. I was therefore writing code in my plugin that retrieved an object from Honeywell containing data about my thermostats, then having it write the data in the object to the log so I could see what it contained. Then write some more code to do something with it, then save and update my plugin to test it. Again. And again. And a few more times for good measure.

With the scripting shell, I could explore the object live, seeing what it contained, trying things, then when I got the data I wanted (temperature) I could just copy the necessary lines of code into my plugin, once, and test it.

(Note for any devs following, yes I could and did use the Python terminal straight up, but that meant keeping a separate set of code to load and save variables from IPH every time I logged in)


Sent from my iPhone using Tapatalk
User avatar
haavarda
Posts: 702
Joined: Sat Aug 18, 2012 4:40 am
Location: Norway

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by haavarda »

I have found a Python code on GitHub that communicates with the thinkingcleaner.
https://github.com/edent/ThinkingCleane ... /roomba.py
I will remove the twitter part, and instead update the indigo device. Can someone have a quick look at that code and see if there is any immediate problems?

Is for instance the libraries below supported?

import json
import requests
import sys
import os
import locale

It is referred to a json file. Is this a file that is stored with the plugin? Or is this a temp file?
Håvard
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by jay (support) »

There are a few things to consider: first, the json module wasn't included until Python 2.6 (which is only explicitly used with Indigo 6.1 and greater). However, we included it's predecessor with Indigo. So, if you put this at the top of the Python file in your plugin, json will work either way:

Code: Select all

try:
    import json
except:
    import simplejson as json
Next, the requests library isn't included with Python, so you'll either need to instruct your users to install it first, or possibly include it with your plugin. I'm not sure if it's pure Python or not (I think it is) so including it would probably work with a little effort. Note, however, that it requires Python 2.6, so your plugin would be limited to Indigo 6.1+.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by howartp »

I include Requests with my Evohome plugin, but I've not tested earlier releases of Indigo.


Sent from my iPhone using Tapatalk
keifer1
Posts: 87
Joined: Sun Oct 21, 2012 11:02 am

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by keifer1 »

The link on thinking cleaner web site is not active.

http://www.thinkingcleaner.com/setup/api/#Indigo

Indigo Domotics:Indigo domotics
For indigo (http://www.indigodomo.nl) a plugin is in development.

FYI. Thanks for the work , lets roomba
Computer Keith
Mt Pleasant SC - Charleston
Indi-Go -Go-Go
keifer1
Posts: 87
Joined: Sun Oct 21, 2012 11:02 am

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by keifer1 »

Check this thread out:

http://forums.indigodomo.com/viewtopic. ... ba#p107117

tenallero wrote:
Hi,

Apologies to be so late.

This link points to the documentation about my Roomba plugin:
https://www.dropbox.com/s/9ghepfwbxdaw0 ... plugin.pdf

Inside you will find the link to download the code and setup instructions.

Some notes about it:
English is not my language. So, apologies about any linguistic incorrection.
I have publish it as a PDF file, because I have not found the correct way to do it as a readable forum entry (mainly about including pictures from my desktop)
The code is open. I will find the way to publish it on github or similar.
This plugin is my first Indigo's plugin and my first lines of python code. I would like to thank to Dan Noguerol (https://bitbucket.org/whizzosoftware/in ... ddy-plugin), because his work around "irrigation caddy plugin" give me inspiration and confidence to start coding a python plugin for Indigo.
Also congratulate Matt and Jay with the well done work with Indigo. It has been a nice experience to develop an Indigo plugin and collaborate with Matt testing some Fibaro's zwave devices.


Stoffergoffer, you opened the thread. Next point will be about XBMC and PiFace plugin.

Regards,

Ramon
Computer Keith
Mt Pleasant SC - Charleston
Indi-Go -Go-Go
keifer1
Posts: 87
Joined: Sun Oct 21, 2012 11:02 am

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by keifer1 »

Their were some great under counter pics of the rumbas hiding place .
Computer Keith
Mt Pleasant SC - Charleston
Indi-Go -Go-Go
User avatar
haavarda
Posts: 702
Joined: Sat Aug 18, 2012 4:40 am
Location: Norway

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by haavarda »

I have been through the thread in the forum post above. And at the bottom you can see that I have asked if the user can share his plugin.
None of the dropbox links above seams to be working. I also think that tenallero posted his old plugin, not the one for thinkingcleaner.
Håvard
User avatar
jay (support)
Site Admin
Posts: 18420
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by jay (support) »

keifer1 wrote:Indigo Domotics:Indigo domotics
For indigo (http://www.indigodomo.nl) a plugin is in development.
We don't own http://www.indigodomo.nl - nobody does. I think whoever submitted it to them needs to update it to http://www.indigodomo.com/
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
keifer1
Posts: 87
Joined: Sun Oct 21, 2012 11:02 am

Re: Making my first plugin : ThinkingCleaner for Roomba

Post by keifer1 »

Hear is a link to some of his original posts. I'm will look to see if I have a copy of the plugin. Never ordered the wifi but your post reminded me of it. Looking forward to testing your plugin, going to order the wifi fi adapter.

Think this still works. Show under cabinet install.
https://www.dropbox.com/sh/3dz6mbrwyw9nlyu/HqSKh_b_YY
Computer Keith
Mt Pleasant SC - Charleston
Indi-Go -Go-Go
Post Reply

Return to “User Plugins”