NOTE:Sinceversion0.5theconfigurationchangedtoplatform.Youmustfixyourconfigurationtomatchthenewconfigurationformat.
homebridge-people-xThisisapluginforhomebridge.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'sensorsSomeHomeKitautomationsneedtohappenwhen"anyone"ishomeorwhen"noone"isaround,butthedefaultHomeappmakesthisdifficult.homebridge-peoplecanautomaticallycreateadditionalsensorscalled"Anyone"and"NoOne"tomaketheseautomationsveryeasy.
Forexample,youmightwanttorunyour"ArriveHome"scenewhenAnyonegetshome.Orrun"LeaveHome"whenNoOneishome.
Thesesensorscanbeenabledbyadding"anyoneSensor":trueand"nooneSensor":truetoyourhomebridgeconfig.jsonfile.
AccuracyThispluginrequiresthatthedevicesbeingmonitoredareconnectedtothenetwork.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-awaremobileappAppslikeLocativerangeforiBeaconsandgeofencesbyusingcorelocationAPIsavailableonyoursmartphone.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'userOnsomeversionsofraspbian,usersarenotabletousethepingprogrambydefault.Ifnoneofyourdevicesshowonlinetryrunningsudochmodu+s/bin/ping.Thankstooberstmuellerforthetip.
Runninginadocker-environmentOnsomedocker-environments(alpine-basedforexample)itispossiblethatthepingdoesnot.Pleasetrytoinstalliptoolsinthiscaseviaapkaddiputils--no-cache
ThanksThankstoeveryonewho'shelpedcontributecode,feedbackandsupport.Inparticular:
PeteLawrence-forthepluginwhichthisoneisforkedfromsimont77-forthefakegato-pluginwr-foraddinginwebhooksupport.benzman81-forportingthepluginovertobeaPlatformandimprovinghowpingandwebhooksworktogether,andnumerousotherfixes.
评论