Cov txheej txheem:

Amazon Dash Button Silent Doorbell: 10 Kauj Ruam (nrog Duab)
Amazon Dash Button Silent Doorbell: 10 Kauj Ruam (nrog Duab)

Video: Amazon Dash Button Silent Doorbell: 10 Kauj Ruam (nrog Duab)

Video: Amazon Dash Button Silent Doorbell: 10 Kauj Ruam (nrog Duab)
Video: 26 декабря 2023 г. Подкаст: Издевательство над коррупцией. Поддельное представление драйверов. 2024, Hlis ntuj nqeg
Anonim
Image
Image

Tsis tu ncua saib lub qhov rais kom koj tuaj yeem cuam tshuam cov neeg tuaj saib ua ntej lawv tswb lub qhov rooj? Nkees ntawm cov dev thiab menyuam mus vwm txhua lub sijhawm nws nrov? Tsis xav siv qhov hmoov zoo rau qhov "ntse" daws?

Ua lub qhov rooj ntsiag to yog yooj yim li nyiag $ 5 Amazon Dash Button! Tsuas yog lwm yam uas koj xav tau yog lub khoos phis tawj uas ib txwm nyob hauv tsev - zoo li, hais, tias Raspberry Pi koj tau zaum ib puag ncig. Tau txais ntawv ceeb toom txhua lub sijhawm ib tus neeg thawb koj lub qhov rooj tshiab thiab ua kom tag nrho lub tsev zoo siab. (Nws tseem txias dua kom tau txais cov ntawv ceeb toom yog tias koj muaj smartwatch!)

Rau qhov haujlwm no koj yuav xav tau:

  • Amazon Dash Button
  • Lub khoos phis tawj uas nyob hauv tsev (zoo li Raspberry Pi)

Kauj Ruam 1: Teeb Koj Lub Dash Button

Teem Koj Li Dash Button
Teem Koj Li Dash Button
Teem Koj Li Dash Button
Teem Koj Li Dash Button

Ua kom koj lub Dash khawm npaj rau hack yog qhov yooj yim heev - koj tsuas yog yuav tsum mus dhau tag nrho Amazon teeb tsa txheej txheem rho tawm xaiv cov khoom.

Qhov teeb tsa no xav tau Amazon app, uas muaj rau iOS thiab Android. Thaum nkag mus rau hauv Amazon sab hauv ntawm lub app, mus rau Koj Tus Account -> Dash Buttons & Devices -> Teeb tsa lub cuab yeej tshiab. Xaiv "Dash Button" thiab ua raws cov lus qhia kom txog thaum koj tau txais kev tshoov siab kom xaiv cov khoom.

Kaw lub app. Tsis txhob thim teeb tsa; tsis txhob ntaus tus x - tsuas yog kaw lub app. Yog tias koj yuam kev xaiv cov khoom lag luam lossis rov ua dua lub khawm Dash qub, tsuas yog tshem lub cuab yeej los ntawm Amazon app thiab ua raws cov theem no dua.

Yog tias koj tab tom nrhiav hloov seb koj lub pob zoo li cas, tev daim ntawv lo lo yooj yim.

Kauj Ruam 2: Nruab Node JS ntawm Koj Ntaus Ntawv

Txhawm rau nrhiav (thiab siv tom qab) koj lub Dash khawm qhov chaw nyob kho vajtse, peb yuav tsum siv Node JS. Qhov no tuaj yeem teeb tsa ntawm txhua lub khoos phis tawj - Mac, Linux (Raspberry Pi), lossis Windows.

Peb qhov haujlwm kawg hinges ntawm kev muaj lub khoos phis tawj uas txuas nrog tib lub network zoo li peb lub pob uas tab tom ua haujlwm tsis muaj kev cuam tshuam ntawm Node tsab ntawv, yog li nco ntsoov thaum xaiv koj lub cuab yeej. Ib lub tsev nyob hauv tsev lossis Raspberry Pi yuav zoo tshaj.

Kuv xaiv siv Pi 3, tab sis Pi Zero nrog WiFi dongle yuav ua haujlwm ib yam nkaus!

Txhawm rau nruab Node JS ntawm koj lub computer, ua raws cov lus qhia tsim nyog:

  • Raspberry Pi
  • Mac OS
  • Qhov rai

Alex Horton tau sau tus qauv zoo heev rau qhov peb tab tom sim ua hu ua node-dash-button. Peb yuav tsum tau teeb tsa nws, nrog rau node pob tus thawj tswj hwm (npm) thiab libpcap. Nkag mus rau cov lus txib no hauv kab hais kom ua:

sudo apt-tau nruab npm

sudo apt-tau nruab libpcap-dev npm nruab node-dash-khawm

Kauj Ruam 3: Nrhiav khawm Qhov Chaw Nyob

Nrhiav khawm Qhov Chaw Nyob
Nrhiav khawm Qhov Chaw Nyob
Nrhiav khawm Qhov Chaw Nyob
Nrhiav khawm Qhov Chaw Nyob

Peb tau pom txoj hauv kev yooj yim los nrhiav koj lub pob nyem qhov chaw nyob.

Ua ntej, tuav lub pob ntawm koj lub pob nyem rau li 5 vib nas this kom txog thaum LED pib maj mam strobe xiav. Hauv koj lub xov tooj, qhib koj lub wifi chaw thiab nrhiav 'Amazon Configure Me' wifi. Thaum txuas nrog qhov no, qhib koj lub vev xaib thiab mus rau 'https://192.168.0.1'.

Qhov chaw nyob uas peb tab tom nrhiav yog MAC chaw nyob thiab yuav zoo li "ab: 64: be: 8b: ce: 82".

Kauj Ruam 4: Kuaj Koj Lub Khawm

Koj tuaj yeem lees paub tias koj pom qhov chaw nyob raug los ntawm kev sau ib tsab ntawv yooj yim los luam tawm cov lus txhua zaus thaum lub pob nyem.

Tsim tsab ntawv tshiab sab hauv ntawm kab ntawv-khiav-khawm-npe.

sudo nano khawm_test.js

Thiab luam-muab cov hauv qab no tso rau hauv cov ntawv:

var dash_button = xav tau ('node-dash-button'), dash = dash_button ('xx: xx: xx: xx: xx: xx'), // Hloov nrog koj qhov chaw nyob exec = xav tau ('child_process'). exec; dash.on ('kuaj pom', muaj nuj nqi () {console.log ('Khawm thawb!');});

Hloov x's ntawm kab thib ob nrog koj qhov chaw nyob khawm tshiab pom. Txuag cov ntawv nrog Ctl-x, y.

Pib tsab ntawv thiab nias koj lub pob.

sudo node button_test.js

Koj yuav tsum pom "Khawm thawb!" luam tawm. Tam sim no peb tuaj yeem tshawb pom lub pob nyem, peb tuaj yeem ua qhov ua raws lawv!

Kauj Ruam 5: Teeb Tus Thawj Xaib Nyiaj

Teeb Thawj Lub Xeev Tus Kheej
Teeb Thawj Lub Xeev Tus Kheej
Teeb Thawj Lub Xeev Tus Kheej
Teeb Thawj Lub Xeev Tus Kheej

Tam sim no peb tuaj yeem ua rau muaj kab lus hais kom ua thaum peb nias lub pob Dash, peb tuaj yeem ua txhua yam ntawm lwm yam! Hauv qhov no kuv yuav ua rau muaj kab lus - peb tsis xav kom leej twg nyob ntawm lub qhov rooj tos kom txog thaum peb txheeb xyuas peb tus email.

Muaj ob peb txoj hauv kev los ua cov ntawv ceeb toom - cov kev pabcuam zoo li Twilio lossis PushBullet. Ib txoj hauv kev yooj yim tshaj plaws uas kuv pom yog los ntawm Lub Xeev Pib. Nws xav tau qhov tsawg kawg nkaus ntxiv coding thiab muab rau kuv nrog lub dashboard saib ntawm thaum twg kuv lub pob tau raug nias.

Mus rau https://iot.app.initialstate.com thiab tsim tus as khauj tshiab.

Koj yuav tsum teeb tsa Thawj Lub Xeev SDK rau NodeJS rau koj lub desktop/laptop/Raspberry Pi. Ntawm qhov hais kom ua sai sai (tsis txhob hnov qab SSH rau hauv koj tus Pi thawj), khiav cov lus txib hauv qab no:

cd/tsev/pi/node_modules/node-dash-button

sudo npm nruab qhov pib-xeev

Txhawm rau ntsuas tus kwj, tsim cov ntawv xeem:

nano stream_test.js

Thiab luam-muab cov hauv qab no (tseem pom ntawm no):

var IS = xav tau ('pib-xeev');

var thoob = IS.bucket ('NodeJS_SDK_Example', 'YOUR_ACCESS_KEY_GOES_HERE'); // Thawb qhov tshwm sim rau thawj lub xeev thoob.push ('Demo State', 'active'); setTimeout (muaj nuj nqi () {// Thawb lwm qhov xwm txheej bucket.push ('Demo State', 'inactive');}, 1000);

Txuag tsab ntawv nrog Ctl-x, y.

Ua ntej peb tuaj yeem khiav tsab ntawv no, txawm li cas los xij, peb yuav tsum ntxiv qhov tshwj xeeb Access Key rau kab thib ob.

Ntawm kab 2, koj yuav pom kab uas pib nrog var thoob = IS.bucket (…. Cov kab no tsim cov ntaub ntawv tshiab lub npe “NodeJS_SDK_Example” thiab cuam tshuam nrog koj tus as khauj. Qhov kev koom tes no tshwm sim vim qhov ntsuas thib ob ntawm qhov ntawd Koj tus Thawj Xib Fwb tus lej nkag mus rau tus lej nkag mus yog cov ntawv ntev thiab cov lej. Yog tias koj mus rau koj Lub Xeev Tus Thawj Coj hauv koj lub vev xaib, nyem rau ntawm koj lub npe siv nyob rau sab xis saum toj, tom qab ntawd mus rau "kuv qhov chaw", koj yuav pom koj tus yuam sij nkag mus rau ntawd.

Khiav cov ntawv xeem kom paub tseeb tias peb tuaj yeem tsim cov ntaub ntawv xa mus rau koj Tus Thawj Xeev tus as khauj. Khiav cov hauv qab no:

node stream_test.js

Rov qab mus rau koj lub Xeev Thawj tus lej hauv koj lub vev xaib. Ib lub thoob cov ntaub ntawv tshiab hu ua "NodeJS_SDK_Example" yuav tsum tau tshwm nyob rau sab laug hauv koj lub txee log (tej zaum koj yuav tau rov ua nplooj ntawv tshiab). Nyem rau ntawm lub thoob no txhawm rau saib cov ntaub ntawv xeem.

Tam sim no koj tau npaj txhij xa koj lub pob nyem rau Lub Xeev Pib!

Kauj Ruam 6: Txoj Cai Kawg

Txoj Cai Kawg
Txoj Cai Kawg

Peb twb tau teeb tsa Lub Xeem Pib Hauv Ntej SDK, yog li txhua yam peb yuav tsum tau ua yog ntxiv nws rau peb cov cai!

Nov yog qhov hloov kho ntawm tsab ntawv button_test.js peb tau siv ua ntej:

var dash_button = xav tau ('node-dash-button'), dash = dash_button ('xx: xx: xx: xx: xx: xx'), // Hloov nrog koj qhov chaw nyob exec = xav tau ('child_process'). exec; var IS = xav tau ('pib-xeev'); var thoob = IS.bucket ('Doorbell', 'YOUR_ACCESS_KEY'); dash.on ('kuaj pom', muaj nuj nqi () {console.log ('Khawm thawb!'); bucket.push ('Lub Qhov Rooj Hauv Paus', 'Ib Tus Neeg Nyob Ntawm No!');});

Luam-muab cov ntawv no tso rau hauv cov ntaub ntawv tshiab (tseem nyob sab hauv ntawm kab ntawv-khiav-khawm-npe):

sudo nano doorbell.js

Koj yuav pom tias ntawm kab 5 thiab 6 peb suav nrog Lub Xeem Pib Hauv Xeev thiab muab peb lub thoob ntim. Koj yuav tsum tso koj tus lej nkag mus tshwj xeeb los ntawm ua ntej ntawm kab 6.

Kab 10 yog qhov uas peb xa cov ntaub ntawv mus rau Lub Xeev Pib. Hauv qhov no, Kuv tau hu kuv lub thoob "Doorbell" thiab kuv tso tawm "Qee leej nyob Ntawm no!" ntawm kuv lub qhov rooj. Yog tias koj muaj ntau lub khawm Dash, koj tuaj yeem xa lawv txhua tus mus rau lub thoob "Doorbell" tab sis npe lawv raws li lawv qhov chaw nyob (piv txwv li "Qhov Rooj Qhov Rooj", "Chav pw", thiab lwm yam).

Txuag tsab ntawv nrog Ctl-x, y.

Txhawm rau ntsuas koj tsab ntawv, khiav:

sudo node doorbell.js.

Thaum koj nias koj lub pob, koj yuav tsum muaj peev xwm mus rau koj Lub Xeev Thawj nplooj ntawv thiab pom lub thoob tshiab hu ua "Doorbell" nyob rau sab xis. Tam sim no cia ntxiv Qhov Ua Rau!

Kauj ruam 7: Teeb tsa SMS Ua

Teem tus SMS Trigger
Teem tus SMS Trigger

"Triggers" yog Thawj Lub Xeev cov ntawv tshaj tawm thiab lawv yooj yim ntxiv. Tsuas yog nyem "Chaw" nyob hauv qab ntawm lub thoob lub qhov rooj, thiab tom qab ntawd nyem rau ntawm "Triggers" tab.

Koj tuaj yeem xaiv lub teeb liab uas koj xav kom tshem tawm los ntawm cov npe teev cia. Peb lub thoob tsuas muaj ib qho - "Lub Qhov Rooj" - yog li xaiv qhov ntawd. Tom qab ntawd xaiv qhov "phim" qhov kev xaiv thiab ntxiv cov lus koj tau tshaj tawm thaum koj lub pob nyem - hauv qhov no "Ib tus neeg nyob ntawm no!"

Thaum kawg, ntxiv koj tus lej xov tooj kom tau txais SMS lus. Koj yuav tsum tau nkag mus rau tus lej pov thawj xa mus rau koj lub xov tooj thawj zaug koj siv tus lej ntawd.

Nco ntsoov tias koj nias lub cim "+" nyob ib sab ntawm koj tus lej xov tooj lossis tus txhais yuav tsis tsim.

Nyem "Ua" hauv qab ntawm Triggers tab kom txuag tau koj txhais tes.

Tam sim no koj npaj tau txais ntawv ceeb toom! Nias koj lub pob (thaum lub pob qhov rooj.js tsab ntawv tseem tab tom ua haujlwm). Koj yuav tsum tau txais cov ntawv hauv 8 vib nas this lossis tsawg dua!

Koj lub qhov rooj ntsiag to tau npaj txhij mus! Yog tias koj xav kom ntseeg tau tias koj cov ntawv rov pib dua ntawm lub zog hluav taws xob, txuas ntxiv nyeem. Kuv tseem yuav dhau mus ntxiv emojis rau koj lub thoob thiab lub npe teeb liab.

Kauj ruam 8: Personalizing Your Dashboard

Personalizing Koj Dashboard
Personalizing Koj Dashboard
Personalizing Koj Dashboard
Personalizing Koj Dashboard

Yog tias koj xav ua kom zoo li koj Lub Xeev Thawj lub dashboard, ntxiv emojis lossis hloov npe tag nrho yog yooj yim heev.

Txhawm rau hloov lub npe ntawm cov nplais, tsuas yog nyem rau ntawm cov nplais thiab xaiv "kho cov nplais". Sab hauv ntawm Lub Npe Lub Npe uas tuaj txog koj tuaj yeem tso qhov luv rau ib qho emoji. Nyem "x" nyob rau sab saud ntawm lub qhov rai teeb tsa yuav txuag koj qhov kev hloov pauv.

Koj tseem tuaj yeem ua qhov no rau lub npe ntawm koj lub thoob los ntawm txhaj rau "Chaw" hauv qab lub thoob lub npe thiab tom qab ntawd kho lub Npe Npe.

Koj tuaj yeem ntxiv cov duab keeb kwm yav dhau los rau koj lub dashboard kom muab koj cov ntaub ntawv ntau tus kheej thiab cov ntsiab lus.

Kauj Ruam 9: Pib Tsab Ntawv Los Ntawm Khau raj

Tsab ntawv uas koj tau khiav ntawm koj lub khoos phis tawj hauv tsev lossis Pi yog tus yuam sij rau peb lub qhov rooj ntsiag to. Yog tias muaj qee yam tshwm sim zoo li lub hwj chim tsis txaus, peb xav kom paub tseeb tias peb tsab ntawv rov qab los thiab ua haujlwm.

Ntawm Mac Peb yuav siv qhov kev pabcuam hu ua crontab thiab nano text editor:

env EDITOR = nano crontab -e

Sab hauv ntawm cov ntawv, ntxiv:

@reboot nohup sudo node /Users/UserName/node_modules/node-dash-button/doorbell.js &

Nco ntsoov hloov "UserName" nrog koj tus kheej. Yog tias koj lub npe koj tsab ntawv lwm yam lossis muab tso rau hauv cov npe sib txawv, hloov /Users/UserName/node_modules/node-dash-button/doorbell.js nrog txoj hauv kev raug. Txoj hauv kev hauv kuv qhov piv txwv yog cov npe siv tseem ceeb ua raws los ntawm node_modules/node-dash-button directory. Koj tuaj yeem yooj yim luam daim ntawv lub npe kab ntawv los ntawm kev ua raws cov lus qhia no.

Txuag cov ntaub ntawv nrog Ctl-x, y. Koj tuaj yeem sim yog tias nws ua haujlwm los ntawm kev rov pib dua koj lub computer.

Ntawm Windows ua raws cov lus qhia ntawm no txhawm rau pib koj cov ntawv ntawm kev rov pib dua. Nco ntsoov qhia kom meej kab ntawv tag nrho txoj hauv kev.

Ntawm Raspberry Pi/Linux Tshuab Khiav ib tsab ntawv los ntawm khau raj ntawm Pi yog qhov yooj yim zoo nkauj. Peb yuav siv qhov kev pabcuam hu ua crontab:

sudo crontab -e

Xaiv qhov koj nyiam cov ntawv sau (Kuv nyiam nano) thiab hauv qab ntawm cov ntawv (hauv qab txhua qhov lus pom), ntxiv:

@reboot nohup sudo node /home/pi/node_modules/node-dash-button/doorbell.js &

Yog tias koj sau koj cov ntawv lwm yam lossis muab tso rau hauv cov npe sib txawv, hloov /home/pi/node_modules/node-dash-button/doorbell.js nrog txoj hauv kev raug. Txoj hauv kev hauv kuv qhov piv txwv yog lub npe Pi tseem ceeb ua raws los ntawm node_modules/node-dash-button directory.

Txuag cov ntaub ntawv! Koj yuav tsum tau rov pib dua kom nws muaj txiaj ntsig, tab sis yog tias koj tseem xav rov pib dua yog tias kev txuas hauv internet poob qis, peb yuav ntxiv lwm txoj haujlwm rau peb crontab hauv cov kauj ruam tom ntej no.

Txhawm rau daws cov teeb meem hauv network, Kuv txiav txim siab tsuas yog siv txoj hauv kev rau Pi txhawm rau txheeb xyuas kev sib txuas hauv network thiab rov pib dua yog tias nws tsis nyob ntawd.

Ua ntej peb yuav tsum tsim tsab ntawv txhawm rau txheeb xyuas WiFi thiab tom qab ntawv kaw:

ua cd

sudo nano /usr/local/bin/checkwifi.sh

Muab cov hauv qab no tso rau hauv cov ntawv, nco ntsoov hloov tus IP chaw nyob nrog tus IP chaw nyob ntawm koj lub router:

ping -c4 IP_ADDRESS> /dev /null

yog [$? ! = 0] ces sudo /sbin /kaw -r tam sim no fi

Tus ping tshawb xyuas qhov txuas. Yog tias nws rov qab los nrog tus lej tsis-xoom tawm, tsab ntawv xa cov lus txib kaw. Txuag thiab tawm ntawm tsab ntawv. Tam sim no kom ntseeg tau tias nws qhov kev tso cai tau ua:

sudo chmod 775 /usr/local/bin/checkwifi.sh

Ib yam li peb cov ntawv doorbell.js, peb yuav ntxiv cov ntawv no rau crontab:

sudo crontab -e

Qhov chaw

*/5 * * * */usr/bin/sudo -H /usr/local/bin/checkwifi.sh >>/dev/null 2> & 1

hauv qab kab peb ntxiv ua ntej. Qhov no yuav khiav peb cov ntawv checkwifi txhua 5 feeb. Tam sim no tawm ntawm crontab thiab rov pib dua Pi:

sudo rov pib dua

Txhua yam yuav tsum teeb tsa thiab ua haujlwm! Koj tseem tuaj yeem teeb tsa txoj hauv kev los saib xyuas cov txheej txheem khiav ntawm Pi los ntawm kev ua raws cov lus qhia no.

Kauj ruam 10: Xaus

Xaus
Xaus

Tam sim no koj muaj lub qhov rooj ntsiag to kom cov tub Amazon xa los ntawm kev tsa koj! Qhia rau kuv paub yog tias koj muaj lus nug lossis tuaj nrog cov kev hloov kho tshwj xeeb.

Pom zoo: