Cov txheej txheem:

Tsev Automation Nrog NodeMCU, HomeAssistant & MQTT: 6 Cov Kauj Ruam
Tsev Automation Nrog NodeMCU, HomeAssistant & MQTT: 6 Cov Kauj Ruam

Video: Tsev Automation Nrog NodeMCU, HomeAssistant & MQTT: 6 Cov Kauj Ruam

Video: Tsev Automation Nrog NodeMCU, HomeAssistant & MQTT: 6 Cov Kauj Ruam
Video: 5 Yam: Txhob pub muaj nyob hauv Tsev (Tsis Zoo) 2024, Kaum ib hlis
Anonim
Image
Image

Koj puas xav pib hloov pauv koj lub tsev hauv tsev ntse? Thiab tseem yuav ua qhov pheej yig?

NodeMCU thiab HomeAssistant nyob ntawm no los pab txog qhov ntawd. Kuv qhia koj kom saib cov vis dis aus no, tej zaum nws yuav yooj yim rau koj ua raws. Txwv tsis pub, ua raws cov theem hauv qab no.

Khoom siv

1 × NodeMCU v3 NodeMCU ntawm eBay:

2 × Breadboards Breadboards ntawm eBay:

1 × Photoresistor Photoresistor ntawm eBay:

1 × Sib nqus sib nqus Sib nqus hloov ntawm eBay:

1 × Relay Relay ntawm eBay:

1 × Khawm Khawm thiab Cov Tiv Thaiv ntawm eBay:

7 × Resistors (2x 10kohm, 4x 100ohm, 1x 4.7kohm)

4 × LEDs LEDs ntawm eBay:

20 × Cov Hluav Taws Xob Hluav Taws Xob ntawm eBay:

1 × Kub sensor DALLAS Kub ntsuas ntawm eBay:

1 × Tsab ntawv tsa suab sensor (PIR) Tsab ntawv tsa suab sensor:

1 × ADDITIONAL: Lub txhab nyiaj fais fab

Kauj ruam 1:

Duab
Duab

Nyob zoo!

Tau txais txhua yam khoom siv xav tau (cov khoom siv) thiab cia pib.

Kauj ruam 2:

Txuas tag nrho cov khoom sib xyaw kom haum rau qhov kos duab tsis meej no. Thov txim vim xaim xaim.:(

Kauj ruam 3:

Duab
Duab

Nruab PlatformIO IDE, HomeAssistant + Python

Ib zaug ntxiv, koj tuaj yeem ua raws cov vis dis aus no kom pom cov ntsiab lus ntxiv txog kev teeb tsa HomeAssistant thiab Python. Txhawm rau ua raws cov kauj ruam ib kauj ruam PlatformIO teeb tsa thiab pom yuav ua li cas upload yooj yim ntsais muag LED qhov kev zov me nyuam txheeb xyuas cov vis dis aus no.

Thov nco ntsoov tias koj tsis tas yuav siv nruj me ntsis PlatformIO IDE, tab sis nws yuav yooj yim rau koj ua raws.

Kauj ruam 4:

Duab
Duab

Luam cov cai rau main.cpp cov ntaub ntawv los ntawm no. Replace mqtt_server IP rau IP ntawm koj lub PC uas HomeAssistant tau teeb tsa. Hloov SSID thiab tus lej zais nrog koj xav tau Wi-nkaus SSID thiab tus password. Upload rau NodeMCU.

Kauj ruam 5:

Duab
Duab

Hauv qhov rai tshawb nrhiav (pib) sau % appdata % thiab qhib.homeassistant folder. There koj yuav pom kev teeb tsa.yaml. Qhib nws thiab hloov tag nrho cov ntsiab lus nrog qhov no.

Ceev faj yog tias sau qee yam ntxiv vim tias teeb tsa yog qhov chaw nkag siab! Nws yuav tsum tau teeb tsa hauv nws cov cai.

Pib HomeAssistant ntawm koj lub PC yog tias nws tsis tau pib dua. Nkag mus rau IP ntawm lub PC ntawd thiab ntxiv chaw nres nkoj: 8123 tom qab nws hauv browser. Hauv kaum sab xis saum toj koj yuav pom kev xaiv teeb tsa UI. Xaiv qhov ntawd thiab dua nyob rau sab xis saum toj pom RAW teeb kho thiab hloov nws cov ntsiab lus nrog qhov no.

Kauj Ruam 6:

Duab
Duab

Txheeb xyuas tias txhua yam txuas nrog raug thiab MQTT ua haujlwm raws li nws yuav tsum tau los ntawm kev xa cov ntaub ntawv txhua ob peb feeb thiab ntsuas seb txhua lub ntsuas cua ua haujlwm li cas.

Ntawm koj lub smartphone mus rau browser thiab nkag mus rau IP ntawm koj tus HomeAssistant server thiab ntxiv chaw nres nkoj: 8123. Txuag nplooj ntawv web rau lub vijtsam hauv tsev thiab koj muaj kev nkag mus rau koj lub tsev siv tshuab hauv tsev tshiab hauv ib tus kais.

Tam sim no thaum kawg kuv txhawb koj kom nthuav txoj haujlwm no kom muaj txiaj ntsig ntau dua thiab tsis yog rau lub hom phiaj kev kawm. Ua tsaug rau koom nrog kuv los ntawm txoj haujlwm no tsim.:)

Pom zoo: