homebridge-people-x

我要开发同款
匿名用户2021年12月10日
50阅读
开发技术JavaScript
所属分类其他开源、物联网
授权协议Readme

作品详情

NOTE:Sinceversion0.5theconfigurationchangedtoplatform.Youmustfixyourconfigurationtomatchthenewconfigurationformat.

homebridge-people-x

Thisisapluginforhomebridge.Itmonitorswhoisathome,basedontheirsmartphonebeingseenonthenetworkrecently.IfyouusetheEVE.appyoucanalsoseethepresencehistoryofeveryperson-sensor(poweredbyfakegato)

Itcanalsoreceivewebhookssentbylocation-awaremobileapps(suchasLocative,whichcanuseiBeaconsandgeofencingtoprovidefasterandmoreaccuratelocationinformation.

InstallationInstallhomebridge(ifnotalreadyinstalled)using:npminstall-ghomebridgeInstallthispluginusing:npminstall-ghomebridge-people-xUpdateyourconfigurationfile.Seebelowforasample.Configuration"platforms":[{"platform":"PeopleX","threshold":15,"anyoneSensor":true,"nooneSensor":false,"webhookPort":51828,"cacheDirectory":"./.node-persist/storage","pingInterval":10000,"ignoreReEnterExitSeconds":0,"people":[{"name":"Pete","target":"PetesiPhone","threshold":15,"pingInterval":10000,"ignoreReEnterExitSeconds":0},{"name":"SomeoneElse","target":"192.168.1.68","threshold":15,"pingInterval":10000,"ignoreReEnterExitSeconds":0}]}]ParameterNotethresholdoptional,inminutes,default:15anyoneSensoroptional,default:truenooneSensoroptional,default:falsewebhookPortoptional,default:51828cacheDirectoryoptional,default:"./.node-persist/storage"pingIntervaloptional,inmilliseconds,default:10000,ifsetto-1thanthepingmechanismwillnotbeusedignoreReEnterExitSecondsoptional,inseconds,default:0,ifsetto0thaneveryenter/exitwilltriggerstatechangeotherwisethestatewillonlychangeifnore-enter/exitoccursinspecifiednumberofsecondstargetmaybeeitherahostnameorIPaddressnameahuman-readablenameforyoursensorHowitworksWhenstartedhomebridge-peoplewillcontinuallypingtheIPaddressassociatedwitheachpersondefinedinconfig.jsonifpingIntervalisnotsetto-1.WithaniBeaconorgeofencingsmartphoneapp,youcanconfigureaHTTPpushtotriggerwhenyouenterandexityour'home'region.Thisdatawillbecombinedwiththepingfunctionalityifusedtogivethispluginmoreprecisepresencedata.Whenapingissuccessfulthecurrenttimestampisloggedtoafile(seen.db.json)WhenaHomekitenabledapplooksupthestateofaperson,thelastseentimeforthatpersonsdeviceiscomparedtothecurrenttimeminusthresholdminutes,andifitisgreaterassumesthatthepersonisactive.'Anyone'and'NoOne'sensors

SomeHomeKitautomationsneedtohappenwhen"anyone"ishomeorwhen"noone"isaround,butthedefaultHomeappmakesthisdifficult.homebridge-peoplecanautomaticallycreateadditionalsensorscalled"Anyone"and"NoOne"tomaketheseautomationsveryeasy.

Forexample,youmightwanttorunyour"ArriveHome"scenewhenAnyonegetshome.Orrun"LeaveHome"whenNoOneishome.

Thesesensorscanbeenabledbyadding"anyoneSensor":trueand"nooneSensor":truetoyourhomebridgeconfig.jsonfile.

Accuracy

Thispluginrequiresthatthedevicesbeingmonitoredareconnectedtothenetwork.iPhones(andIexpectothers)deliberatelydisconnectfromthenetworkoncethescreenisturnedofftosavepower,meaningjustbecausethedeviceisn'tconnected,itdoesn'tmeanthatthedevicesownerisn'tathome.Fortunately,iPhones(andIexpectothers)periodicallyreconnecttothenetworktocheckforupdates,emails,etc.Thispluginworksbykeepingtrackofthelasttimeadevicewasseen,andcomparingthattoathresholdvalue(inminutes).

Fromaverylimitedamountoftesting,I'vefoundthatathresholdof15minutesseemstoworkwellforthephonesthatIhavearound,butfordifferentphonesthismayormaynotwork.Thethresholdcanbeconfiguredinthe.homebridge/config.jsonfile.

Additionally,ifyou'reusingalocation-awaremobileapptorangeforiBeaconsandgeofences,thisplugincanreceiveaHTTPpushfromtheapptoimmediatelyseeyouaspresentornotpresentwhenyouphysicallyenterorexityourdesiredregion.Thisisparticularlyusefulfor"ArriveHome"and"DepartHome"HomeKitautomationswhichideallyhappenfasterthanevery15minutes.

Pairingwithalocation-awaremobileapp

AppslikeLocativerangeforiBeaconsandgeofencesbyusingcorelocationAPIsavailableonyoursmartphone.Withbluetoothandlocationservicesturnedon,theseappscanprovideaninstantaneousupdatewhenyouenterandexitadesiredregion.

Tousethispluginwithoneoftheseapps,configureyourregionandsettheHTTPpushtohttps://youripaddress:51828/?sensor=[name]&state=trueforarrival,andhttps://youripaddress:51828/?sensor=[name]&state=falsefordeparture,where[name]isthenameofthepersonthedevicebelongstoasspecifiedinyourconfigunderpeople.Note:youmayneedtoenableportforwardingonyourroutertoaccomplishthis.

Bydefaulthomebridge-peoplelistensonport51828forupdates.ThiscanbechangedbysettingwebhookPortinyourhomebridgeconfig.json.

NotesRunningonaraspberrypiasnon'pi'user

Onsomeversionsofraspbian,usersarenotabletousethepingprogrambydefault.Ifnoneofyourdevicesshowonlinetryrunningsudochmodu+s/bin/ping.Thankstooberstmuellerforthetip.

Runninginadocker-environment

Onsomedocker-environments(alpine-basedforexample)itispossiblethatthepingdoesnot.Pleasetrytoinstalliptoolsinthiscaseviaapkaddiputils--no-cache

Thanks

Thankstoeveryonewho'shelpedcontributecode,feedbackandsupport.Inparticular:

PeteLawrence-forthepluginwhichthisoneisforkedfromsimont77-forthefakegato-pluginwr-foraddinginwebhooksupport.benzman81-forportingthepluginovertobeaPlatformandimprovinghowpingandwebhooksworktogether,andnumerousotherfixes.
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论