LinkControl
LinkControl is an automation application that can be used to control lights, dimmers, motors and other physical devices. This application is essentially a button processing program that needs to be paired with a backend server component that ultimately controls the physical devices.
LinkControl downloads button definitions from a program running on a backend server and when a button is pressed an identifier associated with the button is returned to the server indicating which button was pressed. With that information the server decides the appropriate next step. LinkControl has no knowledge of the overall process as it just handles button definitions and button presses. The server process could connect to a lighting controller such as one made by Lutron using telnet, or perhaps connect to a Z-Wave system through a WIFI/Z-Wave bridge. Other configurations are possible. A definition of the client-server protocol used between the LinkControl application running on the iPhone/iPad and the server can be found in the following file: client-server-protocol.
A sample version of the Server code written in Python 2.7 is available in the file below. Copying this code to a .py file and running it under Python should provide enough functionality to test out the basic operation of the client code (LinkControl) running on an iPhone or iPad. Just set the server address and port number in LinkControl to match the server address where the python code is running and set the port value to the same value used in the python file. Download the sample Python server code from the following file. ( converted to pdf for easy viewing )LinkControlServer.pdf. There is quite a bit of functionality in the Python code to show how a typical home automation system might be set up. Colors on the buttons change when they are pressed and the text changes too.
Privacy Policy
The privacy policy can be found here.
Settings
There are three settings that must be set in order for the client to communicate with the server:
- Server Address: this can be either the IP address of the server or the name of the server.
- Server Port Number: the port number that the server process is using, programmed into the server process (51318 in the sample code included above)
- Password: the password that the server process will accept and allow the client to connect. Again this is part of the server process programming. The sample python server provided above does not implement the password option so any value will do when communicating with that server. The password processing just uses plain text - not very secure but potentially better nothing.
The Sizes sliders can be used to change the button and text sizes to show larger or smaller buttons on the views. Note that the tool bar buttons across the bottom are fixed in size, although they do respond to the Font size slider. The font will try to automatically resize downward to fit all of the text inside the button - typically longer text on a button results in a smaller font in order to fit that text into the button space. Typically it is best to keep the button text short so that it does not resize to a small value.
The “Reset” switch is used to disconnect the network connection and then reconnect it. Use this switch when the connection to the server has been interrupted for some reason and a reconnect is required. LinkControl will attempt to reconnect automatically for a period of time, but this process can be sped up by turning on this switch. LinkControl will attempt to reconnect immediately after returning from this view.
Button State
LinkControl reconnects to the server and re-downloads the button definitions and the current state of each button whenever it becomes active. This includes the simple case of switching to another application on the iPhone and then switching back to LinkControl. At the switch back moment LinkControl contacts the server and re-establishes its connection, resulting in a fresh download of button information and button state information. LinkControl tries to show the same view that had been previously showing the last time it had an active connection to the server. Through this simple reconnection logic, the button states shown in LinkControl should accurately reflect the current server state (i.e. the colors and text on each button should be identical to the servers database).