Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Particle Integrations [THAT Conference 2019]

Particle Integrations [THAT Conference 2019]

Brandon Satrom

August 05, 2019
Tweet

More Decks by Brandon Satrom

Other Decks in Technology

Transcript

  1. PARTICLE TOOLS & INTEGRATIONS

    View full-size slide

  2. BUILDING WEB AND MOBILE APPS
    USING WEBHOOKS AND INTEGRATIONS
    AZURE IOT CENTRAL
    GETTING STARTED WITH THE CLI

    View full-size slide

  3. BUILDING WEB AND MOBILE APPS
    USING WEBHOOKS AND INTEGRATIONS
    PIPING DATA TO COMPUTE CLOUDS
    GETTING STARTED WITH THE CLI

    View full-size slide

  4. PARTICLE COMMAND-LINE INTERFACE (CLI)
    ✴ List all your devices
    ✴ Setup a new device
    ✴ Call functions and get variables
    ✴ Publish and subscribe to events
    ✴ Create new projects
    ✴ Compile firmware and flash devices
    ✴ Search for and install libraries
    ✴ Setup webhooks

    View full-size slide

  5. PARTICLE COMMAND-LINE INTERFACE (CLI)
    ✴ List all your devices
    ✴ Setup a new device
    ✴ Call functions and get variables
    ✴ Publish and subscribe to events
    ✴ Create new projects
    ✴ Compile firmware and flash devices
    ✴ Search for and install libraries
    ✴ Setup webhooks

    View full-size slide

  6. PARTICLE DOCTOR FOR DEVICE RECOVERY
    ✴ Update Device OS
    ✴ Reset device antenna
    ✴ Reset IP configuration
    ✴ Reset SoftAP hotspot
    ✴ Clear EEPROM
    ✴ Clear Wi-Fi credentials
    ✴ Reset server and device key
    ✴ Flash the default Tinker app

    View full-size slide

  7. PARTICLE DOCTOR FOR DEVICE RECOVERY
    ✴ Update Device OS
    ✴ Reset device antenna
    ✴ Reset IP configuration
    ✴ Reset SoftAP hotspot
    ✴ Clear EEPROM
    ✴ Clear Wi-Fi credentials
    ✴ Reset server and device key
    ✴ Flash the default Tinker app

    View full-size slide

  8. PARTICLE NYAN

    View full-size slide

  9. PARTICLE NYAN

    View full-size slide

  10. PARTICLE DEVICE CLOUD API

    View full-size slide

  11. PARTICLE DEVICE CLOUD API

    View full-size slide

  12. GETTING STARTED WITH THE CLI
    DEMO

    View full-size slide

  13. BUILDING WEB AND MOBILE APPS
    USING WEBHOOKS AND INTEGRATIONS
    PIPING DATA TO COMPUTE CLOUDS
    GETTING STARTED WITH THE CLI

    View full-size slide

  14. SDKS FOR MOBILE AND WEB DEVELOPMENT
    myPhoton!.getVariable("temperature",
    completion: { (result:Any?, error:Error?) !-> Void in
    if let _ = error {
    print("Failed reading temperature from device")
    }
    else {
    if let temp = result as? NSNumber {
    print("Room temp is \(temp.stringValue) degrees")
    }
    }
    })
    List devices = ParticleCloudSDK.getCloud().getDevices();
    for (ParticleDevice device : devices) {
    if (device.getName().equals("myDevice")) {
    doSomethingWithMyDevice(device);
    break;
    }
    }
    var brew = particle.callFunction({
    deviceId: 'DEVICE_ID',
    name: 'brew',
    argument: 'D0:HIGH',
    auth: token
    });
    brew.then(
    (data) !=> console.log(‘Function called:', data),
    (err) !=> console.log('An error occurred:', err);
    );
    ParticleDevice myDevice = null;
    List devices =
    ParticleCloud.SharedCloud.GetDevicesAsync();
    foreach (ParticleDevice device in devices)
    {
    if (device.Name().equals("myDeviceName"))
    myDevice = device;
    }

    View full-size slide

  15. BUILDING NATIVE MOBILE APPS WITH NATIVESCRIPT + VUE.JS
    v-model="redAmount" @valueChange="onRedChanged" !/>
    v-model="greenAmount" @valueChange="onGreenChanged" !/>
    v-model="blueAmount" @valueChange="onBlueChanged" !/>


    v-model="currentBlinkSpeed" @selectedIndexChange="onSpeedChanged" !/>
    !


    v-model="isControlling" @checkedChange="onControlChanged" !/>
    !
    <br/>export default {<br/>methods: {<br/>onRedChanged: function(args) {<br/>callParticleAPI('setRed', this.redAmount);<br/>},<br/>onGreenChanged: function(args) {<br/>callParticleAPI('setGreen', this.greenAmount);<br/>},<br/>onBlueChanged: function(args) {<br/>callParticleAPI('setBlue', this.blueAmount);<br/>},<br/>onSpeedChanged: function(args) {<br/>callParticleAPI('setBlinkRate', this.currentBlinkSpeed);<br/>},<br/>onControlChanged: function(args) {<br/>callParticleAPI('toggleCtrl', this.isControlling);<br/>},<br/>onSignalChanged: function(args) {<br/>signalDevice(this.isSignaling ? 1 : 0);<br/>}<br/>}<br/>};<br/>!
    +

    View full-size slide

  16. CONTROLLING YOUR PARTICLE DEVICES FROM MOBILE

    View full-size slide

  17. CONTROLLING YOUR PARTICLE DEVICES FROM MOBILE

    View full-size slide

  18. USING THE PARTICLE JAVASCRIPT LIBRARY IN BROWSER AND NODE APPS
    const listDevices = token !=> {
    return new Promise((resolve, reject) !=> {
    particle
    .listDevices({ auth: token })
    .then(devices !=> resolve(devices),
    err !=> reject(err));
    });
    };
    const getDevice = (token, id) !=> {
    return new Promise((resolve, reject) !=> {
    particle
    .getDevice({ deviceId: id, auth: token })
    .then(device !=> resolve(device))
    .catch(err !=> reject(err));
    });
    };
    const handlers = {
    NumberOfDevicesIntent: function() {
    let response;
    const token = this.event.session.user.accessToken;
    if (token !!=== undefined) {
    return emitAccountLinkResponse(this);
    }
    particleApiUtils
    .getOnlineDevices(token)
    .then(devices !=> {
    const onlineDevicesCount = devices.length;
    response = `You currently have ${
    onlineDevicesCount > 1
    ? `${onlineDevicesCount} devices`
    : `${onlineDevicesCount} device`
    } online.`;
    })
    .catch(err !=> {
    response = `This request has failed. Please try
    again. ${err}`;
    })
    .finally(() !=> {
    emitResponse(this, response);
    });
    }
    };
    Promise-based

    View full-size slide

  19. USING THE PARTICLEJS LIBRARY
    DEMO

    View full-size slide

  20. BUILDING WEB AND MOBILE APPS
    USING WEBHOOKS AND INTEGRATIONS
    PIPING DATA TO COMPUTE CLOUDS
    GETTING STARTED WITH THE CLI

    View full-size slide

  21. IFTTT (IF THIS, THEN THAT) + PARTICLE

    View full-size slide

  22. IFTTT (IF THIS, THEN THAT) + PARTICLE

    View full-size slide

  23. INTEGRATIONS - WEBHOOKS

    View full-size slide

  24. INTEGRATIONS - WEBHOOKS

    View full-size slide

  25. USING WEBHOOKS AND INTEGRATIONS
    DEMO

    View full-size slide

  26. BUILDING WEB AND MOBILE APPS
    USING WEBHOOKS AND INTEGRATIONS
    PIPING DATA TO COMPUTE CLOUDS
    GETTING STARTED WITH THE CLI

    View full-size slide

  27. USE CASE: INTEGRATING 3RD PARTY TOOLS AND SERVICES
    Jacuzzi is a well-known hot tub manufacturer that sells spas to
    thousands of consumers and hotels each year.
    Their Particle-powered connected tub allows service people to
    remotely monitor and troubleshoot hot tubs using an interface
    presented to them in Salesforce Service Cloud.

    View full-size slide

  28. Water quality data sent
    to Rules Engine
    Connected Hot Tub
    Jacuzzi service
    person
    Serviceperson sees alert, and can
    remotely troubleshoot tub via
    Salesforce UI
    If water becomes too
    dirty, an alert is sent to
    Salesforce
    USE CASE: INTEGRATING 3RD PARTY TOOLS AND SERVICES

    View full-size slide

  29. CRMs ERPs Value-Add Services
    USE CASE: INTEGRATING 3RD PARTY TOOLS AND SERVICES

    View full-size slide

  30. INTEGRATIONS - AZURE IOT & GOOGLE CLOUD PLATFORM

    View full-size slide

  31. INTEGRATIONS - AZURE IOT & GOOGLE CLOUD PLATFORM

    View full-size slide

  32. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

    View full-size slide

  33. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

    View full-size slide

  34. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

    View full-size slide

  35. PUBLISHING DEVICE DATA TO AZURE IOT CENTRAL
    #include "AzureIotHubClient.h"
    #define AZURE_CONNECTON_STRING “"
    int callbackDirectMethod(char *method,
    byte *payload, unsigned int payloadLength)
    {
    if (strcmp(method, "readSensors") !== 0)
    {
    Particle.publish("iot-central/debug",
    "Read Sensors from IoT Central!", PRIVATE);
    readSensors();
    }
    else if (strcmp(method, "toggleLed") !== 0)
    {
    Particle.publish("iot-central/debug",
    "Toggle LED from IoT Central!", PRIVATE);
    toggleLed("");
    }
    else
    {
    return 400;
    }
    return 200;
    }
    IotHub hub(AZURE_CONNECTON_STRING, NULL, callbackDirectMethod);
    void createEventPayload(int temp, int humidity, double light)
    {
    JsonWriterStatic<256> jw;
    {
    JsonWriterAutoObject obj(&jw);
    jw.insertKeyValue("temp", temp);
    jw.insertKeyValue("humidity", humidity);
    jw.insertKeyValue("light", light);
    if (hub.loop())
    {
    Particle.publish("iot-central/debug",
    “Sending Env Vals", PRIVATE);
    jw.insertKeyValue("deviceid", hub.getDeviceId());
    }
    }
    if (hub.loop())
    {
    hub.publish(jw.getBuffer());
    }
    Particle.publish("env-vals", jw.getBuffer(), PRIVATE);
    }
    CONFIGURING & RESPONDING TO COMMANDS SENDING DEVICE TELEMETRY

    View full-size slide

  36. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

    View full-size slide

  37. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

    View full-size slide

  38. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

    View full-size slide

  39. USING AZURE IOT CENTRAL

    View full-size slide

  40. LET’S BUILD SOME INTEGRATIONS!

    View full-size slide

  41. PLEASE RATE THIS SESSION!
    https://particleiot.typeform.com/to/JiF8xM

    View full-size slide