Patent Publication Number: US-10317102-B2

Title: Geofencing for thermostatic control

Description:
BACKGROUND 
     The present disclosure pertains to geofencing, and predicting behavior at least partially based on geofencing results. 
     SUMMARY 
     The disclosure reveals a system and approach using geofencing events for controlling temperature in a building for comfort of a user upon his or her arrival to the building. A decision may be made when to use a direct trigger by an incoming geofencing event and when to use a time of arrival prediction casted by an outgoing geofencing event. One or more geofences may be placed optimally based on the trigger decision and other aspects related to commuting patterns of the user. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWING 
         FIG. 1  is a diagram of a geofence device in a context of a geofence and a building; 
         FIG. 2 a    is a diagram of a distance-based geofence and simplified time-based geofence using the map; 
         FIG. 2 b    is a schematic representation of distance-based geofence and full time-based geofence 
         FIG. 3  is a diagram of a user specific model; 
         FIG. 4  is a diagram of small and larger amounts of data of the user specific model; 
         FIG. 5  is a diagram contrasting small and large amounts of data points for casting predictions; 
         FIG. 6  is a diagram of time away from home as a function of when leaving home; 
         FIG. 7  is a diagram of probabilities relative to times of leaving home for predicting a time of arrival time at home; 
         FIG. 8  is a diagram of a direct trigger geofencing thermostat control; 
         FIG. 9  is a diagram of a prediction basis for geofencing thermostat control; 
         FIG. 10  is a diagram of time relative to return travel; 
         FIG. 11  is a diagram of geofences around places of frequent activity of a user; 
         FIG. 12  is a diagram of direct trigger geofencing used where ramp-up time of a heating and cooling system is a factor; 
         FIG. 13  is a diagram emphasizing proper placement of localization devices to avoid poor signal reception; and 
         FIG. 14  is a diagram showing a formula relating to time away. 
     
    
    
     DESCRIPTION 
     The present system and approach may incorporate one or more processors, computers, controllers, user interfaces, wireless and/or wire connections, and/or the like, in an implementation described and/or shown herein. 
     This description may provide one or more illustrative and specific examples or ways of implementing the present system and approach. There may be numerous other examples or ways of implementing the system and approach. 
     Aspects of the system or approach may be described in terms of symbols in the drawing. Symbols may have virtually any shape (e.g., a block) and may designate hardware, objects, components, activities, states, steps, procedures, and other items. 
     Geofencing capability may be used in location aware systems to automatically alter a system&#39;s behavior based on a user&#39;s proximity. For example, a home&#39;s A/C may start cooling upon an event of a geo-fence crossing by the home occupant (i.e., the event being detected by the localization enabled mobile application on the user&#39;s smartphone). 
     One of the associated issues is that typical commuting time does not provide enough time to cool or heat the house to a desired comfort level; therefore, any geofencing-controlled heating or cooling of a home will not necessarily achieve its objectives. Studies may show that many commuter&#39;s arrivals are to an uncomfortable house. Further, in very hot or very cold climates, such as in desert areas or northern central areas, respectively, the level of discomfort caused by the geofencing-controlled heating or cooling may be very large. This issue may be addressed by a probabilistic model based prediction of user&#39;s behavior patterns. The probabilistic models of a user&#39;s behavior patterns may be built using the records of events related to the user&#39;s behavior patterns such as a user&#39;s departure and arrival times (acquired using a geofencing application). The models are then used to predict, e.g., the user&#39;s next arrival based on the most recent departure time and other contextual information such as day of week, time of year, weather, and so on. 
     However, an issue of a probabilistic model is that it may rely on statistics calculated on available data which might require a sufficient amount of historical data. In practice, many situations occur when there are not sufficient data available for a user and consequently the probabilistic model cannot be built with insufficient data since it could be highly unreliable. Such situations typically occur when a new user installs or initiates the geofencing-based product or service or when the user significantly changes his or her behavior patterns. In particular, the new user situation may constitute a significant issue for a product/service acceptance as it corresponds to a time when the first user&#39;s impressions of the product/service are created and a user&#39;s reviews are posted. 
     A present approach may incorporate a solution to the issue of insufficient data for a geofencing-based product or service with a probabilistic model based prediction. 
     The solution may have the following features. A “data collection mechanism” may be established that records the geofencing events together with a user&#39;s identifier allowing storage of geofencing events in a common backend database so that each geofencing event is associated with a unique identification of the user who created the geofencing event. 
     The Figures relative to the present disclosure may be noted.  FIG. 1  is a diagram revealing a geofence device  51  crossing a geofence  55  with an occurrence of an event  52  of the crossing. Device  51  may be noted as leaving a house  56  as indicated by a direction arrow  57 . A return of device  51  is shown toward house  56  with an occurrence of an event  53  of the crossing at geofence  55  as indicated by a direction arrow  58 . Occurrences of events  52  and  53  may be sent wirelessly as signals  61  and  62 , respectively, to a thermostat  59  which has a processor to calculate estimates of future arrivals so that thermostat  59  can control the heating, ventilation and cooling (HVAC)  65  to achieve a preset temperature at a time that geofence device  51  arrives at the house. Of course, the temperature of the house is achieved for a person that is carrying device  51 . Signals  63  and  64 , in certain circumstances and/or for particular reasons, may be sent by thermostat  59  to device  51 . A computational mechanism may in the cloud  74 , a processor embedded in thermostat  59 , or a processor embedded in geofence device  51 . Communication may be wireless signals  75 - 78  or by a cable  81  among thermostat  59 , geofence device  51  and cloud  74 . A connection between the HVAC system  65  and thermostat  59  may be wire or wireless. 
       FIG. 2 a    is a diagram of an example fixed-distance geofence (circle  11 ) around a central geolocation (point  12 ) such as a home. A geofencing service may be indicated, where the geofence is defined temporally, by the fixed time of arrival from the geofence to the central geolocation. Using a navigation algorithm, it is possible to estimate a time to arrive from the border to the central point. While it is potentially applicable for many points on the border; in the attached illustration, four points are used. The time to arrive may span from five to ten minutes. 
     For instance, one may set the time of arrival after crossing the geofence to five minutes. One may need to move three of the four points closer to the central location. An approach of calculating the time-based geofence may be parametrized in several ways. It may use a type of travel as an input (car, bicycle, or walking), which may affect not only the average speed of movement, but also constraints of movement (e.g., only a car is allowed on the highway). Also, the geofence may be adjusted in real time taking into account current traffic (accidents, traffic jams, and so forth). 
     An alternative way to calculate the time-based geofence may be, instead of keeping track of the perimeter, to monitor or estimate a user&#39;s current geolocation and continuously estimate the user&#39;s time of arrival (ETA) to the geofence&#39;s geolocation. The geofence may be then triggered when the ETA becomes equal or smaller than a fixed time of arrival defining the temporal geofence. The ETA may be estimated using a known or estimated speed and a nature of the user&#39;s movement (walking, cycling, or driving), a user&#39;s planned route and a user&#39;s estimated speed along the route, just like in a case of common navigation. Further, the ETA estimate may use information of the user&#39;s behavior patterns. The user&#39;s behavior patterns may be learned from an analysis of the records of a user&#39;s movement (e.g., by building probabilistic models describing the timing, the frequency, the position, the length and other aspects of user&#39;s frequent activities such as commuting to work, regular shopping, and so forth). Alternatively, the user&#39;s behavior patterns may be directly provided by the user (e.g., by sharing the user&#39;s calendar or by entering the user&#39;s usual activities through a dedicated graphical user interface (GUI)). 
     A use may be with a connected, geofencing controlled thermostat, where, for an optimal result (i.e., achieving a user&#39;s comfort upon the user&#39;s arrival at the lowest cost), the fixed time of arrival defining the temporal geofence may correspond to a time needed to achieve an optimal comfort state in the zones controlled by the thermostat. This parameter may be either constant or dynamic, based on the current state of the zone and the current weather (e.g., as it may take longer time to cool the house in a very hot weather than in moderate weather conditions). The present approach may benefit any other geofencing controlled service or system that needs a setup time (e.g., water warming, cooking/baking, washing, drink cooling, or the like). 
       FIG. 2 b    is a diagram of a target location (e.g., home)  13  with an original distance-based geofence  14  having a fixed radius (e.g., 5 miles) from location  13 . Also, a time-based geofence  15  (e.g., 5 minutes to reach location  13 ) is shown, this time for the whole perimeter (i.e., each point on the time-based geofence boundary represents the 5 minutes to reach the location). 
       FIG. 3  is a diagram of a user specific model. A graph  16  shows a probability of time away as a function when leaving home. In this situation, the user is leaving at 8 AM. A graph  17  shows a time away in terms of hours versus probability. Graph  17  shows the user specific model given a known leaving time. In this example, a resulting prediction of the most likely arrival is after 10 hours. 
       FIG. 4  is a diagram of the example of the user specific model in graph  16 . Graph  18  shows a model for a user&#39;s leaving time of 8 AM, trained on a low amount of data (i.e., 7 data points). In comparison, graph  17  of a model for a user&#39;s leaving time of 8 AM, is trained on a large amount of data (105 data points). 
       FIG. 5  is a diagram of a graph  18  with too few data points, resulting in a statistical model that is not necessarily valid and thus should not be used to cast predictions for a user&#39;s leaving time of 8 AM. The model of graph  18  may be replaced with a graph  19  of an equivalent model trained from data of a large amount of available user, that may be regarded as a background model. A model with a large number of data points (like graph  17  of  FIG. 5 ) may be a statistical model that is valid and can be used to cast predictions. 
       FIG. 6  is a diagram of graph  16  of the example of the user specific model showing a probability of time away as a function of time leaving home (for a specific day of the week). Graphs  21 - 27  show a probability of time away given a certain time for leaving home at 9:30 AM, 9:00 AM, 8:30 AM, 8:00 AM, 7:30 AM, 7:00 AM and 6:30 AM, respectively. 
       FIG. 7  is a diagram of graphs  21 - 27  with their probabilities of time of leaving home in a summation, resulting prediction in a graph  28  and with an indication of the most likely arrival time of the user returning home. 
       FIG. 8  is a diagram of a direct trigger geofencing thermostat control. A circle may represent a geofence  31  having a radius  32  of 7 miles. A user may leave a house at location  33  and travel a route  34  in a direction of geofence  31 . As the user has left the house, a thermostat setback is applied as the house became considered as unoccupied. A user may be going along a route  35 , and as the user crosses the geofence  31 , the thermostat for the house at location  33  may be activated to heat or cool the house. 
       FIG. 9  is a diagram of prediction based geofencing thermostat control. As in the  FIG. 8 , as the user left the house along route  34  towards geofence  31 , the thermostat setback was applied since the house was considered unoccupied. Upon the user leaving the house at location  33 , a prediction of arrival time may be calculated and a respective trigger scheduled for the thermostat, which may be activated by the trigger early enough (before the user crosses the geofence on the way back) to ensure comfortable conditions upon arrival for the user traveling along a route  36 . 
       FIG. 10  is a diagram of geofence  31  with a user returning along a route  37  to the house at location  33 . A duration of time for the user to travel between a crossing at geofence  31  to location  33  of house for arrival may be sufficient to ramp-up the heating or cooling the house in mild weather, such as spring or fall, but may be much less that sufficient for cold or hot weather, hence the direct geofencing control is not necessarily sufficient and comfort may be achieved with prediction based geofencing control. 
       FIG. 11  is a diagram of a situation when a prediction based geofence trigger is used. In this case, geofences  41 ,  42 ,  43  and  44  may be place around places of frequent activity, such as the home, mall, gym and the job, respectively, that may provide an additional advantage of better predictability about a user&#39;s next move, allowing an achievement of optimal control. 
       FIG. 12  is a diagram of a situation when direct trigger geofencing is used. A geofence  45  may be placed according to ramp-up time of a heating and cooling system needed to provide a user, from a job location  46 , the comfort of the house at location  33 . 
       FIG. 13  is a diagram indicating that a placement of, for example, a geofence  48  that passes near an area  49  with poor GSM/GPS signal reception should be avoided to minimize a probability of missed or false geofencing crossing events. 
     A “user specific model” may be a probabilistic model of behavior patterns of a specific user, e.g., consisting of a joint probability density function (jpdf) of the time of the user&#39;s leaving the home (i.e., time of the leaving geofence crossing event) vs. the time of the user&#39;s arriving back home (i.e., time of the arriving geofence crossing event) vs. the day of the week. The “user specific model” may be built from the data records previously collected and stored using the “data collection mechanism” so that all or a part of the data records associated with a specific user may be used to build a probability density function (pdf). Other examples of the probabilistic model may include joint histograms, local data density, stored data points, and so forth. 
     A “prediction algorithm” may use the “user specific model” to predict a user&#39;s behavior patterns such as the time of the user&#39;s arriving back home (i.e., time of the arriving geofence crossing event) based on a known time of the user&#39;s leaving the home (i.e., time of the leaving geofence crossing event) and the actual day of the week. The algorithms may be any pattern classification technique, e.g., any state-of-the-art or other pattern classification techniques. 
     A “model validity assessment algorithm” may use information based on the amount of data used for creating each part of the “user specific model” and return, for each part of the “user specific model”, the information whether the “user specific model” part is valid or not. In an example, the “part” of the model may refer to a neighborhood in the three-dimensional space of the time of the user&#39;s leaving the home (i.e., time of the leaving geofence crossing event) vs. the time of the user&#39;s arriving back home (i.e., time of the arriving geofence crossing event) vs. the day of the week. The neighborhood may be, for instance, a cube in the three-dimensional space defined by an interval of values of each dimension. Again, referring to the above example, the model validity assessment algorithm may store a number of data points used to create the “user specific model” (a joint probability density function) for each defined neighborhood. A similar example of the model validity assessment is depicted in  FIG. 4 . It shows two examples of two parts of user specific histogram based model. In the 3D model with day of week, leaving time and time away as dimensions, the first example of the part of the model corresponds to the range [Tuesday, 7:55-8:15, 1-18]. The other part of the model corresponds to the range [Tuesday, 19:45-20:15, 1-18]. As shown still in  FIG. 4 , the two parts of the model are assessed by retrieving the number of data points (corresponding to the stored past records of geofencing events collected through the Collection mechanism) that were used to build these parts of the model. 
     A “background model” may be a probabilistic model of behavior patterns of an average user, created from the corresponding data points of virtually all available users. Referring to the above described example, the “background model” may consist of a joint probability density function of the time of a user&#39;s leaving the home (i.e., a time of the leaving geofence crossing event) vs. the time of the user&#39;s arriving back home (i.e., a time of the arriving geofence crossing event) vs. the day of the week. This joint probability density function may be calculated in the same way as the “user specific model” except that the data from all users are used indiscriminately. 
     The solution may then work as indicated in the following. The “background model” may be built from data records of virtually all users in the database. The “user specific model” is built separately for each existing user in the database. The “user specific model” is also initialized for each new user. That is, whenever geofencing data are acquired for a new user (a user, whose unique identifier is not yet present in the database). 
     Whenever the “prediction algorithm” is to be called to calculate a prediction based on the input data (e.g., the time of the user&#39;s leaving the home and the actual day of the week), first the “model validity assessment algorithm” may be called to return the validity of the part of the “user specific model” associated with the input data. 
     If a part of the “user specific model” is assessed as valid, the prediction may be made based on input data and the “user specific model”. Otherwise, the prediction may be made based on the input data and based on the “background model”. The reader may refer to  FIG. 5  for depiction of such situation using one of the two examples of the parts of the user specific models from  FIG. 4 : there was not enough of data points for one example part of the model and it is replaced by the corresponding part of the background model. 
     Because the prediction calculated using the “background model” is a best guess with missing information on a specific user, this prediction may minimize prediction error and consequently allow the predictive feature of the geofencing-based product or service to be used, e.g., for a new user of the product/system while there are no data collected for that user. 
     Further, the “model validity assessment algorithm” may take into account also how much up to date are the data points “supporting” the part of the “user specific model”. If, e.g., the data points “supporting” the part of the model are found to be older, in average, than a predefined threshold, then the part of the “user specific model” may be marked as invalid. This may result in using the “background model” instead of the “user specific model” whenever the data supporting the “user specific model” part are out of date. The “user specific model” part will be again marked as valid and used for prediction after enough of relevant recent data of the specific user have been collected. 
     Yet further, the “model validity assessment algorithm” may compare the most recent data points to the corresponding older data points and mark the corresponding “user specific model” part as invalid if a discrepancy between the two have been found. This may result in automatic adaptation of the “user specific model” so that whenever the user changes his behavior pattern, the model is updated over the short time, while the “background model” is used to bridge the time needed for the model to reflect the new behavior pattern. An example of such assessment may be comparing the predictor performance using the “user specific model” with the predictor performance using the “background model”, both based on the recent data. Under normal circumstances, the performance of the predictor using the “user specific model” should be better than the performance of the predictor using the “background model”. In case of a rapid change of the user&#39;s behavior pattern, the performance of the predictor using the “user specific model” could be worse, which may be used by the “model validity assessment algorithm” to invalidate the “user specific model”. 
     A “user group model” may be built using selected users (instead of all available users) and used instead of the “background model” noted herein. This may be done if one can establish a reliable similarity measure between a user and a user group used to build the “user group model”. Such similarity measure may be based on a contextual knowledge of the user, e.g., a user&#39;s commuting type and distance, user&#39;s geography, user&#39;s demographics, and so on. Also, a similarity measure may be established based on the most recently collected user&#39;s data points. A selection of users for building the “user group model” may then be based on the chosen similarity measure. The similarity measure may also be used to select the “user group model” relevant for a specific user. Using the “user group model”, instead of the “background model”, may result in a higher prediction accuracy in the cases when the “user specific model” is marked as invalid by the “model validity assessment algorithm” as long as an assumption of the similarity measure between the predicted user and the user group used to build the “user group model” is correct. 
     The uniqueness of the presented disclosure may be in “model validity assessment algorithm”, “background model”, “user group model” and their usage. 
     While the presented approach may be general and used in various predictive geofencing applications/services, it may be a component of a smart thermostat line, which uses a user&#39;s mobile device based geofencing feature to optimally control the user&#39;s home&#39;s heating and cooling. 
     Geofencing control with probabilistic prediction of the time returned home may be noted. 
     An issue associated with probabilistic prediction may be its accuracy. There will always be prediction errors as the real outcome of the predicted value (e.g., user&#39;s next arrival time) is a result of a random process of which we only have incomplete information and therefore the probabilistic model is always simplified and using assumptions which do not always hold. 
     The below presented approach may address the issue of improving accuracy of the probabilistic prediction with incomplete data which may be applied to the geofencing control based product or services, and to other similar tasks. 
     The solution may incorporate the feature, such as the “data collection mechanism”, established and the “user specific model”, as noted herein. The latter may be probabilistic model of behavior patterns of a specific user consisting of a joint probability density function (jpdf) of the time that the user spent away from home (time away or T away , i.e., difference between the time of the arriving geofence crossing event and the time of the leaving geofence crossing event) vs. time of the user&#39;s leaving the home (T, i.e., time of the leaving geofence crossing event) vs. the day of the week (D). The “user specific model” may be built from the geofencing data records previously collected and stored using the “data collection mechanism” described herein and associated with a specific user so that the following may be performed. 
     For each user, there may be a collection of jpdfs, one per each day of week (7 jpdfs total for Mon-Sun). To build each jpdf, the data from the corresponding day of week are used only. While building the jpdf, the data records may be weighted by how recent they are (i.e., the weights are inversely proportional to the age of the data record). The jpdf may be discretized (forming the multidimensional histogram) with reasonably chosen time steps (e.g., 0.5 hour). The jpdfs may be updated using the new data that keep coming through the “data collection mechanism” as the user keeps using the geofencing controlled product/service. Each time one or multiple data points may be added to the model. The multiple data points may be weighted so that their age is taken into account as described herein. 
     A “prediction algorithm” that uses the “user specific model” to predict a T away  based on known time T and the actual day of the week D so that the array of 2D index values may be calculated in that the first index value is composed from the input values [T, D] (i.e., values for which one desires to predict the T away , where T is time of the user&#39;s leaving the home, D=day of the week) and other indices are composed from neighboring values to the input values, e.g., [T1−1.5 h, D], [T−1 h, D], [T−0.5 h, D], [T+0.5 h, D], [T+1 h, D], [T+1.5 h,D], and so forth, (h stands for hour), where the “neighboring value” refers to a 2D value, so that the value of the “time of the user&#39;s leaving the home” belongs to a predefined range of the values located around the input value T (e.g., range T−1.5 h to T+1.5 h), and where the neighboring values are spaced by a predefined discrete interval from each other, e.g., 0.5 h. 
     The jpdf histogram values of the predicted variable T away  that corresponds to the 2D index values, may be looked-up. In the example above, these values may be P(T away |T−1.5, D), P(T away |T−1.0, D), P(T away |T−0.5, D), P(T away |T, D), P(T away |T+0.5, D), P(T away |T+1.0, D), P(T away |T+1.5, D). 
     For each candidate value of T away , the weighted average may be calculated using the jpdf histogram values from the preceding paragraph, where each value is weighted by a weight factor that is a function of the distance of the corresponding 2D index value from the first index value (this function may be, e.g., a Mahalanobis distance, inverse proportionality, Gaussian of the distance, and so forth). Following the example above, for each value of T away , the weighted average may be shown with a formula 71 indicated in  FIG. 14 . 
     The resulting prediction value may be found as the value of T away  which maximizes the value of expression from the preceding paragraph. 
     Geofencing control with probabilistic prediction of the time returned home may be noted. 
     Further, the above described “user specific model” may be extended in the following. One or more additional input variables (except of the variables of time of the user&#39;s leaving the home and the day of the week which were described above) may be used to make a more accurate prediction of the time of the user&#39;s arriving back home. Examples of possible additional prediction variables may incorporate actual weather at leaving time, forecasted weather at predicted arrival time, indicator whether the day is a holiday or vacation, time of meetings in user&#39;s calendar (if available), context information such as geography (location, urban vs rural), commute type, home type, family status and so on, and time of the additional geofence crossing events (the geofencing may allow setting multiple geofences at multiple places). 
     Feature selection algorithm techniques (e.g., mutual information based selection) may be used to estimate the impact of the additional input variables to the prediction accuracy by the “prediction algorithm” for each user separately as each variable may or may not be informative with respect to each user&#39;s time away. 
     The additional input variables may be modeled jointly (equivalently to the above described model using the variables T and D) or separately as an ensemble of models, where the final prediction is made by a combination of predictions of ensemble models, or by any combination of these approaches. 
     Prediction correction “as you go” may be used. In case of change of predicted conditions (e.g., forecasted weather) or in case of receiving new information after the prediction had been made, a new prediction may be calculated. Also, new information may be inferred if some event was not received, while it was expected. For example, a user may usually leave his house at 7 a.m. He either goes to work or he walks a dog for an hour and then goes to work, returning after 10 hours of being away. Now, when the user has left at 7 a.m. and he is still away after 2 hours, one may assume that, more probably, he has gone to work and thus he or she may be away another 8 hours. Therefore, knowing that the user did not return after 2 hours, one may calculate a new prediction with time T away =10 h, which can correct the first prediction of T away =1 h. 
     Since the implemented model may provide the jpdf for the prediction, a convenient moment to perform the “as you go” prediction correction may be detected by analysis of peaks in the jpdf or by quantile analysis. 
     Prediction error modeling may be used. Whenever the prediction error is larger than a predefined value (e.g., 1.5 h), all above described input values may be recorded into a separate database. Once enough data, for a specific user, are present in this database, a new model (jpdf) may be built that allows one to predict the error occurrence based on the input variables. The error prediction may then allow a quicker adaptation to temporal/short-term deviations. An example may be a user who tends to stay at work longer when some deadline is approaching. The “error model” may detect this behavioral pattern and when the user stays at work longer for, e.g., two consecutive days, the “error model” could indicate increased probability of longer stays at work for the next day improving the T away  prediction for that day. 
     The present approach may become a component of a smart thermostat line which may use a user&#39;s mobile device based geofencing feature to optimally control the user&#39;s home&#39;s heating and cooling. 
     Smart geofencing adjustment may be noted. Geofencing capability may be used as a feature of a smart thermostat at a home to automatically control the home temperature according to user&#39;s presence/absence aiming at achieving optimal user&#39;s comfort and energy consumption. For example, the home&#39;s A/C may start cooling upon the event of geofence crossing by the home occupant on his way back home (event being detected by the localization enabled mobile application on the user&#39;s smartphone). Alternatively, the event of geofence crossing (on the user&#39;s way out of the house) may be used to trigger a probabilistic predictor of the user&#39;s return home. In both these cases, an adjustment of the geofence location is very important for proper function of geofencing based thermostat control, but may be very difficult to choose. In the former example, if the geofence may be set close to the home, the time between the geofence crossing time and the time of user&#39;s return home will not necessarily be sufficient for a pre-cooling/pre-heating sequence to achieve a comfortable temperature upon user&#39;s return home. In the latter case, the placement of the geofence may influence an uncertainty and consequently an error of a probabilistic prediction. In both cases, a poor choice of the geofence adjustment may cause misses of the geofence crossing event, e.g., due to the poor GPS reception or due to the poor mobile system&#39;s connectivity resulting in confusion of the system&#39;s state logic and a consequent system&#39;s underperformance. 
     A proper adjustment of the geofence may be critical for a proper function of a geofencing control feature of the thermostat. 
     The presented approach may incorporate a smart geofence adjustment that either suggests to a user an optimal geofencing adjustment in a semi-automatic fashion, or adjusts the geofencing fully automatically. 
     A smart geofencing adjustment of a geofencing controlled application or service may be such so that one or multiple geofences are defined as a geo-location and a perimeter, and the geofencing control mechanism is defined as either direct trigger or prediction based. 
     The direct trigger geofencing control may mean that the geofencing crossing event directly triggers the control mechanism. For example, if the user associated with the geofence crosses the predefined geofence upon his arrival to home, the thermostat may be instructed to turn the home&#39;s heating/cooling up towards achieving the user&#39;s home temperature upon once the resulting geofence crossing event is issued. 
     The prediction based geofencing control may mean that the geofencing crossing event only triggers the prediction mechanism, which in turn drives the control mechanism. For example, if a user associated with the geofence crosses the predefined geofence upon leaving from home, the resulting geofence crossing event may trigger the prediction calculation task (e.g., embedded in the thermostat or a part of the cloud infrastructure). The thermostat may then be instructed to turn the home&#39;s heating/cooling up towards achieving the user&#39;s home temperature according to a prediction of the time of the user&#39;s return home. 
     To perform the geofencing adjustment calculation, the present approach may take into account one or more following aspects. A user&#39;s behavioral patterns may be related to leaving a user&#39;s home and arriving back, for example, commuting to work, shopping, regular leisure activities, or the like. A user&#39;s home temperature presets may involve a setback temperature (temperature preset for the time when the home is empty), and a user&#39;s set points (temperature preset for the time that the home is occupied). As to home geography, such as a home geographical location, one may incorporate geographical relation to public facilities such as schools, shopping centers, restaurants, theaters, entertainment facilities, parks, and so forth. 
     A home thermal envelope may be a model (physical or statistical) of the home which enables one to predict how long time is needed to achieve the desired home&#39;s temperature based on current interior temperature, local climate character such as seasonal weather changes, current local weather such as the home&#39;s current outdoor temperature, sunshine/cloud coverage/rain/wind, and weather prediction such as a prediction of the local weather for the following day. 
     A user&#39;s direct inputs may incorporate a geofencing controlled application or service. The application or service may provide a graphic interface which displays the geographical map and lets the user define the places and other aspects related to his or her behavioral patterns and also any other above described aspect related to the geofencing adjustment calculation, and further let the user define the geofences and geofencing event triggering mechanism directly. 
     The current, the most recent or the historical records of the aspects described above recorded over a certain past time range may be taken into account by the present approach. Moreover, the approach may use also the historical records of the aspects described herein for the home/user associated with the geofence and for the other homes or users using the same geofencing controlled application or service if such data records are available. 
     The geofencing control mechanism may be as follows. The user&#39;s home temperature presets, the local climate character and the home thermal envelope may be used to estimate a ramp up time (i.e., time needed to achieve the user&#39;s set points assuming the setback temperature as temperature initial temperature, and assuming a particular home with respect to expected weather for the local climate). 
     Alternatively, the ramp-up time may be estimated from known current local weather or local weather prediction and from a home&#39;s current interior temperature so that the home thermal envelope can be used to calculate the ramp-up time as the time needed to reach the user&#39;s set point starting from the current interior temperature given the local weather and its prediction. 
     Another way to estimate the ramp-up time may be based on the analysis of the historical records of a home&#39;s current interior temperature, a user&#39;s behavioral patterns and the current local weather. The ramp-up time may be calculated from a home&#39;s estimated speed of heating or cooling which may be estimated by statistical methods, e.g., averaging the ramp-up times needed in a past (under the similar local weather conditions). 
     Yet another way to estimate the ramp-up time may be based on the established similarities among the users and/or homes who are using the same geofencing controlled application or service. Assuming that the same geofencing control based service or product is run for a large number of homes, and that the data records of all the homes are available, e.g., via a database accessible by the service/product, one may define convenient similarity measures among the homes (e.g., the same or similar home geolocation) and use similar homes with known ramp-up time to estimate the ramp-up time of the home associated with the geofence. 
     An expected user&#39;s time to return may be estimated once for the home or may be re-estimated each time the user leaves home based on the knowledge or on the estimate of the user&#39;s outside activity. 
     A direct trigger geofencing control may be selected whenever the expected user&#39;s time to return is comparable or larger than the ramp-up time, otherwise the prediction based geofencing control is selected. 
     One or multiple geofence placements and radii may be calculated. If the direct trigger geofencing control is selected, then geofence&#39;s geo-locations may be placed on the places of user&#39;s outside activities as indicated in  FIG. 11 . The places of user&#39;s outside activities may be determined based on directly querying the user (the query either by the installer of the geofence controlled application or service, or automated as a part of the geofence controlled application or service) or based on the analysis of frequently visited user&#39;s outdoor locations. An analysis of frequently visited user&#39;s outdoor locations may be accomplished using the GPS enabled mobile application (e.g., navigation) so that the places of user&#39;s outside activities are identified as the geo-locations where the user spends significant time with significant frequency, where the “significant time” and “significant frequency” may be predefined constants or values inferred based on the user&#39;s activity analysis. 
     There may be use of the clustering analysis of the GPS locations logged by the GPS enabled mobile application (using, e.g., a K-means clustering or using the fitting a GPS locations distribution to mixture of Gaussians). 
     The geofence&#39;s perimeters may be adjusted so that a geofence crossing will occur in an area where the GPS reception and mobile signal reception are likely of a high quality. 
     The geofence&#39;s perimeters may also be adjusted so that the geofence crossing may occur so that the expected user&#39;s time to return is equal to or larger than the user&#39;s home&#39;s ramp-up time (larger only in the case that the GPS reception and mobile signal reception restrictions described in the previous paragraph do not allow it to be set to equal). 
     If the prediction based geofencing control is selected, then the geofence&#39;s geo-locations may be placed on a user&#39;s home location, the first geofence&#39;s perimeter may be adjusted so that the geofence crossing will occur as near to user&#39;s home location as possible, auxiliary geofences&#39; perimeters may be adjusted so that the geofence crossings can occur as near to the places of the user&#39;s outside activities as possible, and additional auxiliary geofences&#39; perimeters may be adjusted so that the geofence crossings will occur between the home and the places of the user&#39;s outside activities. 
     If the places of the user&#39;s outside activities are not known, then the auxiliary geofences&#39; perimeters may be adjusted so that the geofence crossings will occur in regular instances or distances from the home, e.g., 1, 2, 4, 8, 16, 32 miles, and so on. All geofence crossings should occur in an area where the GPS reception and mobile signal reception are likely of a high quality. 
     The geofencing crossing events may then be used to trigger a prediction mechanism, which in turn drives the control mechanism. For example, if a user associated with the geofence crosses the predefined geofence upon his leaving from home, the resulting geofence crossing event may trigger the prediction calculation task (e.g., embedded in a thermostat or a part of a cloud infrastructure). The prediction calculation task may take into account the time instant(s) of the previous crossing or crossings of other geofence or geofences which represent additional information regarding which behavior pattern that the user currently follows and may increase the accuracy of the time return home prediction. The thermostat may then be instructed to turn the home&#39;s heating or cooling up towards achieving a user&#39;s home temperature according to a prediction of the time of the user&#39;s return home. 
     If a user provides his or her direct inputs, then the geofence locations, perimeters and conditions of the geofencing triggers may be adjusted according to the user&#39;s direct inputs. 
     The present approach may result in either a suggestion (a geofencing adjustment) to the user through a mobile or web interface, letting the user review and edit the adjustments, and applying the adjustments to the smart thermostat product or a service (a semi-automated option). This option may be implemented using the user interface displaying the geographic map with all geofences and all places of outside activities represented in the map. The approach may apply the adjustments to the smart thermostat product/service directly (a fully automated option). 
     The present approach may become a component of the smart thermostat line such as a thermostat that which uses a user&#39;s mobile device based geofencing feature to optimally control the user&#39;s home&#39;s heating and cooling. 
     Typically, a geofence, in a geofencing based application or service, may be defined spatially, by its central geolocation and a perimeter effectively forming a circle or a more complex geometrical shape around this point. If used in a context of triggering actions upon events of crossing the geofence, this may not necessarily be convenient, since an action is often related to a movement towards the central point, and in many cases it can differ based on the speed and/or direction of the movement and its nature (e.g., walking, cycling or driving). So, for instance, if the geofence is defined by a fixed perimeter, moving to the central geolocation may take different times when driving on highway or local road, which can lead to an undesired variation of time difference between crossing the geofence and the actual arrival to the central location. 
     To recap, a thermostat system having geofencing for control, may incorporate a geofencing device, a thermostat connected to the geofencing device, a computational mechanism configured to receive one or more geofencing events from the geofencing device and to adjust the thermostat, and a heating and cooling system situated in a building and connected to the thermostat. When the geofencing device crosses a geofence in a direction away from a location of the thermostat, a first signal indicating a first event of a geofence crossing may be sent to the thermostat. When the geofencing device crosses a geofence in a direction towards the location of the thermostat, a second signal indicating a second event of a geofence crossing may be sent to the thermostat. An estimated time of arrival of the geofencing device may be determined upon receiving the first signal by the computational mechanism. The thermostat may control the heating and cooling system for achieving a preset temperature within the building by the estimated time of arrival of the geofencing device. 
     Upon receipt of the second signal from the geofencing device, a re-estimated time of arrival may be determined by the computational mechanism, and the thermostat controls the heating and cooling system for achieving the preset temperature within the building by the re-estimated time of arrival of the geofencing device. 
     The computational mechanism may determine a thermostat control strategy. Determining the thermostat control strategy may involve a decision whether the thermostat controls the heating and cooling system for achieving a preset temperature within the building by the estimated time of arrival of the geofencing device upon receiving the first signal, or whether the thermostat controls the heating and cooling system for achieving a preset temperature after receiving the second signal. The determining the thermostat control strategy may be reflecting aspects related to a ramp-up time needed by the heating and cooling system and the commute patterns of a user including the ramp-up time needed to achieve a preset temperature in the building and expected commute time of the user to arrive at the building. A target position may be selected. A geofence may be placed about the target position. 
     The geofence and target position may be chosen so that the geofence is around the building if the thermostat controls the heating and cooling system for achieving a preset temperature within the building by the estimated time of arrival of the geofencing device upon receiving the first signal, or the geofence and target position may be chosen so that the geofence is around the places of frequent activity of the user, in which case the thermostat controls the heating and cooling system for achieving a preset temperature upon receiving the second signal. 
     The geofencing device may issue signals upon determination of crossing multiple geofences. The computational mechanism may combine signals issued by the geofencing device upon a crossing of multiple geofences and the thermostat controls to achieve a preset temperature upon an estimated time of arrival to home. 
     The geofencing device may convey to the computational mechanism information related to aspects of immediate activity of the user including a current position of the user, traffic density on a commuting path of the user, mode of transport used by the user, and an estimate of a frequent activity pattern that user may be performing. The computational mechanism may use the information related to aspects of immediate activity of the user, to calculate an estimate of remaining time that the user needs to arrive to the building and send a signal to the thermostat when the estimate of the remaining time is equal to ramp-up time needed by the heating and cooling system to achieve a preset temperature in the building. 
     The estimated time of arrival may be based on specific probabilistic models of the user, trained on previously collected signals sent by the geofencing device of the user within a predefined period. A validity of the specific probabilistic models of the user, may be assessed upon a time of a new estimation of the time of arrival of the geofencing device. An assessment of the validity of the specific probabilistic models of the user, may be performed by checking how many signals similar to current signals were used to build the specific probabilistic models of the user. Probabilistic models from many users of different buildings may be combined to form probabilistic models of an average user. The probabilistic models of the average user may be used to estimate a time of arrival of the geofencing device if an outcome of the assessment of the validity of the user specific probabilistic models of the user indicate that the user specific probabilistic models are invalid. 
     The geofence device may be application of a smartphone held by a user. 
     An approach of geofencing control, may incorporate selecting a target location, placing a geofence about the target location, and detecting an event of a geofence crossing with a localization enabled mobile application on a smartphone carried by a user. The geofence event of a geofence crossing may cause a direct trigger or a prediction based trigger of an action relative to the target location. 
     The target location may be a house of the user. The direct trigger may be an activation of a thermostat to cause a heating and cooling system to heat or cool the house, when the geofencing device crosses a geofence in a direction towards the location of the thermostat, and a signal indicating an event of a geofence crossing may be sent to the thermostat. The prediction based trigger may be a calculated arrival time of the user to the house, when the geofencing device crosses a geofence in a direction away from the location of the thermostat, and a signal indicating an event of a geofence crossing may be sent to the thermostat, resulting in an activation of the thermostat early enough to ensure that a heating and cooling system heats or cools the house to a pre-set temperature on the thermostat. 
     The placing of the geofence may be chosen so that an amount of time for the user to reach to the house from a point of a geofence crossing is equal to or larger than a ramp-up time of the heating and cooling system. The ramp-up time may be an amount of time for the heating and cooling system to change a temperature in the house to match a temperature set point on the thermostat. 
     The calculated arrival time of the user may be a function of a time when the user leaves the house, as well as one or more factors selected from a group incorporating a current day of week, actual weather at a time of a user&#39;s leaving home, forecasted weather at a predicted time of arrival at home, indication of whether the actual day is a holiday, vacation or work day, time of meetings by the user, geographical location, commute type, home type, and family status. 
     A geofence control system may incorporate one or more geofences around a place of interest, and a geofencing detector. The geofence detector may detect and record geofence crossing events. A geofence crossing event toward the place of interest may indicate an arrival time by the geofence detector to a device at the place of interest. The device may ensure that an accomplishment of a specific condition at the place of interest is began before the arrival time. The one or more geofences may be selected from a group of time-based and distance-based geofences. 
     The place of interest may be a building. The geofence detector may be carried by a user of the building. The device may be a thermostat for controlling a heating and cooling system at the building. The specific condition may be a temperature for the building. 
     A geofence crossing event going away from the place of interest may indicate a departure time from the place of interest. Departure and arrival times of the user from and to the building may be detected and recorded. 
     An arrival time of the user may be predicted from probabilistic models. Probabilistic models may be built from records of departure times and corresponding arrival times. 
     The probabilistic models may incorporate one or more prediction variables selected from a group incorporating a time when the user leaves the house, a current day of week, actual weather at a time of a user&#39;s leaving home, forecasted weather at a predicted time of arrival at home, indication of whether the actual day is a holiday, vacation or work day, time of meetings by the user, geographical location, commute type, home type, and family status. 
     A change of the one or more prediction variables may result in a new arrival time of the user being predicted from the probabilistic models. 
     The geofence detector may be an application on a smartphone of the user. 
     One may use geofence crossing events from the geofence detector to calculate and optimally control in real time the heating and cooling system at the building of the user. 
     U.S. patent application Ser. No. 14/696,725, filed Apr. 27, 2015, is hereby incorporated by reference. 
     Any publication or patent document noted herein is hereby incorporated by reference to the same extent as if each publication or patent document was specifically and individually indicated to be incorporated by reference. 
     In the present specification, some of the matter may be of a hypothetical or prophetic nature although stated in another manner or tense. 
     Although the present system and/or approach has been described with respect to at least one illustrative example, many variations and modifications will become apparent to those skilled in the art upon reading the specification. It is therefore the intention that the appended claims be interpreted as broadly as possible in view of the related art to include all such variations and modifications.