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.

This scenario requires a three-node cluster system:
  • 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.

  1. Enable the DemoEndpoint which uses port 16102 on all three servers.
  2. 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.
  3. Follow these steps to set up the thermostat node:
    1. In browser 1, enter the server IP and Port of server 1, then click Connect.
    2. In the same browser instance, enter /JimsThermo/Directives/# as the topic, and click Subscribe.
    3. In the same browser instance, enter /AustinMetroPowerCompany/Requests/# as the topic, and click Subscribe.
    The thermostat node will now listen for directives, send responses, and change its temperature setting.
  4. To set up the phone node, follow these steps:
    1. In your second instance of MQTT Helper, enter the server IP and port of server 2 and click Connect.
    2. In the same browser instance, enter /JimsThermo/Responses/# for the topic and click Subscribe.
    The phone node will now be able to send and receive directives and responses to and from the thermostat.
  5. To set up the Austin Metro Power Company data center, follow these steps:
    1. In your third instance of MQTT Helper, enter the server IP and port of server 3 and click Connect.
    2. 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.

  6. To see this process in action, follow these steps:
    1. 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.
    2. In browser 1, which simulates the thermostat, observe that the message arrives at the thermostat.
    3. In the same browser instance, enter /JimsThermo/Responses/JimsDirectives as the topic, and AC set at 22°C (72°F) per Jim's request for the payload and click Publish.
    4. 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.

  7. To demonstrate how this process might work, follow these steps:
    1. In browser 3, the Austin Metro Power Company data center, enter /AustinMetroPowerCompany/Requests/ as the topic, and Brownouts possible. Emergency request to reduce power usage now!! Please raise the temperature to 27°C (80°F). as the payload, and click Publish.
    2. In browser 1, simulating the thermostat, observe the message from the Austin Metro Power Company arriving at the thermostat.
    3. In the same browser instance, enter /AustinMetroPowerCompany/Responses/JimsThermo as the topic, and Thermostat set to 27°C (80°F) following Austin Metro Power Request as the payload and click Publish.
    4. In the same browser instance, enter /JimsThermo/Responses/AustinMetroPowerCompanyRequest as the topic, and Thermostat set to 27°C (80°F) following Austin Metro Power Request as the payload, and click Publish.
    5. 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.
    6. 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.
  8. 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.