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

Particle Integrations [THAT Conference 2019]

Particle Integrations [THAT Conference 2019]

2411e1b8fa28ddd0c8071dc4aec1c5a1?s=128

Brandon Satrom

August 05, 2019
Tweet

Transcript

  1. PARTICLE TOOLS & INTEGRATIONS

  2. BUILDING WEB AND MOBILE APPS USING WEBHOOKS AND INTEGRATIONS AZURE

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

    DATA TO COMPUTE CLOUDS GETTING STARTED WITH THE CLI
  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
  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
  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
  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
  8. PARTICLE NYAN

  9. PARTICLE NYAN

  10. PARTICLE DEVICE CLOUD API

  11. PARTICLE DEVICE CLOUD API

  12. GETTING STARTED WITH THE CLI DEMO

  13. BUILDING WEB AND MOBILE APPS USING WEBHOOKS AND INTEGRATIONS PIPING

    DATA TO COMPUTE CLOUDS GETTING STARTED WITH THE CLI
  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<ParticleDevice> 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<ParticleDevice> devices = ParticleCloud.SharedCloud.GetDevicesAsync(); foreach (ParticleDevice device in devices) { if (device.Name().equals("myDeviceName")) myDevice = device; }
  15. BUILDING NATIVE MOBILE APPS WITH NATIVESCRIPT + VUE.JS <Slider id="redSlider"

    minValue="0" maxValue="255" v-model="redAmount" @valueChange="onRedChanged" !/> <Slider id="greenSlider" minValue="0" maxValue="255" v-model="greenAmount" @valueChange="onGreenChanged" !/> <Slider id="blueSlider" minValue="0" maxValue="255" v-model="blueAmount" @valueChange="onBlueChanged" !/> <GridLayout columns="100, 115" rows="80"> <Label row="0" col="0" text="Blink Speed" !/> <ListPicker row="0" col="1" :items="blinkSpeeds" v-model="currentBlinkSpeed" @selectedIndexChange="onSpeedChanged" !/> !</GridLayout> <GridLayout columns="100, 115" rows="80"> <Label row="0" col="0" text="Take Control" !/> <Switch row="0" col="1" id="controlRGBLED" v-model="isControlling" @checkedChange="onControlChanged" !/> !</GridLayout> <script> export default { methods: { onRedChanged: function(args) { callParticleAPI('setRed', this.redAmount); }, onGreenChanged: function(args) { callParticleAPI('setGreen', this.greenAmount); }, onBlueChanged: function(args) { callParticleAPI('setBlue', this.blueAmount); }, onSpeedChanged: function(args) { callParticleAPI('setBlinkRate', this.currentBlinkSpeed); }, onControlChanged: function(args) { callParticleAPI('toggleCtrl', this.isControlling); }, onSignalChanged: function(args) { signalDevice(this.isSignaling ? 1 : 0); } } }; !</script> +
  16. CONTROLLING YOUR PARTICLE DEVICES FROM MOBILE

  17. CONTROLLING YOUR PARTICLE DEVICES FROM MOBILE

  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
  19. USING THE PARTICLEJS LIBRARY DEMO

  20. BUILDING WEB AND MOBILE APPS USING WEBHOOKS AND INTEGRATIONS PIPING

    DATA TO COMPUTE CLOUDS GETTING STARTED WITH THE CLI
  21. IFTTT (IF THIS, THEN THAT) + PARTICLE

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

  23. INTEGRATIONS - WEBHOOKS

  24. INTEGRATIONS - WEBHOOKS

  25. USING WEBHOOKS AND INTEGRATIONS DEMO

  26. BUILDING WEB AND MOBILE APPS USING WEBHOOKS AND INTEGRATIONS PIPING

    DATA TO COMPUTE CLOUDS GETTING STARTED WITH THE CLI
  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.
  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
  29. CRMs ERPs Value-Add Services USE CASE: INTEGRATING 3RD PARTY TOOLS

    AND SERVICES
  30. INTEGRATIONS - AZURE IOT & GOOGLE CLOUD PLATFORM

  31. INTEGRATIONS - AZURE IOT & GOOGLE CLOUD PLATFORM

  32. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

  33. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

  34. AZURE IOT CENTRAL - CREATING DEVICE TEMPLATES

  35. PUBLISHING DEVICE DATA TO AZURE IOT CENTRAL #include "AzureIotHubClient.h" #define

    AZURE_CONNECTON_STRING “<STRING HERE>" 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
  36. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

  37. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

  38. VIEWING “REAL” DEVICE TELEMETRY IN IOT CENTRAL

  39. USING AZURE IOT CENTRAL

  40. LET’S BUILD SOME INTEGRATIONS!

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