Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

smittytone

About

Username
smittytone
Joined
Visits
1,458
Last Active
Roles
Member, Administrator

Activity

  • Smarter
    Hi smittytone,

    Have been using squinter for a while and now suddenly it crashes whenever I attempt to retrieve a list of models from the server (guessing I now have too many or a name too long perhaps?)

    It seems to be after retrieval of the models and instead upon acquiring devices:

    Application Specific Information:
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull compare:]: unrecognized selector sent to instance 0x7fff7bd15780'
    abort() called

    Are you able to help with this?

    Many thanks
    May 2016
    • smittytone
      smittytone
      Yeah. I think this is a Build API issue. I got caught by this too. It's worked around in the latest build, 110, which I just linked to in the forum (https://forums.electricimp.com/discussion/2869/mac-users-squinter-utility-for-managing-device-agent-code-and-libraries#latest)
    • smittytone
      smittytone
      PS. This seems to related to a recent code update: can you get me the offending device’s ID please?
  • arielslyz
    Hello..can help me?I was stuck at your coding for turning on desktop computer

    function requestHandler(request, response) {
    try {
    if ("switch" in request.query) {
    // 'switch' is a URL-encoded parameter, ie. '?switch=1'
    local state = request.query.switch;

    if (state == "on" || state = "1") state = 1;
    if (state == "off" || state = "0") state = 0;

    // Use the 'response' object to acknowledge reception of the request
    // to the request's source. '200' is HTTP status code for 'OK'
    response.send(200, "Setting received and applied");

    // Send the command to the device
    device.send("change.switch.state", state);
    } else {
    response.send(200, "Unknown command");
    }
    } catch (error) {
    // Something went wrong; inform the source of the request
    // '500' is HTTP status code for 'Internal Server Error'
    response.send(500, error);
    }
    }
    // Register the handler function as a callback
    http.onrequest(requestHandler);
    server.log("Agent running");

    its say that i syntx error at (local state = request.query.switch;)
    May 2016
  • kevin0307
    Sorry for bothering again. I have got the frames of hex settled down. I would like to convert a string of hex for example "0100 41B9DDDE 0808" which 41B9DDDE is the temperature. Can you show me a way to convert the hex to floating point to get the temperature?

    Thanks again in advance.
    July 2015
    • smittytone
      smittytone
      local hexString = "41B9DDDE";
      hexString = "0x" + hexString;
      local hexFloat = hexString.tofloat();

      PS. I’m not trying to be difficult, but would you post your questions in the forums, please? That way other folks can benefit from the answers too. Thanks.
    • kevin0307
      kevin0307
      Sorry about that. I will do that next time. Thanks.
  • kevin0307
    Hi,

    Thank you for the help on the previous code. I have got a question. I found the hex '05' then followed by '10'. For example, the hex '05' has an index of 100. What command should I use to clear the hex before index 100. Or how do I write '05 10' and the following bytes into a new blob. I tried using blob.seek() method but when I write it into a new blob. It wrote the whole blob instead of index 100 and after.

    Thank you very much.
    July 2015
    • smittytone
      smittytone
      I’d do something like this:

      local dataSize = 20;
      nuBlob = blob(dataSize);

      // Data *after* '0x0510' is at index 102, so
      // set oldBlob's read/write pointer to 102
      oldBlob.seek(102, 'b');

      // Read x OldBlob bytes into nuBlob
      nuBlob = oldBlob.readblob(dataSize);
    • kevin0307
      kevin0307
      That is exactly what I'm looking for. Thank you for the kind help.
  • autolibearth
    Hi,

    You posted the Salesforce wrapper library for electric imp on GitHub. Pat Patterson wrote a pretty neat example on showing the use of the electric imp library and Salesforce.

    https://developer.salesforce.com/blogs/developer-relations/2015/05/easy-iot-getting-started-electric-imp-salesforce-library.html

    He is no where to be found in trying to contact him. I have never worked with Salesforce before but I setup a developer account and started messing around with it. Can you give me any clue on what needs to be done in Salesforce to get Patterson's example to work. A simple "Setup/Create/Objects click “New Custom Object”" format would be fantastic. Just something to get me started.

    I would appreciate any help you might give.

    Thanks.
    June 2015
    • smittytone
      smittytone
      I’m not a Salesforce expert, so can’t really help you with this. Pat has a follow-up blog post, which may answer some of your questions: https://developer.salesforce.com/blogs/developer-relations/2015/06/easy-iot-associating-electric-imp-device-salesforce-user.html.

      He’s also @metadaddy on Twitter.
  • gerriko
    Thought to drop you a quick message about fun project I just started couple of days ago. Demos what's possible using Agent to handle multiple web pages & graphics. Still VERY MUCH work in progress so not ready to show the world. https://agent.electricimp.com/Qnm6bxhMAruu

    Should (hopefully) see a background picture on this sign-in page which is stored on google+ pictures (uses url for ref). Sign-in page is very useful for managing user control for imp.

    For demo use "me@electric.imp" for email and "admin" for password. Enter these first. Clicking on "remember me" stores details using html local storage rather than cookies. I think this is much better as device centric. If you click on "geolocate me" and accept / have this enabled on browser it will locate you using html5 geolocate functionality.

    Clicking sign-in button takes you to another page. All pages stored in Agent. If all ok will see your weather data from http://openweathermap.org/
    March 2015
    • gerriko
      gerriko
      Just to add when clicking on "geolocate me" you need to wait for the "Geolocation info retrieved." message before signing in as takes a second or so to retrieve.
    • smittytone
      smittytone
      Cool. Let me take a look.