Skip to content

Instantly share code, notes, and snippets.

@banasrini
Created July 8, 2015 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save banasrini/6c9f5282a53dab88c60d to your computer and use it in GitHub Desktop.
Save banasrini/6c9f5282a53dab88c60d to your computer and use it in GitHub Desktop.
eon.chart({
channel: 'humeon',
generate: {
bindto: '#chart',
data: {
type: 'gauge',
},
gauge: {
min: 0,
max: 100
},
color: {
pattern: ['#FF0000', '#F6C600', '#60B044'],
threshold: {
values: [30, 60, 90]
}
}
}
});
import os
import time
import sys
from pubnub import Pubnub
import Adafruit_DHT as dht
pubnub = Pubnub(publish_key='demo', subscribe_key='demo')
eon.chart({
history: true,
channel: 'tempeon',
flow: true,
generate: {
bindto: '#chart',
data: {
x: 'x',
labels: false
},
axis : {
x : {
type : 'timeseries',
tick: {
format: '%H:%M:%S'
}
}
}
}
});
def callback(message):
print(message)
while True:
h,t = dht.read_retry(dht.DHT22, 4)
pubnub.publish('tempeon', {
'columns': [
['x', time.time()],
['temperature_celcius', t]
]
})
pubnub.publish('humeon', {
'columns': [
['humidity', h]
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment