Cov txheej txheem:

Dark Sky API PyPortal & Weather Dashboard: 6 Kauj Ruam
Dark Sky API PyPortal & Weather Dashboard: 6 Kauj Ruam

Video: Dark Sky API PyPortal & Weather Dashboard: 6 Kauj Ruam

Video: Dark Sky API PyPortal & Weather Dashboard: 6 Kauj Ruam
Video: 10 самых АТМОСФЕРНЫХ мест Дагестана. БОЛЬШОЙ ВЫПУСК #Дагестан #ПутешествиеПоДагестану 2024, Kaum ib hlis
Anonim
Image
Image

Txoj haujlwm no yog siv rau ib qho uas peb tau ua dhau los, Tsaus Ntuj API API Huab Cua Dashboard. Lub sijhawm no hloov pauv ntawm Raspberry Pi, peb yuav siv Adafruit PyPortal los tso tawm cov ntaub ntawv huab cua thiab xa cov ntaub ntawv ntawd mus rau Lub Xeev Pib. Ob lub dashboards rau kev ua haujlwm ntawm ib qho!

Khoom siv

  • Adafruit PyPortal
  • Adafruit IO account (pub dawb)
  • Tsaus Ntuj API tus account (pub dawb)
  • Thawj Xeev tus as khauj

Kauj Ruam 1: Thawj Xeev

Lub Xeev Thawj
Lub Xeev Thawj

Initial State yog cov ntaub ntawv pom kev siv lub platform. Peb yuav xa cov ntaub ntawv los ntawm Dark Sky API thiab PyPortal mus rau Lub Xeev Pib. Qhov no yuav tso cai rau peb kom muaj cov log ntawm cov ntaub ntawv huab cua thiab saib huab cua hloov pauv.

Koj yuav tsum tau sau npe thiab tsim tus as khauj tshiab. Koj tau txais 14 hnub kev sim pub dawb thiab txhua tus neeg nrog edu email chaw nyob tuaj yeem tso npe rau txoj kev npaj kawm dawb.

Koj yuav xav tau koj Thawj Lub Xeev Nkag Mus Siv Tus lej kom tuaj yeem xa cov ntaub ntawv los ntawm Dark Sky API thiab PyPortal mus rau Lub Xeev Pib. Scroll hla koj lub npe siv nyob rau sab xis saum toj thiab nyem rau kuv qhov chaw. Muaj koj yuav pom cov npe ntawm Cov Ntawv Nkag Nkag Nkag Mus. Xaiv ib qho los siv lossis tsim ib qho tshiab. Peb yuav xav tau qhov no tom qab rau tus lej.

Kauj ruam 2: Tsaus Ntuj API

Tsaus Ntuj API
Tsaus Ntuj API

Tsaus Ntuj tshwj xeeb hauv kev kwv yees huab cua thiab pom kev. Qhov txias tshaj ntawm Tsaus Ntuj yog lawv cov huab cua API uas peb tuaj yeem siv los khaws cov ntaub ntawv huab cua los ntawm yuav luag txhua qhov chaw hauv ntiaj teb. Nws tsis yog tsuas yog huab cua los nag lossis tshav ntuj tab sis qhov kub, qhov dej nag, cua hlob, av noo, nag lossis daus, siab, ntsuas UV, thiab ntau ntxiv, txhua qhov yooj yim muaj rau txhua qhov chaw koj xav tau, thaum twg koj xav tau.

Txhawm rau siv Dark Sky API, koj xub xav tau koj tus lej API. Tsis txhob txhawj xeeb, tau txais tus lej API nrawm thiab dawb. Txhua yam koj yuav tsum tau ua yog mus rau lub vev xaib thiab nyem "Sim dawb" los tsim tus as khauj.

Koj tau txais 1, 000 API hu dawb txhua hnub. Txhua qhov API thov tshaj qhov pub dawb txhua hnub tus nqi $ 0.0001. Qhov txwv no yuav rov pib dua txhua hnub thaum ib tag hmo UTC. Txoj Kev Thov Huab Cua yuav xa rov qab huab cua tam sim no rau lub lim tiam tom ntej. yav dhau los lossis yav tom ntej.

Koj qhov zais Tsaus Ntuj API tus yuam sij yuav zoo li no:

0123456789abcdef9876543210fedcba.

Peb yuav siv qhov no tom qab hauv cov cai.

Kauj Ruam 3: Adafruit IO & PyPortal

Adafruit IO yog kev pabcuam Adafruit muab ntxiv rau lawv cov cuab yeej siv. Peb yuav siv qhov kev pabcuam no rau ib feem ntawm peb tus lej. Sau npe rau tus as khauj dawb. Nyem rau View AIO Key ntawm sab laug kom pom koj lub npe siv thiab tus yuam sij. Peb yuav siv ob qho no tom qab hauv peb cov cai tom qab.

Adafruit PyPortal yog qhov cuab yeej IoT tshiab tshaj plaws los ntawm Circuit Python. Qhov txias tshaj plaws txog PyPortal yog koj tuaj yeem cuam tshuam nrog API's thiab JSONs kom pom yuav luag txhua yam. Peb yuav siv nws kom tau txais cov ntaub ntawv los ntawm Dark Sky API, tso tawm cov ntaub ntawv ntawd ntawm PyPortal, thiab xa cov ntaub ntawv ntawd mus rau Lub Xeev Pib.

Yog tias qhov no yog koj thawj qhov haujlwm ntawm koj li PyPortal, koj yuav xav ua raws cov lus qhia no txhawm rau rub tawm cov firmware, txuas koj PyPortal rau WiFi, thiab npaj nws. Thaum koj ua tiav qhov no peb yuav npaj rau Dark Sky API code.

Kauj ruam 4: Code

Tus lej no tuaj yeem rub tawm rau koj lub khoos phis tawj ntawm no. Hloov tag nrho cov ntaub ntawv tshwj tsis yog README.md cov ntaub ntawv rau koj li PyPortal. Koj tsuas yog rub thiab tso lawv rau ntawm PyPortal, uas yuav tsum tshwm li CIRCUITPYTHON ntawm koj cov npe USB. Tib cov ntaub ntawv koj yuav tsum tau kho yog secrets.py. Nws yuav rub tag nrho koj cov ntaub ntawv ntiag tug mus rau hauv txoj cai yog li peb tsis muaj nws tawm hauv qhov pom tseeb.

Kuv yuav pom zoo siv Mu Editor los kho thiab saib koj cov cai. Nws muaj tus lej saib xyuas kom yooj yim debug thaum koj hloov pauv. Txawm hais tias tus lej editor yuav ua haujlwm txawm hais tias.

Kuv xav tham txog dab tsi txhua daim ntawm cov cai, cov tsev qiv ntawv, thiab cov ntawv khaws cia ua li ntawd nws yooj yim dua rau kev hloov pauv thiab

chaws.py

Nov yog peb cov ntaub ntawv tseem ceeb uas pib ntawm PyPortal txij li nws tau muaj npe code.py. Ntawm no koj yuav pom WiFi txuas, Tsaus Ntuj API hu, thiab teeb tsa rau PyPortal zaub. Tsis muaj kev hloov kho uas koj xav tau los ua cov ntawv no.

darksky.py

Tsab ntawv no yog hu los ntawm txoj cai tseem ceeb. Nov yog qhov peb txheeb xyuas Tsaus Ntuj API hu, teeb cov ntawv nyob ntawm PyPortal zaub, txiav txim siab lub cim twg los tso tawm, thiab xa cov ntaub ntawv API mus rau Lub Xeev Pib. Tsis muaj kev hloov kho uas koj xav tau los ua ntawm no.

secrets.py

Qhov no tuav tag nrho koj tus password thiab nkag tus yuam sij. Koj yuav tsum tau hloov kho yuav luag txhua yam khoom hauv daim ntawv no. Koj yuav tsum tau nkag mus rau koj lub npe WiFi, tus password WiFi, lub sijhawm, Lub Ntiaj Teb Tsaus Ntuj API qhov tseem ceeb, Lub Xeem Pib nkag mus rau qhov tseem ceeb, ntev & latitude, lub nroog lub npe & xeev, Adafruit IO username, thiab Adafruit IO qhov tseem ceeb. Thaum koj tau tag nrho cov uas tau nkag mus thiab khaws koj cov cai yuav tsum ua yam tsis muaj qhov yuam kev.

tsev qiv ntawv

Cov no yog cov tsev qiv ntawv xav tau los khiav PyPortal thiab cov qauv.

fonts

Nov yog daim ntawv siv los tso saib cov lus qhia huab cua ntawm PyPortal.

cim

Cov no yog cov cim sib txawv uas tau tso tawm raws li daim duab ntawm PyPortal raws li huab cua huab cua tam sim no.

Kauj ruam 5: PyPortal

PyPortal
PyPortal

Tam sim no koj tus lej tau ua haujlwm, koj PyPortal yuav nthuav qhia koj lub nroog & xeev, lub sijhawm, qhov xwm txheej huab cua tam sim no thiab lub cim kom haum, thiab qhov kub hauv Fahrenheit.

Koj tuaj yeem hloov kho qhov loj me thiab qhov chaw ntawm cov ntawv uas pom hauv Tsab Ntawv Tsaus Ntuj. Yog tias koj xav siv cov cim sib txawv, koj tsuas yog yuav tsum khaws lawv raws li lub npe raug thiab muab tso rau hauv cov cim cim. Ib qho ntawm cov khoom tso tawm yog kho tau. Koj tuaj yeem hloov pauv qhov koj tso tawm. Txhua yam koj yuav tsum tau ua yog txheeb xyuas qhov sib txawv ntawm Tsaus Ntuj API API hu thiab qhov ntawd yuav raug tso tawm es tsis txhob ntsuas kub lossis huab cua.

Kauj Ruam 6: Thawj Lub Xeev Dashboard

Thawj Lub Xeev Dashboard
Thawj Lub Xeev Dashboard

Mus rau koj Tus Thawj Xeev tus as khauj thiab saib koj cov ntaub ntawv. Kuv tau teeb tsa qhov ntsuas kub thiab huab cua cim rau emojis, ua qhov ntsuas kub ntsuas lub ntsuas cua ntsuas cua, ua kom cov av noo ntsuas cov kua ntsuas, ua rau UV ntsuas qhov ntsuas kab ntawv nrog cov xim pib, thiab tsim kab kab ntawm cov av noo, ntsuas kub, thiab ntsuas UV. '

Koj tuaj yeem ntxiv cov duab keeb kwm yav dhau los rau koj lub dashboard huab cua kom muab koj lub dashboard ntau dua tus kheej.

Yog tias koj xav siv daim phiaj teeb tsa los ntawm kev tshaj tawm pej xeem raws li koj lub dashboard, koj tuaj yeem xa cov txheej txheem rau hauv koj lub thoob cov ntaub ntawv los ntawm kev ua raws cov lus qhia ntawm no.

Cov pej xeem sib koom URL rau peb lub dashboard yog

Tam sim no koj tsis muaj tsuas yog ib qho, tab sis ob daim ntawv qhia huab cua thiab cov ntaub ntawv txog huab cua.

Pom zoo: