GithubHelp home page GithubHelp logo

iotfes / dht11-twitter Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 246 KB

Cumulocityのデータ取得APIを用いてDHT11温湿度センサが測定した最新の温度と湿度を取得し、Twitterへ投稿するプログラ

Ruby 100.00%

dht11-twitter's Introduction

#----------------------------------------------------------------------
# dht11-tweet.rb
# ver.1.0
# 2017/01/18
# DHT11温湿度センサから最新の温度、湿度を取得し、Twitterへ投稿するプログラム
#----------------------------------------------------------------------

○前提
- Raspberry piにCumulocity Agentをインストールしており、正常に接続していること。
- Raspberry piのAdministrationアプリの"Own applications" -> "Create application"よりアプリケーション情報を登録し、App-Keyを取得していること。(App-Key登録画面例.png参照)
- Twitterアカウントを所有しており、下記の値を取得していること。
-- consumer_key
-- consumer_secret
-- access_token
-- access_token_secret
-- 詳細は下記を参照:http://hello-apis.blogspot.jp/2013/03/twitterapi.html

○セットアップ
- Twitter用Rubyライブラリをインストール
$ sudo gem install twitter

○動作例
sho-pc:cumulocity sho$ ruby dht-tweet.rb 
https://nttcom.cumulocity.com/measurement/measurements?dateFrom=2017-01-18&dateTo=2017-01-19&type=c8y_dht11&revert=true&pageSize=1
会議室Cの温度は21.0度、湿度は34.0%です。(2017年01月18日 12:02:03現在)
Twitterへ投稿しました。

dht11-twitter's People

Contributors

sho-kanemaru-ntt avatar

Stargazers

 avatar

Watchers

James Cloos avatar kwata avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.