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 Slide

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

    View Slide

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

    View 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 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 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 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 Slide

  8. PARTICLE NYAN

    View Slide

  9. PARTICLE NYAN

    View Slide

  10. PARTICLE DEVICE CLOUD API

    View Slide

  11. PARTICLE DEVICE CLOUD API

    View Slide

  12. GETTING STARTED WITH THE CLI
    DEMO

    View Slide

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

    View 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 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 Slide

  16. CONTROLLING YOUR PARTICLE DEVICES FROM MOBILE

    View Slide

  17. CONTROLLING YOUR PARTICLE DEVICES FROM MOBILE

    View 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 Slide

  19. USING THE PARTICLEJS LIBRARY
    DEMO

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  23. INTEGRATIONS - WEBHOOKS

    View Slide

  24. INTEGRATIONS - WEBHOOKS

    View Slide

  25. USING WEBHOOKS AND INTEGRATIONS
    DEMO

    View Slide

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

    View 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 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 Slide

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

    View Slide

  30. INTEGRATIONS - AZURE IOT & GOOGLE CLOUD PLATFORM

    View Slide

  31. INTEGRATIONS - AZURE IOT & GOOGLE CLOUD PLATFORM

    View Slide

  32. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

    View Slide

  33. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

    View Slide

  34. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

    View 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 Slide

  36. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

    View Slide

  37. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

    View Slide

  38. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

    View Slide

  39. USING AZURE IOT CENTRAL

    View Slide

  40. LET’S BUILD SOME INTEGRATIONS!

    View Slide

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

    View Slide