Planner is deprecated


#1

The planner has been deprecated, and should not be used for projects anymore (if you are building a commercial device, please note that you CANNOT use the planner in production).

More information can be found in this blog post.

Please check out these two videos:


#2

I have a copy paste bug in the code section (sometimes cant copy, never can paste anymore) …


#3

I can’t reproduce - Can you PM some information:

  • What browser are you using
  • When did it start
  • Is it still happening?

#4

Hi, just trying to get used to the new IDE, now that the planner is gone, does that means no more vimps? I presume have to write agent code in place of vimps; are the codes for previous existing vimps (like toggle, http in/out, cosm, etc) available?
Thks


#5

@kenkoknz - correct.

Luckily, agents provide a much more powerful way to do all of these things (and more).

Here’s how to do each of the things you mentioned:

Toggle (I assume you mean TickTock)
`tickTock <- 0;
function TickTock() {
// do a thing
// your code here…

// flip tick tock
tickTock = 1 - tickTock;
function.wakeup(1.0, TickTock);

}TickTock();`

HTTP In - Controlling an LED with web requests.

HTTP Out - Basic example demonstrating a POST request.

Cosm (which is know Xively - Class for sending data to Xively.


#6

Hey thanks for that beardedinventor, I have the admit that the planner is a good GUI approach and pretty clever concept, I guess that is more for beginners. A compilation or list of all useful/handy agent vimps will be really very useful resource.

Cheers,
Ken


#7

Looks like the IDE should be available as per Twitter, but I’m unable to get to it.

Edit… all good.


#8

Ok so in the new IDE how do you remove a device (impee). In the Planner you used to be able to delete a base node.


#9

http://forums.electricimp.com/discussion/1859/how-to-delete-fried-impee#Item_3


#10

I’m trying to update my code to work with the new approach for xively.

I see the reference at: https://github.com/electricimp/reference/tree/master/webservices/xively

What is not clear is should this be added to the agent code (I only see one “agent”). I would assume I could build a collection of agents for various devices. Same goes for the code, BTW. Can I have different code for each device? I have 2 temp sensors in one room. They are both referenced under one model. Both need different triggering temp thresholds so I end up editing the code; loading to device 1, then changing the code and loading to device 2.

I see the code: xivelyClient.agent.nut

Do I need to add this to my agent code, or is this already available to me? I’ve never added a full class into my IDE.

Then in my device code do I implement the new functionality by adding

`
client <- Xively.Client(“YOUR_API_KEY”);

// Create a channel and assign a value
tempChannel <- Xively.Channel(“Temperature”);
tempChannel.Set(current_temperature);

// Create a feed (replace FEED_ID with the Xively FeedID you are writting to
feed <- Xively.Feed(“FEED_ID”, [tempChannel]);

// Update Xively
client.Put(feed);
`

I already have agent code for twillio. I would expect another for Xively. Another for twitter, etc.

Sorry for my confusion…
Chris.


#11

OK. By trial and error I think I’m close.

  • all the code goes into the agent
  • the code that sends the date goes into a device.on() method
  • need to add a call in the device code using agent.send()

I added all the code from here: https://github.com/electricimp/reference/tree/master/webservices/xively into the agent code.

The class went to the bottom of my agent code.

The client <- Xively.Client("") went just above that (I assume it doesn’t matter).

I put the “Push data to a feed” code into a device.on() method:
`device.on(“TempToXively”, function(v) {
// Create a channel and assign a value
tempChannel <- Xively.Channel(“Temp”);
tempChannel.Set(format("%3.1f",v));

// Create a feed
feed <- Xively.Feed(“myfeedno”, [tempChannel]);

// Update Xively
client.Put(feed);
});`

Then finally where I had this code in the device code:
cosmWS[0].set(format("%3.1f",temp));

I changed it to:
agent.send("TempToXively", temp);

Code checks out but nothing is going to Xively, yet. BTW, I’ve found that sometimes the code checks out OK but fails to run in the device. Oh well.

Next thing to understand:
How to pass the number of the device to the correct channel. I have 2 temp devices. How do I send one temp value to Temp, and the other temp value to Temp2?

Any tips would be appreciated,
Chris.


#12

@chrisjx - by convention, all files in our github are named ___.device.nut or ___.agent.nut - which indicated whether it is device or agent code. We should really have a better example of using Xively in github though.

Since Squirrel is an interpreted language, it’s not uncommon for your code to checkout and for it to fail at runtime.

A few things - Squirrel requires class and function definitions to occur before they are called / instantiated (ie - your client <- Xively.Client("") needs to go after your class definition).

You’re going to want to create two channels:

`device.on(“TempToXively”, function(data) {
// Create a channel and assign a value
local tempChannel1 = Xively.Channel(“Temp1”);
tempChannel1.Set(format("%3.1f",data.temp1));

// Create another Channel and assign a value
local tempChannel=2 = Xively.Channel(“Temp2”);
tempChannel2.Set(format("%3.1f", data.temp2));

// Create a feed
feed <- Xively.Feed(“myfeedno”, [tempChannel1, tempChannel2]);

// Update Xively
client.Put(feed);
});`

That should get you started… I think.

I also highly encourage you to work through @Tom’s TempBug Instructable. It goes through the process of reading a thermistor, sending the value to the agent, then passing that value to Xively.


#13

Thank you. That’s what I needed…