# Patent

## Title
System and method of WiFi router based presence detection and control

## Abstract

A WiFi router based appliance control system and method. The router infers the presence of certain human or animal users based on the association between the user and the WiFi signals emitted by WiFi equipped computerized devices typically associated with the users. The router is configured to control various appliances (router controlled devices), and based on the inference that certain users are or are not local to the router, and various algorithms programmed into the router, the router will in turn control the various router controlled devices. Thus for example, if the router detects a WiFi equipped smartphone coming in range, it can respond by automatically turning on lights or adjusting heating and air conditioning appropriately.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application claims the benefit of U.S. provisional application 62/256,038 “SYSTEM AND METHOD OF WIFI ROUTER BASED PRESENCE DETECTION AND CONTROL”, filed Nov. 16, 2015, inventor Rammohan Malasani; the entire contents of which is incorporated herein by reference.


BACKGROUND OF THE INVENTION
Field of the Invention
This invention is in the field of home automation and wireless routers.
Description of the Related Art
WiFi routers:
In recent years, local (e.g. home) wireless WiFi networks have become very popular, These WiFi networks, which typically operate according various IEEE 802.11 standards (e.g. 801.11b, 802.11g, 801.11n, 802.11ac and so on) typically consist of a factory pre-configured wireless WiFi router, which is often sold in a package consisting of the router, instructions, instillation software, and other accessories such as a power supply and cable. This router is often in turn coupled to the internet via a modem (either built into the router, or separate to the router) and typically to a wireless, cable or optical fiber network connection to an internet service provider.
These router packages are intended to allow unskilled users to set up the WiFi system. Typically the instructions inform the unskilled user to first install the software on his or her local computer, connect the router (which may be a combination modem and router) to the local wired or wireless internet connection (often a wired DSL or cable connection, but alternatively may be a wired Ethernet connection, or even a fiber optic connection to the internet or other network of interest). The user will then interact with the program software to implement the various setup instructions.
Prior art on WiFi router configuration methods and devices include Liu, U.S. Pat. No. 7,496,754; Lin, U.S. Pat. No. 7,577,458; Mazur et. al., US patent application publication 2008/0172477; Lam et. al., US patent application 2009/0103547, and Patel et. al., U.S. Pat. No. 7,826,463.
As the popularity of WiFi routers has grown, various types of open source router software, such as DD-WRT, OpenWRT, and Tomato have also become popular, at least among the software enthusiast or “hacker” community. This open source software allows enthusiasts to control access to routers according to various customized rules, as well as implement more sophisticated functions such as policy based routing.
Some WiFi routers have been developed with integrated touch screens. These include the router described by Malasani in U.S. Pat. Nos. 8,555,047 and 8,812,827, the entire contents of both of which are incorporated herein by reference. This type of router design is presently marketed as the popular “Almond” and “Almond+” router. The Almond+ router, for example, in addition to WiFi transceivers, router circuitry (and functionality), and a touch screen interface, is also equipped with ZigBeeTM and/or Z-waveTM transceivers to allow this router to wirelessly interface with various types of ZigBeeTM or Z-waveTM equipped home automation devices.
Home Automation
Home automation as a concept has been around for many years, and indeed early concepts from Science Fiction literature date back more than a hundred years. However until recently, with the advent of low cost electronics, such concepts were seldom practical.
In recent years, however interest in home automation has greatly increased, and modern electronics now allows such devices to finally become both practical and cost effective. These home automation systems typically allow various electrical appliances in a building (which may or may not be a home residence) to be automatically controlled, usually with significantly more intelligence and efficiency than would result if the appliances were all independently controlled.
These remotely controllable appliances can, for example, include appliances such as heating and air conditioning, watering, lighting, pet feeding, entertainment devices, mobile robots, security systems, intercoms. Generally any electrically controlled or operated device can be potentially be used in a home automation system. Typically such home automation systems operate by using various environmental sensors to relay environmental status information to a home automation processor. This processor can then use this sensor data, and various algorithms previously stored in memory, to in turn control various electrical appliances.
For example, the previously discussed Almond+ WiFi router is currently marketed by Securifi Corporation. The Almond+, in addition to functioning as a WiFi internet access point and WiFi router, also can act, with the addition of suitable sensors, such as door open sensors, motion sensors, and the like act a smart home security and automation hub. Here the Almond+ can use information from these environmental sensors to, according to various preset algorithms, send control signals, such as ZigBee or Z-wave signals, to various appliances and other devices. When such appliances and other devices are controlled by specific, router based, algorithms and heuristics, these appliances and other devices will be called “router controlled devices”.
Note that in some embodiments, the router may interact with the various appliances and other devices via intermediate internet servers (e.g. via the cloud). In these embodiments, these appliances and other devices may be called “router indirectly controlled devices”. Although often, in the following discussion, the term “router controlled devices” may be understood to also include “router indirectly controlled devices”, this distinction should be understood. In essence, a router indirectly controlled device is connected to the router by a cloud-based link.
BRIEF SUMMARY OF THE INVENTION
The invention is based, in part, on the insight that a WiFi router can be modified to act as a home automation hub without necessarily requiring the installation of any additional environmental sensors.
The invention is also based, in part, on the insight that typically the users of home automation systems carry portable or mobile wireless, WiFi equipped computerized devices, often smartphones, but also smart watches, tablet computers, collars, and the like on an almost continuous basis. Thus in many cases, the presence or absence of a particular user from a building, such as a home, can be reliably inferred from the presence or absence of a characteristic WiFi signal emitted by a device that the user typically carries. Indeed, since WiFi equipped devices worn by animals, such as wireless dog collars, are also conceivable, the users here, although often human, are not limited to humans, and indeed may be animals as well. Here when a particular computerized device (such as a WiFi equipped computerized device) is used to infer the presence of a human or animal user, this device is called a “user associated device”.
The invention is also based, in part, on the insight that in many cases, the control of various electrical appliances in a building or area is also typically based on the presence or absence of certain human (or animal) users who habitually visit or inhabit that particular building or area.
Although throughout this disclosure, buildings, such as residences, office buildings, retail buildings, factories, and the like are often used as specific examples; in fact the invention disclosed herein need not be limited to buildings. WiFi typically extends outside of buildings as well, and thus use in yards, gardens, farms, parks, stadiums, and other outdoor locations is also contemplated.
For example, when a person with a propensity for cool temperatures, well lighted rooms, and background music enters a dwelling, then it would be useful to have the various dwelling appliances adjust accordingly. But, on the other hand, if that person's spouse is also in the dwelling, and has an opposite set of preferences, then ideally a home automation system can, if detecting WiFi equipped computerized devices (user associated devices) associated with the spouse as well, make use of various router based pre-stored rules, algorithms, heuristics or rubrics to adjust the appliances accordingly. Thus in this two person example, different appliances in a home may each have at least three different default settings depending if one, or the other, or both is present.
Additionally, other factors, such as time of day, day of week, etc., as well as optional input from sensors may also be used to add further sophistication to the system.
Thus in some embodiments, the invention may be any of a system or a method of using a WiFi router to detect and control various types of router controlled devices. This WiFi router will typically comprise a processor, memory (which may be any of local router memory, or remote cloud memory such as remote database server memory), and at least one WiFi transceiver. The method operates by using the WiFi router to detect a presence of at least one user associated device (typically a WiFi equipped mobile device often carried by a specific user) by determining a WiFi signal characteristic of that user associated device. The system and/or method then operates by using this WiFi router processor, as well as various types of user associated device identification criteria that are stored in the router's memory, to identify (determine a probable identity) of that at least one user associated device.
Once this identity has been established, the router processor can then use various router controlled device operational heuristics (often various logical “if-then” or “if-then-else” type rules, or alternatives such as “switch statements” previously stored in the router's memory), and the likely identity of the one or more user associated devices, to control the operation of at least one router controlled device. This at least one router controlled device will often be a home automation appliance, or other automated appliance, which may be connected to the router by a wireless link, such as a ZigBee or Z-Wave link, router switched power connector, or any other type of wired or wireless link as well.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1A shows an overview of the concept. Here a router, such as a WiFi router, can be used to detect the presence of a large number of different user associated devices (often WiFi equipped mobile wireless devices), and infer the presence of users that typically use these different devices.
FIG. 1B shows an example of a router, such as the Almond+ router, using its WiFi transceiver (119, 121) to detect the presence of a local WiFi equipped user associated device, infer the presence of users, and control equipment based on various algorithms stored in the router's memory.
FIG. 2 shows a one page brochure describing how the invention can monitor new devices joining the WiFi network (e.g. user associated devices), and use the presence of these devices to in turn control various HA (home automation) devices (e.g. router controlled devices).
FIG. 3 shows an example of how the heuristics of the router may be set by an operator and then stored in the router's memory.
FIG. 4 shows an example of how, under the “sensors” section of the router control page, an air conditioning device (which also acts as a sensor as well) that connected to the router (here using a wireless ZigBee connection) may be found. This air conditioning device is an example of a router controlled device.
FIG. 5 shows an extended list of the various other WiFi devices (user associated devices) that the router has either presently detected (active), or has previously detected (inactive) but now cannot because these inactive devices are either out of range, turned off, or at least have their WiFi transceivers turned off.
FIG. 6 shows the operator interface control panel by which a human operator can add or subtract devices (either user presence devices or router controlled devices) from the router's software configuration.
FIG. 7 shows how the user can configure the heuristics (algorithms, control rules) that determine how the router will control various router controlled devices in response to detecting the presence of various user associated devices, and in response to other criteria as well.
FIG. 8, shows the process by which a new rule, algorithm, or heuristic can be entered into the router's memory using the router's operator interface (such as a web page, or though the router's built in touch screen if any).
FIG. 9 shows the operator starting to configure the new “temp” rule.
FIG. 10 shows how more parameters of the various user presence-based router controlled device algorithms (heuristics) can be entered
FIG. 11 shows more detail of the “THEN” part of one if-then heuristic.
FIG. 12 shows an example of the Almond+ router configured with two different algorithms.
FIG. 13 shows that the operator is going to modify the “if” portion of the event to add an additional constraint to the “temp” algorithm.
FIG. 14 shows that the operator is adding an additional constraint to the “if” portion of the event, which is that the “if” only applies during a certain time and date window.
FIG. 15 shows the corrected “temp” algorithm.
FIG. 16 shows a summary of two different algorithms operating in the Almond+ router.



DETAILED DESCRIPTION OF THE INVENTION
FIG. 1A shows an overview of the concept. Here a router, such as a WiFi router, can be used to detect the presence of a large number of different mobile wireless devices (user associated devices) and/or the state of various other sensors as well. These mobile wireless devices that are effective as user associated devices can include wireless dog collars, key fobs, presence sensors, fitness trackers, laptops, tablet computers, mobile phones mobile phones and other type of user presence sensors.
In a preferred embodiment, these user presence sensors generate wireless WiFi signals that the WiFi router can detect directly, although other methods, such as direct wired connections (shown for a connection between the Laptop computer and the router) can also be used.
Here, since the router is typically also acting as an access point between any given WiFi equipped computerized device and the internet, the router also knows which WiFi devices are exchanging data with which internet servers, at least on a URL (uniform resource locator) or URI (uniform resource identifier) basis. As will be discussed, this router feature can allow even non-mobile WiFi equipped devices, such as desktop computers, to also function as user associated devices.
FIG. 1A also shows that the router can use various heuristics, to be discussed, to control the operation of various router controlled devices. These can include devices such as heating and air conditioning equipment, lights, music players, and many other types of devices as well. As will be discussed, these heuristics can be based on various “if then” or “if then else” rules, as well as various other rules such as day and time related rules.
In some embodiments, depending on which WiFi devices successfully establish a bidirectional wireless link with the router, the router processor can then create a “list” in its memory as to which WiFi devices are present (or at least turned on) or not. Here WiFi devices that the router has seen before, but are not seeing presently, can be listed as inactive.
In some embodiments, the router may be a WiFi router with an integrated touch screen, such as the router described by Malasani in U.S. Pat. Nos. 8,555,047 and 8,812,827, the entire contents of both of which are incorporated herein by reference. Note however, that use of an integrated touch screen is optional, and other methods, such as various types of router served interface (e.g. web pages, sending and receiving data to a mobile app, audio interface to devices such as Apple Siri, Google Now, Amazon Echo, etc.), may also be used to configure the router according to the teachings described herein.
FIG. 1B shows an example of a router, such as the Almond+ router, using its WiFi transceiver (119, 121) to detect the presence of local WiFi equipped user associated devices. In this example, the router also has another connectivity device (here a wireless ZigBee transceiver) that can control nearby appliances (router controlled devices). The other components of the WiFi router are as described in applicant's previous U.S. Pat. Nos. 8,555,047 and 8,812,827, the entire contents of both of which are incorporated herein by reference.
In some embodiments, the router (100) may have a built-in, touch sensitive, display screen (131). The router may be fabricated using a commercially available Wi-Fi router system-on-a-chip (SoC) device (110), such as the RT3052 AP/router SOC available from Ralink Technology Corp., Cupertino, Calif. or other type device, such as a combination of the AR7240 Processor and the AR9285 MAC/Baseband/Radio (both available from Atheros Communications, San Jose, Calif.) or other Wi-Fi electronics.
The Wi-Fi router (100) may include a processor such as a MIPS processor (101) (or other processor design). In an exemplary embodiment, the MIPS processor (101) may have a clock rate of about 384 MHz, and may function to provide control to the router (100) via a 128 MHz CPU bus (103). Other processor types, clock rates, and processor or communication methods and buses may also be used.
The Wi-Fi router (100) may provide conventional wired output to an RJ45 port (105) via a fast Ethernet switch (107) on the CPU bus (103), and to an optional USB port (not shown), via a universal serial bus on the go (USB OTG) module (111) or other device. Operation of the Ethernet switch (107) and the USB OTG module (111) may be controlled by the processor (101) via the CPU bus (103). This router may use a wireless LAN network media access controller (MAC) device to provide packet transmission to the user via an RF front end and antenna module. This router may also support a universal asynchronous receiver/transmitter (UART) interface to enable serial communication with a serial console port.
In some embodiments, the MIPS processor, the UART module, the USB module, MAC, and fast Ethernet Switch, part of the Front End and the RAM controller may be provided on a single router chip, and such router chips may be used to provide at least a component of the present invention as well.
The Wi-Fi router (100) may also include a RAM controller (113) for providing access to a memory module (115). In an exemplary embodiment, the memory module (115) may comprise a flash memory, a static random access memory (SRAM), or a synchronous dynamic random access memory (SDRAM).
In some embodiments, router's memory module (115) may include a default (factory preset) password designed to be difficult for an attacker to anticipate, such as factory preset login password (117) which can stored in the memory of memory module (115) during a manufacturing step in the fabrication of the Wi-Fi router (100). As previously discussed, in some embodiments, the invention's router may additionally contain a touch-sensitive display screen (131), capable of directly showing the router's settings and other easy to use configuration options (e.g. various if-then type control heuristics), that can be directly accessed by the user without the use of any additional outside computer or software.
In this disclosure, the various examples were implemented by uploading a previously unreleased version of software to a Securifi Almond+ router. Thus please note that although the Almond+ router itself predates the filing date of this disclosure, the software used to implement the functionality described herein has not been released to the public or otherwise published prior to the filing date of this disclosure.
Thus as previously discussed, in some embodiments, the invention may be a system or method of using a WiFi router to detect and control router controlled devices. As shown in FIG. 1B, this WiFi router will typically comprise at least one processor, memory, and at least one WiFi transceiver. Expressing the invention in methods format, the method may comprise using the WiFi router (usually by using the router's processor and associated software stored in memory) to detect a presence of at least one user associated device (often, but not always, a mobile WiFi equipped user associated device) by determining (e.g. by detecting and then using the processor to recognize) a WiFi signal characteristic of this at least one user associated device. Examples of the range of options of this user associated device are shown in FIG. 1A.
Thus according to the invention, the router will use its processor and user associated device identification criteria (typically stored in the router's memory) to determine the probable identity of the at least one user associated device, or at least the presence of a user. Typically this identity may be relatively specific to an individual type of device being detected. Here the idea is to allow the router's processor to determine if the router has likely WiFi detected the presence of this particular user associated device before.
According to the invention, the router will then use its processor, and various types of router controlled device operational heuristics stored in the router's memory (e.g. algorithms by which to operate various types of appliances, such as home automation appliances), as well as the probable identity of at least one user associated device, to control an operation of at least one router controlled device (e.g. home automation appliance).
Note that alternative nomenclature is possible. More generally, the user associated device may be viewed as being the “device used to infer the presence of a user”, and the device that is acted upon by the router based upon the inferred presence of a user may be viewed as being the “router controlled device” or the “appliance”.
Put alternatively, the invention may also be a wireless router that can detect (or at least infer) the presence various human or animal users on its network based detecting WiFi patterns of use and various detection heuristics (algorithms). The wireless router then uses this presence information, along with other algorithms to then control at least some router connected appliances (router controlled devices).
In terms of user presence detection:

    
    
        Wireless computerized devices can be identified based on their MAC address or other types of unique identifiers (here MAC address is the Media Access Control Address of the device)
        Wireless computerized devices (or at least the presence of the user that uses the device) can also be identified based on websites visited at certain times of the day
        One or more user associated devices can be assigned to the same user.
    
    


In a preferred embodiment, the at least one user associated device will have a time-persistent MAC address; and the WiFi router will store this persistent MAC address in the router's memory (along with optional operator entered information informing the router that this particular MAC address is useful for user presence detection purposes). In this case, the router's computerized device identification criteria can use this persistent MAC address to determine the probable identities of the various user associated devices, and more importantly, infer that certain users are present local to the router. (Here remember that WiFi signals typically operate over a 300 foot or less radius, and if a WiFi signal from a user associated device is detected, then the router can infer that the user is likely within 300 feet of the router.)
Types of user associated devices (device used to infer the presence of a user):
It should be apparent that the router methods described herein need not be limited to WiFi equipped user associated devices. Indeed, the presence of various users can be detected using a broad variety of user associated devices, which can connect to the router using a large variety of different interfaces, including wired interfaces (Ethernet, USB, etc.) or alternative wireless protocols such as ZigBee, Z-wave, Bluetooth and the like. However in a preferred embodiment, the devices used to infer the presence of a user are often WiFi equipped mobile user associated devices that are using the router as a gateway to a larger computer network such as the internet.
Typically the user associated device (device used to infer the presence of a user) is initially associated with a user (typically a human user, although users can be animals as well) by storing an association between the user associated device and the user in the router's memory. This can be done by an operator using the router's operator interface as described elsewhere in this disclosure, or by alternative methods. The router will further use software based algorithms to then infer the presence of the user, and often then further use this inferred user presence, along with previously stored heuristics or algorithms, to then control an operation of said at least one router controlled device (router controlled device, appliance).
The association between particular user associated devices and particular users, which is ultimately stored in the router's memory) can be done by various methods

    
    
        One or more user associated devices can be manually assigned to a user by, for example, using the router's operator interface to manually enter this association.
        One or more user associated devices can be heuristically (e.g. following various rules that themselves can be entered in by an operator into the router's memory) determined to belong to a given user
        The association between various user associated devices and at least certain classes of users can be done by entering in algorithms into the router that correlate times of day or days of week when user associated devices join and leave the network.
    
    


Again using an office building as an example, if large numbers of the roughly the same set of user associated devices normally join the network on a 9:00 AM to 5:00 PM basis on Mondays to Fridays, then the router can be instructed to assume that these user associated devices are indicative of the presence of employee users. The office building's heating and air conditioning system and lighting system can be programmed at the router to respond appropriately. Note that here, the router is acting as a control center, and the router is controlling the various heating and air conditioning equipment (for example) as router controlled devices.
This way, if some employees show up unexpectedly on the weekend or after normal working hours, the router can detect this (e.g. it sees a lot of WiFi equipped mobile phones showing up), and (with proper router based algorithms) keep the office's lights on or heating/air conditioning running outside of normal working hours.
Although in some embodiments, such as the Almond router discussed earlier, the router controlled device can establish a communications link (e.g. be connected) to a router by a wireless ZigBee communications link, other methods may also be used to connect the router controlled device to the router. For example, other types of links may be established with the aid an intermediate relay device, by a direct electrical wire link, by any type of wireless link, by optical or infrared links, or by sonic (e.g. sound waves) links.
As previously discussed, in a preferred embodiment, the invention's system and method will be one in which the at least one user associated device is a mobile wireless (WiFi) computerized device associated with a user. Often WiFi equipped smartphones can be used for this purpose. Here the router is a wireless WiFi router (and often internet access point) that uses the WiFi based detection of the WiFi presence of the mobile user associated device to further determine (or infer) the presence of a given user, and to use the (inferred) presence of a given user (or users) to control the operation of at least one router controlled device (appliance).
Although, as previously discussed, identification of a given user associated device (user associated device) by using the device's MAC address is often the easiest way to identify a device, this option may not always be available. Thus alternative methods of identifying devices, or at least making inferences between a given device and the presence of a particular user, can be useful.
Thus in some embodiments, alternative methods, such as patterns of usage, may be used to identify either particular user associated devices or at least the users associated with a given user associated device. In these embodiments, typically the user operates their user associated device according to various user specific patterns. This in turn can produce user pattern characteristic WiFi signals that are detectable by the WiFi router.
According to this embodiment, algorithms to deal with these various user patterns characteristic WiFi signals are typically stored in advance in the router's memory. Thus when the WiFi router detects these user pattern characteristic WiFi signals, the router's processor can determine that there is a match between the router detected user pattern characteristic WiFi signals, and the user pattern characteristic WiFi signals that were previously stored in the router's memory. This in turn lets the router processor determine or infer if that user is present, and often to also determine (or infer) the probable identity of the user associated device used by the user.
This embodiment of the method is particularly useful when the WiFi router has a network connection with the Internet (e.g. is being used as an internet access point), and when the detected user pattern is a pattern of accessing the internet in which, for example, the user pattern consists of at least one URL of at least one internet server that is being accessed by the user's mobile user associated device. For example, if a given user typically browses an unusual URL, then this allows the router to infer that this user may be present. The browser in turn can make decisions such as, “If user is accessing the URL http://www.slashdot.com, assume husband user is home, and send a command to the air conditioner to turn on.”
Other methods of associating patterns of use, such as determining that some users typically use their WiFi computerized devices at certain times of the day may also be appropriate. For example, if one person is in the habit of waking up in the middle of the night and browsing the internet before going to the kitchen to make a snack, the router may be programmed (by the operator) to determine that 2:00 AM web browsing is typically then associated with a user who wants the kitchen light to be turned on. The operator can then program the router to send a signal to the kitchen light to turn on in this case, and it is the kitchen light that is the router controlled device.
So in some embodiments, the detected user pattern or algorithm can further comprise criteria concerning at least one time of day that the user accesses said at least one remote (often internet connected) server.
As may be seen, an important aspect of the invention is thus to provide ways to allow the router to be programmed with appropriate algorithms/heuristics to implement this type of router control functionality. Typically then, according to the invention, the system and method will often further use the router to provide an operator interface wherein an operator (usually a human operator) may configure various user associated device identification criteria and the router controlled device operational heuristics.
This operator interface can be produced by various methods and devices. In some embodiments, the WiFi router can use its processor to provide this operator interface by generating web pages to a router connected computerized device used by the user (often the user device will be running a web browser). Alternatively the router can provide information to an app running on a user device such as a smartphone or tablet.
A web browser based operator interface is shown in more detail in FIGS. 2 to 16. As will be discussed, this operator interface can thus provide an ability for the operator of the router to configure the various router controlled device operational algorithms/heuristics by entering various types of “if-then” rules. The router can then store these various types of “if-then” rules in the router's memory. Alternatively, as previously discussed, for those routers that are equipped with a touch screen, this type of operator interface might be generated directly on a router touch screen.
Some examples of heuristics (algorithms) used by the invention can include:

    
    
        A user associated device being inactive for a certain period of time. Inactivity is defined by a lack of any communications (e.g. wireless WiFi communications) with the router.
        A user associated device (typically previously recognized by the router) rejoining the network after a certain period of inactivity
        A user associated device that communicates with “certain” websites at certain times of the day or weekend for a “certain” duration. This can be useful when the user associated device has a non-unique MAC address. Here, even though the computerized wireless device itself cannot be unambiguously determined, the habits of the human (or animal) that typically uses the device can often be used to at least determine if that device user is likely to be present.
        A group of devices that join and leave the network during similar times of the day or week—here for example, in an office or factory setting, a large number of different user associated devices joining to the network can be used as an indication that the office is now open to employees or customers, and the router may use this information to, for example, set environmental and lighting router controlled devices (appliances) accordingly.
    
    


Actions that can be performed using inferences regarding the presence of certain users, which are inferred by detecting WiFi signals from WiFi computerized devices that the users are using, include:

    
    
        Use inferred user presence to set modes (home, away, vacation, night at home) of security systems, thermostats, shades, lights and other home automation systems.
        The security system could be controlled by the router itself, or the security system can be a different device on the network connected to the router.
        The home automation controller could be the router itself or a different device.
        The system can allow different users to set unique and personalized settings for their lighting, home security, and thermostats at home.
        The system can allow groups of users to set personalized settings for their home automation or home security that are different from individual user settings.
        The system can also reduce or increase the bandwidth allocated to certain devices depending on the presence of certain users. For example, in “away” mode, the camera could get a higher bandwidth priority than “Apple TV”, but in home mode, the just the opposite.
        QOS—quality of service can be varied depending on which user is present status (as a humorous example: if the husband is home set QOS high: if only the unwanted visiting in-laws are home, set QOS low)
    
    


Alternatives to the “if-then” type heuristics may also be used. Some of these alternatives include various types of switch statements (also called “switch, “case”, “select” or “inspect” in various computer languages). Switch statement like heuristics allow a user easily specify multiple outcomes depending on the value of a given input parameter. Here, for simplicity and robustness, use of structured switch statements may often be preferred. User entered lookup tables and control tables may also be used, however such methods are generally less preferred as these later methods are often harder for unskilled users to learn.
EXAMPLES
FIG. 2 shows an overview describing how the invention can monitor new devices joining the WiFi network, and use detection of these devices, and the inferred presence of certain users, to in turn control various HA (home automation) devices. In some embodiments, the router may take a few minutes to determine if a particular WiFi device is present or not, and thus it may be useful to set a device time-out timer so that the router does not react too quickly to momentary loss of signal from the various WiFi devices.
FIG. 3 shows an example of how the heuristics (algorithms) of the router may be set by an operator and then stored in the router's memory. Here the router is producing a main router control webpage. In an alternative embodiment, if the router is equipped with a touchscreen, the router this same interface may be displayed on the router touchscreen.
FIG. 4 shows an example of how, under the “sensors” section of the router control page, an air conditioning device (which also acts as a sensor as well) is connected to the router (here using a wireless ZigBee connection) may be found. This air conditioner is a router controlled device. Additionally, the lower portion of the page shows that the router (here an Almond+ device) has detected various WiFi network devices, including itself. Some of these various WiFi network devices can usefully function as user associated devices.
FIG. 5 shows an extended list of the various other WiFi devices that the router has either presently detected (active), or has previously detected (inactive) but now cannot detect because these inactive devices are either out of range, turned off, or at least have their WiFi transceivers turned off. Note that the iPhone device has been given a user adjustable 6 minute grace period, or timeout, before the router processor and software will declare the iPhone inactive.
Note that not all WiFi devices are useful to detect user presence. For example, WiFi devices that are always on and associated with a dwelling may not be useful as user presence devices. However smartphones typically function well as user associated devices because everyone usually has their smartphone with them.
FIG. 6 shows the operator interface control panel by which a human user can add or subtract various devices from the router's software configuration.
FIG. 7 shows how the user can configure the heuristics (algorithms, control rules) that determine how the router will control various router controlled devices in response to detecting the presence of various user associated devices, and in response to other criteria as well.
Here the Almond+ router is assumed, for each user associated device, to exist in a “home” state when that particular user associated device (and the human or animal user associated with that particular user associated device) has been detected by the router. That is, Almond+ infers that this user is “home”.
The Almond plus router can also exist in an “away” state where that particular user associated device (and the human or animal user associated with that particular user associated device) cannot be detected, and thus router assumes that this user is absent (away).
Here the operator has previously configured the router so that when the router first initially detects a particular user's iPhone (here Rammohan's iPhone) after it has been absent (not detected), the rule is that the router will both configure itself into a “user at home” mode, and also turn on the air conditioner.
The router has also been programmed with the reverse rule, which is that if a particular user's iPhone (here again Rammohan's iPhone) presence can no longer be detected (after a suitable guard time interval), than that user will be assumed to be absent. The router will configure itself into an away mode, and will also turn the air conditioner off.
As previously discussed, often the identity of a given WiFi device can be consistently determined by that particular device's WiFi MAC (media access control) address, and the association between that MAC address and a particular user can be also set using the router's control screen (not shown).
FIG. 8, shows the process by which a new rule, algorithm, or heuristic can be entered into the router's memory by using the router's operator interface (such as a web page, or though the router's built in touch screen if any). Here the operator is prompted to enter a name for the rule (“temp” is used here), and the rules are typically structured as “IF condition X then “result Y” type “if-then” rules. Note that the rules here also have a time component. That is, the rule can be set to be implemented anytime, or at a precise time, or between certain times. There also can be compound rules with multiple “if-then” sections.
FIG. 9 shows the operator starting to configure the new “temp” rule. Here the operator wishes to only run the target air conditioning device between certain hours of the day, here starting at 10:00 AM, and in this example, only during certain days of the week.
FIG. 10 shows more parameters. This figure shows that the heuristics (algorithms) and rules that can be set by the operator can be of the form: If during TIME, EVENT-X occurs, then with set DEVICE-Y to MODE-Z. Multiple If-then statements can be combined.
FIG. 11 shows more detail of the “THEN” part of one if-then heuristic. Note that there can be multiple actions, with various operator preset delays between actions, and that the router operator can also determine the sequence by which these various multiple actions are performed.
FIG. 12 shows an example of the Almond+ router set to two different algorithms. If the router detects that the user's iPhone is leaving, then the Almond+ router will set itself to “away” mode and send a ZigBee signal to turn off the air conditioner. The router is also set according to a “temp” algorithm so that when the Almond+ is in “home” mode, the air conditioner will be set to “on”. In this example, assume that this “temp” algorithm isn't quite what the operator wants, and the operator will then adjust this in the following figures.
FIG. 13 shows that the operator is going to modify the “if” portion of the event to add an additional constraint to the “temp” algorithm.
FIG. 14 shows that the operator is adding an additional constraint to the “if” portion of the event, which is that the “if” only applies during a certain time and date window. This is essentially a “if condition 1 AND if condition 2” type constraint, where condition 1 is determined by the presence or absence of a user's iPhone as detected by the router's WiFi transceiver and processor, and condition 2 is a time and date condition.
FIG. 15 shows the corrected “temp” algorithm. Here if the time is between 10:00 AM and 6:30 PM on Mondays, Wednesdays, and Fridays, and if the almond is in “home” mode (because the user's iPhone has been detected, or due to other “home” mode setting criteria), then the Almond+ router will turn on the air conditioner.
FIG. 16 shows a summary of two different algorithms operating in the Almond+ router. “The Leaving Home” algorithm shows that if the WiFi signal from the previously detected user iPhone cannot be detected, then the Almond plus will set itself into “away” mode, and send a ZigBee signal to turn off the air conditioner. If the Almond+ router is in “home mode” (the algorithm for setting home mode is not shown, but here assume that a third algorithm specifies that home mode is set when at least the WiFi signal from the user's iPhone is detected), and if the time is between 10:00 AM and 6:30 PM on Mondays, Wednesdays, or Fridays, then the Almond plus router will send a ZigBee signal to turn on the air conditioner.
Other types of algorithms may also be used. As another example, rules can include combinations of various delay time and wait time intervals (e.g. “after” and “wait” intervals) such as:
If (A and B and after 10 minutes C) then (D and wait for 2 minutes E and wait for 3 minutes F)
Alternative Embodiments
In some alternative embodiments, the invention may be a wireless router with integrated sensors and activators

    
    
        The sensors can be connected to the router by a wired interface (Ethernet, USB) or these devices can be built into the routers
        If the sensors are built into the router, they connect to the router's one or more processors using a wired interface G, P10, I2C, USB, SPI, UART, etc.).
        Typical sensors include
        
            Motion detectors, temperature detectors, humidity detectors, moisture detectors, light sensors, camera modules, microphones, shock detectors, tilt detectors, smoke detectors, vibration sensors, door and window opening sensors (e.g. magnetic reed sensors), flood (fluid level) sensors,
        
        
        Interface to automatically link action between some of these sensors and router controlled devices (certain sensors trigger certain action on router controlled devices)
        These automatic actions are based on certain times of the days or week
        Users can be notified of these sensor events through their mobile devices
        Users can control these router controlled devices remotely and at home through their mobile devices.
        Typical router controlled devices include
        
            Thermostats, smart AC plugs, in-wall power receptacles, lights (e.g. dimmers, on/off, varying hue, floodlights, garden lights, mood lights and the like), door and window locks, sirens, and speakers,

Machine Learning Methods:

        
        
    
    


In some alternative embodiments, at least some of the previously discussed processor and router controlled device operational heuristics can be automatically determined by using machine learning based algorithms. Here, for example, these machine learning algorithms can be configured to detect patterns of operation of the various router controlled devices and/or the various WiFi signals characteristic of various user associated devices. Such machine learning algorithms can include various types of supervised, unsupervised, semi-supervised learning, reinforcement learning, and data pre-preprocessing methods. Here, methods discussed by Flach in “Machine Learning: The Art and Science of Algorithms that Make Sense of Data” (2012), Cambridge University Press, as well as other methods (e.g. Google TensorFlow), may be useful.
Alternative Router Designs
In some embodiments, it may be useful to incorporate various additional control related devices into the circuitry of the router itself. These other devices can include built in router switched AC power receptacles, connectors or switches, as well as infrared transmitters (for infrared controlled devices such as televisions), speakers (for sound activated devices), and the like.
Interfaces with External Smart Devices:
In some embodiments, the system may also be configured to interact with external smart devices. These devices can include external voice recognition and control systems, as exemplified by the popular Amazon Echo series of smart voice recognition units. This type of smart device is configured to recognize the user's voice commands, and to use these voice commands to access information from the internet and/or to control various other electronic devices by sending and receiving commands and other information over a local WiFi router. Here, the invention, acting as the local WiFi router, also form a part of the control loop. Thus an “Alexa, I'm home” voice signal sent from a user to an Amazon Echo device can in turn be transmitted by the Echo to the invention, where this voice information in turn can be used as part of the various “if then” rules discussed elsewhere in this disclosure.
In other embodiments, the external smart device may be a control hub, or an intelligent internet controlled thermostat exemplified by the popular “Nest” thermostat series. Such internet controlled thermostats also typically connect to the internet via a WiFi router, and thus here as well, the invention can be used again form a part of the control loop. Here, for example, the invention can be used to determine if either a husband or a wife is at home by detecting the WiFi presence of their respective smart phones, and the invention can in turn interact with the Nest temperature control program to, depending on who is present, and the time of day (e.g. say when the user's normally arrive home from work) set the temperature for the preference of the husband, the preference of the wife, or a compromise preference when the WiFi presence of both smartphones are detected. The Nest device can in turn continue to otherwise intelligently control the temperature of the household based on its own independent assessment of user preferences at other times (e.g. when the Nest's device's independent best temperature assessments are not being guided by the WiFi presence of various user associated devices).

## Claims

1. A method of using a WiFi router to detect and control router controlled devices, said WiFi router comprising at least one processor, at least one of local or cloud memory, and at least one WiFi transceiver, said method comprising:
using said WiFi router to detect a presence of at least one user associated device by determining a WiFi signal characteristic of said at least one user associated device;
using said processor and user associated device identification criteria stored in said memory to determine a probable identity of said at least one user associated device;
using said at least one processor and router controlled device operational heuristics stored in said memory, and said probable identity of said at least one user associated device, to control an operation of at least one router controlled device.

2. The method of claim 1, wherein said user associated device is associated with a user;
storing an association between said user associated device and said user in said memory; and further using an inferred presence of said user to control an operation of said at least one router controlled device.

3. The method of claim 1, wherein said router controlled device is connected to said router either directly, or by an intermediate relay device, by any of a direct electrical wire link, a wireless link, an optical or infrared link, a cloud based link, or a sonic link.

4. The method of claim 1, wherein said at least one user associated device has a persistent MAC address; and
said WiFi router stores said persistent MAC address in memory, and said associated device identification criteria uses said persistent MAC address to determine the probable identify of said at least one user associated device.

5. The method of claim 1, wherein said at least one user associated device is a mobile user associated device associated with a user, and wherein said WiFi router uses a presence of said mobile user associated device to further determine a presence of said user, and to use said presence of said user to control the operation of said at least one router controlled device.

6. The method of claim 5, wherein said user operates said mobile user associated device according to user specific patterns that produce user pattern characteristic WiFi signals that are detectable by said WiFi router;
wherein said user pattern characteristic WiFi signals are stored in said memory; and
when said WiFi router detects said user pattern characteristic WiFi signals, using a match between router detected user pattern characteristic WiFi signals and said user pattern characteristic WiFi signals stored in said memory, to determine the presence of said user, and to determine the probable identity of said at least one user associated device.

7. The method of claim 6, wherein said WiFi router has a network connection with the Internet, and in which said detected user pattern comprises at least one URL of at least one internet servers accessed by said mobile user associated device.

8. The method of claim 7, wherein said detected user pattern further comprises at least one time of day that said user accesses said at least one servers.

9. The method of claim 1, further using said processor and said WiFi router to provide an operator interface wherein a human operator may configure said associated device identification criteria and said router controlled device operational heuristics.

10. The method of claim 9, wherein said processor and said WiFi router provide said operator interface by generating an interface to a router connected computerized device used by said operator; said operator interface further providing an ability to configure said router controlled device operational heuristics by entering various if-then type rules, and wherein said user entered if-then rules are stored in said memory.

11. The method of claim 10, wherein said operator interface further provides an ability to configure said router controlled device operational heuristics by entering in any of times and date type rules, and wherein said times and date type rules are stored in said memory.

12. The method of claim 1, wherein at least some of said processor and router controlled device operational heuristics are automatically determined using machine learning based algorithms configured to detect patterns of operation of said router controlled devices and/or said WiFi signals characteristic of said at least one user associated device.

13. The method of claim 1, further using said WiFi router to detect input from at least one additional sensor;
wherein said processor and router controlled device operational heuristics additionally use input from said at least one additional sensor to control an operation of said at least one router controlled device.

14. The method of claim 13, wherein said at least one additional sensor is any of motion sensors, temperature sensors, humidity sensors, moisture sensors, light sensors, camera sensors, microphones, voice recognition units, shock sensors, tilt sensors, smoke sensors, vibration sensors, door and window opening sensors, and fluid level sensors; and
wherein said at least one additional sensor is connected to said router either directly, or by an intermediate relay device, by any of a direct electrical wire link, a wireless link, an optical or infrared link, a cloud based link, or a sonic link.

15. The method of claim 1, wherein said at least one additional sensor comprises weather data obtained from a third party service.

16. The method of claim 1, wherein said at least one router controlled device is any of router controlled thermostats, smart AC plugs, in-wall power receptacles, lights, door locks, window locks, sirens, and speakers.

17. The method of claim 1, wherein said at least one WiFi router further comprises a unitized case with a built in WiFi router controlled AC switch receptacle or other AC switch configured to control availability of AC power to an external device based on WiFi router control commands.

18. A method of using a WiFi router to detect and control router controlled devices, said WiFi router comprising at least one processor, at least one of local or cloud memory, and at least one WiFi transceiver, said method comprising:
using said processor and said WiFi router to provide an operator interface wherein a human operator may configure mobile user associated device identification criteria and router controlled device operational heuristics;
wherein said processor and said WiFi router provide said operator interface by generating an interface to a router connected computerized device used by said operator; said operator interface further providing an ability to configure said router controlled device operational heuristics by entering various if-then type rules, and wherein said user entered if-then rules are stored in said memory;
using said WiFi router to detect a presence of at least one user associated device by determining a WiFi signal characteristic of said at least one user associated device;
wherein said at least one user associated device is a mobile user associated device associated with a user;
using said processor and user associated device identification criteria stored in said memory to determine a probable identity of said at least one user associated device;
wherein said WiFi router uses the presence of said mobile user associated device to further determine the presence of said user, and to use the presence of said user to control operation of at least one router controlled device by using said at least one processor and router controlled device operational heuristics stored in said memory, and said probable identity of said at least one user associated device, to control an operation of at said at least one router controlled device.

19. The method of claim 18, further using said WiFi router to detect input from at least one additional sensor;
said at least one additional sensor is any of motion sensors, temperature sensors, humidity sensors, moisture sensors, light sensors, camera sensors, microphones, voice recognition units, shock sensors, tilt sensors, smoke sensors, vibration sensors, door and window opening sensors, and fluid level sensors;
wherein said processor and router controlled device operational heuristics additionally use input from said at least one additional sensor to control an operation of said at least one router controlled device.

20. The method of claim 18, wherein said router controlled device is connected to said router either directly, or by an intermediate relay device, by any of a direct electrical wire link, a wireless link, an optical or infrared link, or a sonic link; and
wherein said at least one router controlled device is any of router controlled thermostats, smart AC plugs, in-wall power receptacles, lights, door locks, window locks, sirens, and speakers.