Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Raspberry Pi と Netatmo と少しの ruby で作る二酸化炭素濃度モニター君

Raspberry Pi と Netatmo と少しの ruby で作る二酸化炭素濃度モニター君

2021-05-19 社内 LT 会資料

Yoshihide TANIGUCHI

May 19, 2021
Tweet

More Decks by Yoshihide TANIGUCHI

Other Decks in Programming

Transcript

  1. 2021-05-19 Wed / Quipper LT ձ Raspberry Pi ͱ Netatmo

    ͱ গ͠ͷ ruby Ͱ࡞Δ ೋࢎԽ୸ૉೱ౓Ϟχλʔ܅ @ravelll
  2. ػೳ • Netatmo Smart Home Weather Station Ͱଌఆͨ͠ೋࢎԽ୸ૉೱ౓Λ 1෼͝ͱʹऔಘͯ͠ LCD

    ʹදࣔɾߋ৽ • Netatmo ~ ͸ͳΜ͔৭ʑଌఆͰ͖ͯ໘ന͍ػցʢͪΐͬͱߴ͍ʣ
  3. ͳͥ࡞ͬͨʁ • Netatmo ͷଌఆ஋͸ Web ্ͷμογϡϘʔυͰ͔͠ݟΕͳ͍ • ݟΔͷʹ PC ΍εϚϗͷૢ࡞ඞਢͰ֬ೝ͕໘౗ͳঢ়گ͕͋Δ

    • -> ୭͔͕ৗʹ஋Λදࣔͯ͘͠ΕͨΒศརͦ͏ • ෦԰ͷ୨Ͱ຾Βͤͯͨ Raspberry Pi Ͱ༡ͼ͍ͨ
  4. ߏ੒ ruby process Netatmo API Server GET /api/get_station_info ଌఆ஋ Netatmo

    Smart Home Weather Station POST /oauth2/token access token atmo gem Send ଌఆ஋ / n min Raspberry Pi 3 Model B 1602 LCD I2C adapter i2c-ss1602 gem
  5. ॴײ • ރΕͯΔػࡐͱطଘͷϥΠϒϥϦΛ૊Έ߹ΘͤΔ͚ͩͰγϡοͱͰָ͖ͯ͠ ͔ͬͨ • Raspberry Pi ৮ΔͷॳΊͯͳͱ͜Ζ͔Β5࣌ؒ͘Β͍ʁ • ಈ͘Ϟϊ͕Ͱ͖Δͱָ͍͠ͳͱ࠶ೝͨ͠

    • Netatmo API client Ͱ͋Δ atmo gem ͕ native extension ΛؚΉ gem ʹґଘ͠ ͍ͯΔΆ͘ɺruby-dev package ͷ install ͕ඞཁͩͬͨͷͰґଘͷগͳ͍ client gem ॻ͜͏͔ͳͱࢥͬͨ • ೋࢎԽ୸ૉೱ౓Λଌఆ͢ΔϞδϡʔϧ΋ൢച͞Ε͍ͯΔͷͰͦΕΛ࢖͑͹ɹ Netatomo ΁ͷґଘΛ੾ΕͯϙʔλϏϦςΟˢˢʹͳͬͯྑͦ͞͏