Get sensor values in another app [workaround solution!]


Hi !

I have a temperature sensor in my cup of tea, and I have configured a trigger that sends me a text message when the temperature drops below 60°C.

Now I want to build an Android app with virtual reality that displays on my cup of tea the temperature.
Is there a way to get the sensor value with an API or something like this ?

Thank you for your response,




Welcome to the group!

I must say that when I think of IoT, and what can be done with it; monitoring the temperature of my favorite warm beverage was not on list of things that could be done.

But now that you mention it, what a splendid idea! After all, is there anything worse than finding your beverage has gone cold on a day like we are having today?

I can’t wait to see the VR cup o’ tea up and running!



@etienne.villedieu Short answer: we’re building the API right now.

We’ll likely discuss this at our first online meetup if you’d like to join: Online Meetup - 03/24/16 12pm - 1pm PDT

Welcome to the Cayenne Community!

@Ian As a California native, I’m not sure I could survive that.


Thank you for your welcoming ! :slight_smile:

@bestes I’m happy to read that you are working on the API ! I am trying to convice my boss to use Cayenne for our IoT and VR projects, do you think I can get the temperature with some “little hack” to setup a quick demo ?

I’d love to participate to the meetup, but it will be in the middle of the night for me (i’m in France). With some cups of coffee (at the right temperature with my sensors :wink: ), maybe I could be awake !

@Ian Could you please send a little of your snow in my city ? ^^


You would do fine, of course driving in this stuff has a slight learning curve.

Sure! How much do you want? Better hurry, most of it will be gone today. All should be gone by Sunday, looking at temperatures near 16°C (60°F) by then.

See, things are already looking up, we’re above 0°C



Aaaaannnd … it works !! \o/

I finally figured out how to get the data of a sensor and how to build a little API for my tests !

Here is a screenshot of my phone running my VR cup’o tea application :


Awesome! Can you expand a little bit? Are you still using Cayenne for the data?



Yes ! In facts this is a very dirty hack and I can’t wait to test your API !

I use a Python script with Heliumhq (, a web automation library. This script logs me on cayenne and go to the page which contains a json file with the temperature of my sensor :slight_smile:

I wil post some code tomorrow


Nice! Looking forward to seeing the rest.


Local Access To GPIO & Sensor Data From Raspberry Pi

Here is my python code that gets the temperature and sends it to my server :

from helium.api import *
import time
import json
import urllib2

# Open chrome on the cayenne's login page


# Fill form with email and password
write("", into="email")
write("xxxxxxxxxxxxxxxxxxxxxxx", into="password")

# Click on the "Log In" button

# DEVICE_CODE can be found in the dashboard's URL

# Get the temperature every 10 sec
while 1:
    refresh() # Refresh the page

    data = S("//html/body/pre").web_element.text # Get the json file

    data_json = json.loads(data) # Load json

    temp = data_json['info']['SensorsInfo'][1]['Celsius'] # Get the Celsius value of the sensor's temperature 

    # Send the temperature to my server
    reponse_page = urllib2.urlopen(""+str(temp)).read() 

    print temp

    time.sleep(10) # Wait 10sec

Accessing Raw Data in Cayenne

That’s some pretty hacky stuff…I like it!


This is the level I want to see:

  • Python and electronics is getting deep but I think has a nice fit between electronics and programming and right through to some networky sorts of ideas I.e. great for kids project work. Standard upper level project work in nz schools here.
  • Modules of python as examples or set up as functions, library etc could be a faster way to get data over the fence and into Cayenne GUI area. This is really nice for the quick

Either way I am dead keen to see some tinker and hack-ability.

  • For those that want to break new ground
  • Dev new sensors early and up front and get it working (for you guys etc)
  • Mad stuff. Fun, art, creativity ‘mix it up’ sort of IoT ideas

Updated 2 April…
Both directions too please…

Dropping the serial idea that I realise will be too complex… The main idea is to get a function or lib sort of thing that allows passing of data across to and from Cayenne to other ‘things’ going on in the Pi. Kids projects and python tinkering in my case.

~ Andrew