Software Sensors

Hello World

const Nomad = require('nomad-stream') //Importing Nomad npm module

const nomad = new Nomad()

// const createMessage = () => {
//   const idx = Math.floor(Math.random() * messages.length)
//   return (messages[idx]())
// }

let instance = null
nomad.prepareToPublish() //Prepare to publish (Runs once)
  .then(function(n) {
    instance = n
    console.log('DEMO: CONNECTED!!!!')
    return instance.publishRoot('Demo sensor is running')
  })
  .then(function() { // Publishing
    console.log('DEMO: ROOT PUBLISHED!!!!')
    setInterval(function() {
      instance.publish('Hello')
    }, 60000)
    return instance.publish('hello!')
  })
  .then(() => {
    // console.log('DEMO: PUBLLISHED!!!!', d)
  })```



####Yahoo Weather API

const Nomad = require('nomad-stream') //Importing Nomad npm module

const nomad = new Nomad()

var YQL = require('yql');

var query = new YQL('select * from weather.forecast where (location = 94089)');

// const createMessage = () => {
// const idx = Math.floor(Math.random() * messages.length)
// return (messagesidx)
// }

let instance = null
nomad.prepareToPublish() //Prepare to publish (Runs once)
.then(function(n) {
instance = n
console.log('DEMO: CONNECTED!!!!')
return instance.publishRoot('Demo sensor is running')
})
.then(function() { // Publishing
query.exec(function(err, data) {
var location = data.query.results.channel.location;
var condition = data.query.results.channel.item.condition;

  console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');
});
setInterval(function() {
  instance.publish('Hello')
}, 60000)
return instance.publish('hello!')

})
.then(() => {
// console.log('DEMO: PUBLLISHED!!!!', d)
})

/
var YQL = require('yql');
var query = new YQL('select
from weather.forecast where (location = 94089)');
query.exec(function(err, data) {
var location = data.query.results.channel.location;
var condition = data.query.results.channel.item.condition;
console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');
});
*/```

results matching ""

    No results matching ""