#30 温度/湿度センサ
Tibbitの配置
Tibbit #30 と Tibbit #00-3を挿入します。
ノードの配置
以下のようにフローを配置します。
ノードの設定を開き、スロットを選択します。
Node-REDデプロイ後、injectノードをクリックすると温度(temp)/湿度(humd)を取得することができます。
サンプルフロー
1 |
[{"id":"2d772a3c.8f637e","type":"inject","z":"3efecf70.7f7ef8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":140,"wires":[["642e4469.93619c"]]},{"id":"1df5482b.7ec26","type":"debug","z":"3efecf70.7f7ef8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":400,"y":260,"wires":[]},{"id":"642e4469.93619c","type":"Tibbit-#30","z":"3efecf70.7f7ef8","name":"","tpSlot":"","communication":"I2C","connectedStatus":"start","host":"","x":260,"y":200,"wires":[["1df5482b.7ec26"]]}] |
dashboardで可視化
gauge
簡易的に可視化するために、dashboardのgaugeノードを使用します。
以下のようにフローを配置します。
5秒間隔で表示を更新します。
changeノードを使い、tempとhumdを分けます。
・湿度
・温度
gaugeノードの設定を開きます。
Units(単位)やRange(範囲)を指定します。
Groupは任意で設定してください。
・湿度
・温度
ダッシュボードタブの赤枠をクリックします。
Node-REDデプロイ後、injectノードをクリックするとゲージが5秒間隔で更新されます。
サンプルフロー
1 |
[{"id":"d59bf859.cb2ff8","type":"inject","z":"3c31dc44.0e66fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1040,"wires":[["2beb4185.f43c86"]]},{"id":"2beb4185.f43c86","type":"Tibbit-#30","z":"3c31dc44.0e66fc","name":"","tpSlot":"S01","communication":"I2C","connectedStatus":"start","host":"","x":280,"y":1080,"wires":[["6c2a2b7b.3d837c","c0562616.941f6","6b1107e6.dff6a8"]]},{"id":"6c2a2b7b.3d837c","type":"delay","z":"3c31dc44.0e66fc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1140,"wires":[["2beb4185.f43c86"]]},{"id":"ca4aae11.e605c8","type":"ui_gauge","z":"3c31dc44.0e66fc","name":"","group":"173ca4ac.32a41b","order":0,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"%","format":"{{value}}","min":"40","max":"80","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":650,"y":1080,"wires":[]},{"id":"c0562616.941f6","type":"change","z":"3c31dc44.0e66fc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humd","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1080,"wires":[["ca4aae11.e605c8"]]},{"id":"6b1107e6.dff6a8","type":"change","z":"3c31dc44.0e66fc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1120,"wires":[["4808d11c.a7a4a"]]},{"id":"4808d11c.a7a4a","type":"ui_gauge","z":"3c31dc44.0e66fc","name":"","group":"173ca4ac.32a41b","order":0,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"℃","format":"{{value}}","min":"25","max":"33","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":650,"y":1120,"wires":[]},{"id":"173ca4ac.32a41b","type":"ui_group","z":"","name":"デフォルト","tab":"da05ff1c.ed28b","disp":true,"width":"6","collapse":false},{"id":"da05ff1c.ed28b","type":"ui_tab","z":"","name":"ホーム","icon":"dashboard"}] |
chart
簡易的にグラフ化するために、dashboardのchartノードを使用します。
以下のようにフローを配置します。
5秒間隔で表示を更新します。
chartノードの設定を開きます。
Y-axisなどを指定します。
Groupは任意で設定してください。
・湿度
・温度
ダッシュボードタブの赤枠をクリックします。
Node-REDデプロイ後、injectノードをクリックするとグラフが5秒間隔で更新されます。
サンプルフロー
1 |
[{"id":"d59bf859.cb2ff8","type":"inject","z":"3c31dc44.0e66fc","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":1040,"wires":[["2beb4185.f43c86"]]},{"id":"2beb4185.f43c86","type":"Tibbit-#30","z":"3c31dc44.0e66fc","name":"","tpSlot":"S01","communication":"I2C","connectedStatus":"start","host":"","x":280,"y":1080,"wires":[["6c2a2b7b.3d837c","c0562616.941f6","6b1107e6.dff6a8"]]},{"id":"6c2a2b7b.3d837c","type":"delay","z":"3c31dc44.0e66fc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":280,"y":1140,"wires":[["2beb4185.f43c86"]]},{"id":"c0562616.941f6","type":"change","z":"3c31dc44.0e66fc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humd","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1080,"wires":[["359ee01b.539b88"]]},{"id":"6b1107e6.dff6a8","type":"change","z":"3c31dc44.0e66fc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1120,"wires":[["2e22b2b1.d8bb8e"]]},{"id":"359ee01b.539b88","type":"ui_chart","z":"3c31dc44.0e66fc","name":"","group":"173ca4ac.32a41b","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"40","ymax":"80","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":670,"y":1080,"wires":[[],[]]},{"id":"2e22b2b1.d8bb8e","type":"ui_chart","z":"3c31dc44.0e66fc","name":"","group":"173ca4ac.32a41b","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"25","ymax":"33","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":670,"y":1120,"wires":[[],[]]},{"id":"173ca4ac.32a41b","type":"ui_group","z":"","name":"デフォルト","tab":"da05ff1c.ed28b","disp":true,"width":"6","collapse":false},{"id":"da05ff1c.ed28b","type":"ui_tab","z":"","name":"ホーム","icon":"dashboard"}] |