Scenario 1: Using smart phones to control air conditioning remotely
Customers in Austin, Texas, have smart thermostats that enable them to use their phones to set their air conditioning and receive notifications from their thermostats.
Background to this scenario
Austin Metro Power® Company instituted a new program enabling them to send emergency requests to their customers to avoid a brownout. The company has the ability to send messages requesting power usage reductions. The customer's smart thermostats can then automatically reduce power usage when the emergency requests are received.
Planning and implementing the scenario
Use the following information to help you plan and implement your Eclipse Amlen cluster using REST APIs.
- Understanding the clustering architecture
-
In this scenario, three servers are used to represent a thermostat, a phone, and the data center of the fictional Austin Metro Power Company. These three servers are configured as a cluster. This scenario tests that the cluster can deliver directives and responses and have them display correctly on other nodes of the cluster.
- Setting up your cluster for this scenario
-
You can configure yourEclipse Amlen cluster by using REST APIs. For information about setting up your cluster for this scenario, see Configuring your environment for the cluster scenarios.
Testing the scenario
This scenario tests that the cluster can deliver directives and responses and have them display correctly on other nodes of the cluster.
- Eclipse Amlen Server 1, representing the customer's thermostat.
- Eclipse Amlen Server 2, representing the customer's phone.
- Eclipse Amlen Server 3, representing the power company.
A sample MQTT client can be found at MQTT Helper. To demonstrate the messaging capabilities of your solution, enter your server, port, client ID, and topic.
- Enable the DemoEndpoint which uses port 16102 on all three servers.
- Launch an instance of the MQTT Helper application in three separate browser instances. These instances will connect to Eclipse Amlen Server's 1, 2, and 3.
- Follow these steps to set up the thermostat node:
- In browser 1, enter the server IP and Port of server 1, then click Connect.
- In the same browser instance, enter
/JimsThermo/Directives/#
as the topic, and click Subscribe. - In the same browser instance, enter
/AustinMetroPowerCompany/Requests/#
as the topic, and click Subscribe.
- To set up the phone node, follow these steps:
- In your second instance of MQTT Helper, enter the server IP and port of server 2 and click Connect.
- In the same browser instance, enter
/JimsThermo/Responses/#
for the topic and click Subscribe.
- To set up the Austin Metro Power Company data center, follow these steps:
- In your third instance of MQTT Helper, enter the server IP and port of server 3 and click Connect.
- In the same browser instance, enter
/AustinMetroPowerCompany/Responses/#
as the topic and click Subscribe.
The power company node will now be able to send emergency requests to the thermostat node, and receive responses.
Now that you have connected the phone, the thermostat and the data center to different servers in the cluster, you can publish directives, requests and responses, and watch them be received by subscribers who are connected to different servers in the cluster.
In this scenario, Jim left hurriedly for work on Monday morning, and forgot to adjust his air-conditioning temperature before leaving home. His parents are visiting, and he wants his home to be comfortable for them. From his remote work location, Jim sends a directive to his thermostat to set the air-conditioning temperature to 22°C (72°F). The thermostat receives the directive and responds accordingly to set the temperature to 22°C (72°F). The thermostat then publishes a response notifying Jim that the temperature has been set to 22°C (72°F). Jim's phone receives the response from Jim's thermostat.
- To see this process in action, follow these steps:
- In browser 2, which simulates Jim's phone, enter
/JimsThermo/Directives/AirConditioning
as the topic,Set AC to 22°C (72°F)
as the payload, and click Publish. - In browser 1, which simulates the thermostat, observe that the message arrives at the thermostat.
- In the same browser instance, enter
/JimsThermo/Responses/JimsDirectives
as the topic, andAC set at 22°C (72°F) per Jim's request
for the payload and click Publish. - In browser 2, observe that the response arrives on Jim's phone.
This process demonstrates that devices connected to different servers can communicate messages across the cluster.
In the next portion of this scenario, it's the hottest day of the year, and by afternoon, power use is approaching critical levels. The Austin Metro Power Company begins sending requests to their customer's thermostats to reduce air conditioning usage in order to avoid a brownout.
Jim's thermostat receives the directive from the Austin Metro Power Company to increase the temperature. The thermostat then publishes a response, notifying Jim and the Austin Metro Power Company that the temperature has been set to 27°C (80°F) in response to a power reduction request from Austin Metro Power Company. Jim's phone and Austin Metro Power Company both receive the response from Jim's thermostat.
- In browser 2, which simulates Jim's phone, enter
- To demonstrate how this process might work, follow these steps:
- In browser 3, the Austin Metro Power Company data center, enter
/AustinMetroPowerCompany/Requests/
as the topic, andBrownouts possible. Emergency request to reduce power usage now!! Please raise the temperature to 27°C (80°F).
as the payload, and click Publish. - In browser 1, simulating the thermostat, observe the message from the Austin Metro Power Company arriving at the thermostat.
- In the same browser instance, enter
/AustinMetroPowerCompany/Responses/JimsThermo
as the topic, andThermostat set to 27°C (80°F) following Austin Metro Power Request
as the payload and click Publish. - In the same browser instance, enter
/JimsThermo/Responses/AustinMetroPowerCompanyRequest
as the topic, andThermostat set to 27°C (80°F) following Austin Metro Power Request
as the payload, and click Publish. - In browser 2, simulating the phone, observe that the phone receives the message
Thermostat set to 27°C (80°F) following Austin Metro Power Request
from the thermostat. - In browser 3, observe that the Austin Metro Power Company receives the message
Thermostat set to 27°C (80°F) following Austin Metro Power Request
from the thermostat.
- In browser 3, the Austin Metro Power Company data center, enter
- Now that you have seen the previous scenario work, you can continue to play around in this environment. Connect and subscribe any or all devices to different members of the cluster and repeat Step 6 or 7, verifying that you see the messages flow as you expect them to.