         @emit "value", value
 
     requestData: () =>
-      creds = accessToken: @accessToken
-      Particle.login(creds).then((token) =>
-        #console.log 'Logged in: ', token
-        Particle.getVariable @coreid, @variable
-      ).then ((data) =>
-        #console.log @variable + ' retrieved successfully: ' + data.result
+      ParticleLib.getVariable @coreid, @variable
+      .then ((data) =>
+        console.log @variable + ' retrieved successfully: ' + data.result
         @_setValue data.result
       ), (err) ->
         console.log 'Particle error:', err

    init: (app, @framework, @config) =>
      deviceConfigDef = require("./device-config-schema")

      authToken = config.auth
      esConfig = headers: 'Authorization': 'Bearer ' + authToken
      es = new EventSource(EVENTS_URL, esConfig)
      es.onerror = ->
        console.log 'ERROR!'
        return

      @framework.deviceManager.registerDeviceClass("ParticlePresenceSensor", {
        configDef: deviceConfigDef.ParticlePresenceSensor,


      @framework.deviceManager.registerDeviceClass("ParticleVariable", {
        configDef: deviceConfigDef.ParticleVariable,
        createCallback: (config, lastState) => new ParticleVariable(config, lastState)
      })

  #############################################################################
