Cov txheej txheem:

FlowerCare thiab Nymea los cawm Kuv Nroj Tsuag: 5 Kauj Ruam
FlowerCare thiab Nymea los cawm Kuv Nroj Tsuag: 5 Kauj Ruam

Video: FlowerCare thiab Nymea los cawm Kuv Nroj Tsuag: 5 Kauj Ruam

Video: FlowerCare thiab Nymea los cawm Kuv Nroj Tsuag: 5 Kauj Ruam
Video: Orchid Care for Beginners - How to make Phalaenopsis Orchid flowers last longer 2024, Hlis ntuj nqeg
Anonim
FlowerCare thiab Nymea los cawm Kuv Nroj Tsuag
FlowerCare thiab Nymea los cawm Kuv Nroj Tsuag

Tau txais tes qias neeg ntawm kev nqes mus cog cov cuab yeej saib xyuas rau kuv lub tsev qhib qhov ntse hauv tsev. Kev taug kev ntawm kev txhim kho plugin rau nymea.

Zaj dab neeg

Raws li ntau lwm tus kws tshaj lij thiab cov neeg nyiag nkas, kuv raug kev txom nyem dhau los ntawm qhov teeb meem uas nyiag nkas ntawm txhua yam yuav siv sijhawm ntau heev uas kuv qee zaum tsis nco qab ywg dej rau kuv cov nroj tsuag. Tom qab kuv Monstera Deliciosa raug kev txom nyem los ntawm cov av qhuav, kuv txiav txim siab saib seb kuv puas tuaj yeem ua qee yam txog nws kom nco kuv thaum nws nqhis dej.

Kev tshawb fawb nrawm ntawm lub vev xaib coj kuv mloog mus rau Xiaomi FlowerCare, tseem hu ua MiCare lossis PlantCare. Nws yog Bluetooth Low Energy device thiab qee qhov kev tshawb fawb pib qhia tias nws cov txheej txheem zoo li nkag siab yooj yim heev. Thaum Xiaomi tsis zoo li muab cov kev qhia tshwj xeeb rau pej xeem, tau muaj me ntsis ntawm kev thim rov qab engineering hauv is taws nem rau cov cuab yeej no. Yog li kuv txiav txim siab xaj ib qho ntawm cov ntawd.

Ob peb hnub tom qab nws tau xa thiab tau kawg kuv pib ua si ib puag ncig nrog nws tam sim ntawd. Kuv tau txheeb xyuas luv luv ntawm lub app uas los nrog nws tab sis raws li koj tej zaum tuaj yeem kwv yees, siv nws hauv nws qhov teeb tsa ua ntej yeej tsis yog kuv li phiaj xwm. Tau kawg qhov no yuav tsum tau koom ua ke nrog kuv lub tsev ntse uas twb muaj lawm. Koj tseem tau piav qhia ntawm no Kuv siv nymea ua kuv li kev daws teeb meem hauv tsev (Yog, koj tuaj yeem pom Monstera hauv ib ntawm cov duab muaj:)). Hmoov tsis zoo, nymea tsis txhawb lub sensor ntawd tseem ua rau qee qhov IDE raug txiav txim.

Kauj ruam 1: Tau txais Plugin Stub Loaded

Tau txais Plugin Stub Loaded
Tau txais Plugin Stub Loaded
Tau txais Plugin Stub Loaded
Tau txais Plugin Stub Loaded
Tau txais Plugin Stub Loaded
Tau txais Plugin Stub Loaded

Yog li thawj qhov kuv tau ua yog theej cov Texas Instruments Sensor Tag plugin uas twb muaj lawm, nws zoo li txaus rau qhov kuv xav tias yuav tsum ua haujlwm rau FlowerCare ntaus ntawv ib yam. Tom qab kev hloov pauv yooj yim ntawm yam khoom hauv plugininfo.json thiab tawm tswv yim feem ntau ntawm cov sensortag plugin tus lej Kuv tau npaj siab ntsaws cov plug tshiab tshiab.

Raws li kev cia siab, kev tshawb pom yuav tau qhia lub ntsuas tam sim thiab tso cai rau kuv ntxiv nws rau hauv kab ke. Tau kawg nws yuav tsis tsim cov ntaub ntawv muaj txiaj ntsig ntawm qhov no.

Kauj Ruam 2: Nrhiav Cov Ntaub Ntawv ntawm Sensor

Nrhiav Cov Ntaub Ntawv ntawm Sensor
Nrhiav Cov Ntaub Ntawv ntawm Sensor

Raws li nrog txhua lub Bluetooth LE ntaus ntawv, thawj qhov koj xav ua yog nrhiav kom paub txog cov kev pabcuam nws muab thiab lawv tus yam ntxwv. Ib qhov twg hauv qhov ntawd cov ntaub ntawv raug zais. Nrog kev debug luam nrawm looping hla txhua qhov kev pabcuam pom thiab luam tawm lawv tus yam ntxwv Kuv nyob ntawm qhov chaw uas kuv tuaj yeem sib piv cov ntaub ntawv kuv pom hauv internet nrog dab tsi ntawm lub cuab yeej tau tshaj tawm.

tsis muaj dab tsi FlowerCare:: onServiceDiscoveryFinished () {BluetoothLowEnergyDevice *btDev = zoo li qub_cast (sender ()); qCDebug (dcFlowerCare ()) << "muaj kev pabcuam uuids" xws li ()-> createServiceObject (sensorServiceUuid, qhov no); txuas (m_sensorService, & QLowEnergyService:: stateChanged, qhov no, & FlowerCare:: onSensorServiceStateChanged); txuas (m_sensorService, & QLowEnergyService:: yam ntxwv Nyeem, qhov no, & FlowerCare:: onSensorServiceCharacteristicRead); m_sensorService-> discoverDetails (); } void FlowerCare:: onSensorServiceStateChanged (const QLowEnergyService:: ServiceSate & xeev) {yog (xeev! = QLowEnergyService:: ServiceDiscovered) {xa rov qab; } foreach (const QLowEnergyCharacteristic & characteristic, m_sensorService-> yam ntxwv ()) {qCDebug (dcFlowerCare ()). nospace () <"<< yam ntxwv.uuid (). toString () <<" ("<< yam ntxwv.handle () << "Lub Npe:" << yam ntxwv.name () << "):" << yam ntxwv.value () << "," << yam ntxwv.value (). ToHex (); foreach (const QLowEnergyDescriptor & piav qhia, yam ntxwv.descriptors ()) {qCDebug (dcFlowerCare ()). nospace () <"<< descriptor.uuid (). toString () <<" ("<< descriptor.handle () <<" Name: "<< descriptor.name () << "):" << descriptor.value () << "," << descriptor.value (). toHex (); }}}

Cov firmware version thiab qib roj teeb tau yooj yim. Kuv tuaj yeem pom pom raws li qhov muaj txiaj ntsig luam tawm hauv qhov kev sim ua thawj zaug ntawm cov npe cov ntaub ntawv. Qhov txiaj ntsig ntawm qhov tseeb tau zais me ntsis tob hauv qhov ntawd, tab sis muab nws nrog cov ntaub ntawv los ntawm internet tam sim ntawd taw qhia qhov twg los nrhiav nws thiab tshwj xeeb yog yuav nyeem nws li cas.

tsis muaj dab tsi FlowerCare:: onSensorServiceCharacteristicRead (const QLowEnergyCharacteristic & yam ntxwv, const QByteArray & tus nqi) {qCDebug (dcFlowerCare ()) << "Yam ntxwv nyeem" << QString:: tus xov tooj (tus yam ntxwv.handle (), 16) temp; qint8 hla; kwj >> hla; qis 32lux;. kwj >> lux; qint8 ya raws; dej >> noo noo; qint16 fertility; kwj >> fertility; emit tiav (m_batteryLevel, 1.0 * temp / 10, lux, noo noo, fertility); }

Muab qhov no ua ke, lub plugin twb pib tsim cov ntaub ntawv muaj txiaj ntsig.

Kauj Ruam 3: Tiav Touches

Tiav Touches
Tiav Touches

Yog li nws pib ua haujlwm tam sim no, txawm li cas los xij, ib qho teeb meem tseem tshuav nyob ntawd. FlowerCare sensor yuav, tsis zoo li Texas Instruments SensorTag, tso Bluetooth txuas tom qab ob peb feeb. Xav txog kev siv rooj plaub tab sis, qhov no tsis zoo li yog qhov teeb meem vim nws ntseeg tau zoo hauv kev teb rau kev sim txuas. Muab qhov uas ib txwm cog tsis nqus ib litre dej hauv ob peb feeb, tab sis ntau hnub, nws tsis zoo li xav tau kom nyob txuas nrog txhua lub sijhawm. Tsis tas li qhov no yuav ua rau lub roj teeb ntau heev. Yog li kuv txiav txim siab ntxiv PluginTimer uas yuav rov txuas lub sensor txhua 20 feeb thiab nqa cov ntaub ntawv los ntawm nws. Yog tias, rau qee qhov laj thawj, lub ntsuas cua yuav tsis teb rau qhov kev sib txuas, txoj cai yuav pib lwm lub sijhawm uas sim rov txuas txhua feeb los ntawm qhov ntawd mus txog thaum nws tswj kom tau txais cov ntaub ntawv. Tom qab ntawd nws yuav rov qab mus nqa cov ntaub ntawv ntawm lub sijhawm 20 feeb ntxiv. Yog tias lub cuab yeej tsis txuas ob zaug hauv ib kab (lub ntsiab lus, tom qab 20 + 1 feeb), nws yuav raug cim offline hauv cov kab ke thiab tus neeg siv tuaj yeem ceeb toom txog nws.

void DevicePluginFlowercare:: onPluginTimer () {foreach (FlowerCare *flowerCare, m_list) {if (--m_refreshMinutes [flowerCare] <= 0) {qCDebug (dcFlowerCare ()) << "Refreshing" chaw nyob (); flowerCare-> refreshData (); } lwm tus {qCDebug (dcFlowerCare ()) << "Tsis ua kom rov zoo" chaw nyob () << "Rov ua dua tshiab tom ntej hauv" << m_refreshMinutes [flowerCare] << "feeb"; } // Yog tias peb muaj 2 lossis ntau qhov ua tsis tau zoo txuas txuas, kos nws ua kev sib txuas yog tias (m_refreshMinutes [flowerCare] <-2) {qCDebug (dcFlowerCare ()) << "Ua tsis tau tejyam rov los rau" << (m_refreshMinutes [flowerCare] *) -1) <setStateValue (flowerCareConnectedStateTypeId, tsis tseeb); }}}

Nrog lub tswv yim no nymea tam sim no zoo li xa cov ntaub ntawv ntseeg tau zoo los ntawm lub ntsuas no.

Kauj Ruam 4: Siv Nws Hauv Cov Ntsiab Lus Loj

Siv Nws hauv Cov ntsiab lus loj dua
Siv Nws hauv Cov ntsiab lus loj dua
Siv Nws hauv Cov ntsiab lus loj dua
Siv Nws hauv Cov ntsiab lus loj dua

Tsuas yog tau txais qhov muaj txiaj ntsig los ntawm lub ntsuas hluav taws xob tsis yog qhov muaj txiaj ntsig ntau txawm hais tias, Kuv kuj tseem tuaj yeem siv thawj daim ntawv thov rau qhov ntawd. Tam sim no cia ua qee yam ntse nrog nws.

Nymea txhawb nqa xa cov ntawv ceeb toom, xws li rau cov xov tooj nrog nymea: app teeb tsa, lossis ntawm PushBullet. Yog li qhov pom tseeb ua yog xa kuv tus kheej qee qhov kev ceeb toom thawb thaum cov av noo noo qis dua 15%. Nws yooj yim dua los teeb tsa qhov ntawd hauv lub app. Raws li qhov yuav tsum tau ua ntej koj yuav xav tau tus as khauj hauv nymea: huab lossis ntawm PushBullet. Rau nymea: huab raws cov ntawv ceeb toom nws txaus los pab kom nymea: huab ntawm nymea: core thiab hauv nymea: app. Sai li ob qho tib si txuas nrog, cov ntawv ceeb toom yuav tshwm sim. Txog PushBullet ntxiv qhov tshiab hauv kab ke, koj yuav pom PushBullet hauv cov npe muaj. Nws yuav nug koj txog tus lej API koj tau txais thaum kos npe nrog PushBullet. Thaum koj muaj qhov ceeb toom thawb hauv nymea, koj tuaj yeem tsim txoj cai.

Tau kawg koj tuaj yeem ua dab tsi ntxiv uas koj xav tau … Tseem tuaj yeem tig lub teeb kom pom kev pom qhov tseem ceeb, lossis siv HTTP tus thawj tswj hwm plugin los tshaj tawm qhov ntsuas qhov ntsuas rau tus neeg rau zaub mov hauv internet piv txwv li. Kuv tsis muaj lub qhov dej uas tuaj yeem tswj tau digitally (tseem) tab sis tau kawg, yog tias koj muaj qhov zoo li no thiab nws tsis tau txais kev txhawb nqa los ntawm nymea tsis tau, ntxiv lub plugin rau qhov uas yuav zoo dua li qhov no.

Kauj Ruam 5: Kaw Cov Lus

Kaw Cov Lus
Kaw Cov Lus

Lub paj paj txuas ntxiv tau lees txais los ntawm tam sim no thiab yog tias koj muaj ib qho ntawm cov uas nws tau npaj tau siv nrog nymea tam sim no. Txawm li cas los xij, Kuv vam tias tsab xov xwm no yuav muaj kev txaus siab yog tias ib tus neeg xav ntxiv kev txhawb nqa rau lwm yam khoom siv. Nws yuav tsum yog taug kev ntawm yuav tsim koj li plugin rau nymea li cas.

Yog tias koj tsuas xav tsim qhov teeb tsa no ntawm koj lub tsev, txhua yam koj xav tau yog FlowerCare sensor, Raspberry Pi, lub zej zog nymea duab (nws suav nrog kev saib xyuas paj paj tam sim no), thiab nymea: app uas muaj nyob hauv khw app. Tsis tas li, txog tam sim no kuv Monstera Deliciosa zoo siab dua thiab zoo li koj yuav tau pom hauv cov duab, Kuv tau txais kuv tus kheej thib ob ntawm cov ntsuas kom taug qab kev noj qab haus huv ntawm kuv tsob ntoo txiv qaub ib yam. Txog qhov ntawd kuv tau xa kuv tus kheej thawb ceeb toom thaum twg nws khov sab nraud yog li kuv tuaj yeem coj nws hla lub caij ntuj no yam nyab xeeb.

Pom zoo: