Mac users! ‘Squinter’ utility for managing device, agent code and libraries

Mac users, here’s a little utility to try if you do your code development in a text editor and you want to make use of library code files that are separate from your agent and device source files.

You can add libraries to your source code by adding a line like this:

#import </Users/[username]/Documents/ht16k33.class.nut/>

and the utility, Squinter, will run through the source (agent first, then device), find the #import, load up the library code and paste it in ready for you to copy the ‘compiled’ source into the Electric Imp IDE. Your source files remain untouched, for ease of editing.

Squirrel treats # as a comment marker, so the above line will not affect your running Squirrel code should you paste ‘uncompiled’ code into the IDE.

Squinter lets you save agent and device source code combos as projects for easy opening next time, and it lets you open your source and library files in your favourite text editor or whatever app you have set to handle .nut files.

There are some limits: agent and device source files need to be in the format: ‘someproject.agent.nut’ and ‘someproject.device.nut’. Libraries should be named 'somelibrary.class.nut’ or 'somelibrary.library.nut’. You can add one or both of these files to an existing project, or use a pair of them to create a new project.

You will need to allow your Mac to open ‘apps downloaded from anywhere’ (in the Security & Privacy prefs), and you’ll need Mac OS X 10.9.

As always with free software (pre-release code in particular), you use Squinter entirely at your own risk. There will be bugs; please do post notifications of them when you get bitten by one.

Note: the file is a .gz file containing a .zip archive. If it opens as a plain document, just double-click the extracted file to reveal Squinter.

is there any possibility you could show us (video, google hangout, or tutorial) to show us how you are doing development with the imp? It would really help us. Thank you

Of course, @snowbiker100, but first what aspect of ‘doing development with the imp’ are you interested in? That covers a lot of possibilities - can we narrow it down a bit? There may already be some documentation which meets your needs, for instance.

I did read the interface documentation. I created several models, but I continuously overwrite my code. I have resorted to copying my code out and pasting it into a separate editor. I find this to be extremely unproductive for me. You obviously have a much better way of dealing with these programs.

I would love to have a Google Hangout where you show us how you are doing your development. Even better would be a multipart series so we can get experience building a real application with Electric Imp tools and IDE. Do you think that is possible?

The application I’m trying to build is a smart home with the electric imp at the center and other sensors around the house sending messages. I do a lot of work with Arduino and I want to interface the NRF. There seems to be a great example here (if I can get it working the way I need as a messaging receiver):

I also want to integrate with: and (the idea is to abstract the messages from the behaviors)

The user experience I’m after is a series of messages with varying levels of warnings. If the warning message critical enough I will get a text or cell phone call from twilio. below are some simple messages I intend to send and receive using the electric imp as the hub:

The Talking House:

  1. there is water in the basement in section X
  2. weather calls for temperatures below 50° and window number X is open
  3. plants in section X need water current moisture level at Y
  4. unexpected movement detected in section X after threshold hours
  5. garage door number X is open after threshold hours
  6. house door open or unlocked after threshold hours
  7. temperatures in section X below/above threshold
  8. smoke/fire/ carbon dioxide detected in section X
  9. television/radio/item X in section Y left on after threshold hours
  10. and many more

Of course all of these messages would be associated with some code managed in an AWS database so I can easily add and modify them.

thank you @smittytone,

snow biker

@snowbiker100 - I’ve been kind of working on an Electric Imp video tutorial series, but I’m too much of a perfectionist and video editing takes a long time.

Maybe instead I’ll do some live coding Google Hangouts where I go through what I’m working on, and let people ask questions, etc

Would you (and other people) be into such a thing?

@beardedinventor I would be happy to help edit the videos if you want to to the tutorial series. I know a number of developers that would love to use the Imp, but need to move beyond the “Hello World” to be productive. You are far ahead and it would be very helpful.

Absolutely! I would really appreciate that type of effort. I can see many people making some great projects with the Imp, but the fundamentals are critical to be productive. Thank you. Please let me know when you think we can start.

One quick point, @snowbiker100: if you overwrite your code, you can always get it back using the ‘Build xxx’ menu. This lets you access previous builds, any of which can be copied into a new build. I find this handy for experimenting: change code, test, reject, go back to the build before the change.

Thanks @smittytone that is a good tip. I am not sure I understand the relationship between models and the link to devices. I seems to have multiple models linked to the same device. I am also challenged by the UI as a sublime user. I would really love to be more productive with the interface.

Each device can be associated with only one model, but each model can have multiple devices assigned to it. This is why devices are listed by model, not the other way round.

Case in point: I have one digital clock model, but four devices (two in the office, two at home) running that model. So the Model Navgator (the IDE’s left-hand column) lists those four devices under the single banner of the model name.

You can write the agent and device code - the software units that together comprise a model - anywhere you like. I usually write in TextWrangler and then copy and paste into the IDE. The problem is, I then tweak in the IDE and the two copies quickly get out of sync! But that’s just bad discipline on my part.

Squinter is handy because it lets me keep class files separate from the main body of the agent code and the device code. We’re working on an API which will allow other apps to communicate with the IDE server, in turn allowing agent and device code to be uploaded rather than pasted in. There’s no fixed release date for this yet, but it will allow apps like Squinter to become the focus of development so the IDE can be left behind.

I’ve attached the latest version which, more helpfully allows all the files associated with a project to be opened at once in the text editor Mac OS X has associated with text files.

@smittytone can you do a quick screen cast to show us how you use Squinter?
Would be very much appreciated. Thank you

@smittytone I love the idea of the API I think that will really open up the Imp to many more developers.

Latest Version (0.5.02)

@smittytone - Is Squinter Open Source? I’ve found but I’d like to draw some inspiration from some of Squinter’s other features if the source code is available.

Also, I was able to download and run Squinter - but curiously I had to do it with 7-Zip on my Windows VM to get it to extract correctly on my mac…

I’m not planning to open-source Squinter just yet, @deldrid1, but this may change when it’s nearer to completion.

Not sure why the gz-ing isn’t working right, but on a Mac, double-click the .gz file. Then add .zip to the resulting file, it will then unzip correctly. Possibly a cock-up on my part.

Updated version attached.

Massively updated new version. Supports Electric Imp libraries as well as your own local ones; does log streaming; more UI customisation; greater stability; support for latest version of the Build API.

@smittytone - glad to see this is continuing to progress!

Any thoughts on creating an Atom plugin instead of creating your own text editor? The team over at did exactly that, see

With the build API this should be pretty straight forward, I’ve just not had the time to devote to it…I did create a repo -

Folks, there’s a new version of Squinter available:

Mostly bug fixes, and I’ve reverted to official terminology: ‘models’ not ‘apps’.

Maybe now I can get round to doing propers documentation etc.

And another one:

Minor code changes; completely revised Help system - see the appropriate menu.

New version: