The time has come to integrate all the elements of control into one program. The new method of communication (more here), bootstrap facilitating fast building of responsive pages and a fancy opensource template were sufficient to provoke me to start another project. Here is the final effects and the details follow below.
PLC controllers are not equipped with proper security of internet access. Their protections are primitive. Exposing your PLC to the outer world means putting it into unknown hands. For example – modbus has NO authentication features.
Consequently you need an intermediary to control your PLC from another network. In my case this role is fulfilled by RaspberryPi. PHP scripts send and read the data to the controllers assuring a proper level of authentications, cookies, etc. Additionally, since I do not have a static IP address, I use dyndns.org, which converts my current IP to a fixed domain name.
The first page, which appears after entering the address and logging in is the Dashboard. It holds some widgets witch get refreshed at different intervals fitting the kind of the presented information.
The number of active lights
It requests the statuses of all PLC’s outputs, which control the lights and counts those, which return TRUE. The extent of the icon (bulb) glow represent the number of active lights. On hover the widget displays the lists of the active outputs.
It reads statuses of movement sensors, which are connected to the SATEL alarm system. It also requests the current time and the time of the last movement. If any of the sensors is active, it displays the name of the room, where the movement has been sensed. If there is no movement, the time since the last move is counted and presented.
Current energy usage
It reads the value of a variable holding the current usage of electricity. The graph below the reading show the last 30 values and allows checking the short-term history.
It gets the temperature of the hot water in the boiler and the status of the pomp responsible of the hot water heating. When the woter is hitted the icon pulses from red to white.
It initiates a current measurement of the liquid level and presents it on a pie chart. It also reads values of the last 90 days from a SQL database and searches for the day of the last tank emptying.
It reads the statuses of the inputs connected to contact sensors attached to the garage doors.
It reads the current power of the burner and displays it as a percentage. Additionaly it shows the current boiler mode (off, only water, water and heating).
It uses the data from forecast.io and displays current data plus the forecast for the next 5 days.
The further pages on the side menu are the “Visualizations”.
They are based on png images prepared in a graphic editor. Active elements are simple <div>s. The visualization controls the lights, blinds, target room temperatures and shows besides the current status of lights, blind position and temperatures also the statuses of movement sensors and valves controlling heat exchangers.
The page “Sensors” presents all sensors connected to the system.
Room temperatures are shown on two graphs. The colors of individual bars represent the temperature in a pallet from dark blue to red. Additionally one can find the current measurement of light intensity, rain sensor status, outside temperatures from the north and the south of the building and barometric pressure.
The section “Graphs” contains data pulled from SQL database.
They are split into 3 categories: temperatures (rooms and outside), environment (light intensity and pressure), and assets (electric energy usage and tank level).
The page “Camera” gives access to the current images from the camera hanging on the front wall.
As a default a 640x480 image is display. It is possible to switch to the full density image (3MP) scaled down to the size of the window. On can also magnify an part of the view at full resolution. Camera is the device which really profits from the access through the world wide web.
The part “Boiler” shows the current parameters of the boiler controls: outside temperature red by the built-in weather automation, room temperature, hot water temperature, boiler temperature, fumes temperature and burner power.
It enables switching between operation modes and setting temperatures for the normal, reduced and party modes as well as setting the targets hot water temperature. Animated gifs present the current statuses of pomps responsible for hot water circulation, hot water tank heating and general circulation.
The section “Schedules” gives access to all time programs: times of switching between normal and reduced mode, hot water circulation and hot water heating.
The page “Garden” gives the control over the valves controlling the sprinklers and drop lines.
Each valve can be manually switched on and off but can also be controlled by a timer. One can set the valve’s opening and closing time and choose days of the weeks. The duration of watering can also be set by a slider. Once the data is changed the calendar icon turns red. After it is pressed the on and off times of all valves are recalculated in line with the set durations to enable consecutive opening of all the valves one after another.
The “Settings – Blinds” page shows many parameters related to the blinds.
The position of the sun above horizon is not sufficient to send a proper trigger for moving the blinds up and down. In my case the signal for closing the blinds is sent when the sun crosses the position of -6 degrees below horizon. Similarly with the sunset. I want the blinds to be up even when it is grayish outside. Further switches allow to set the auto-shading or forcing the shade position. Additionally the minimum temperature and the minimum amount of lights can be defined. Otherwise the auto-shadowing could work when it is too cold or too dark.
Each individual blind has its setting table. The time for up and down movements can be set (used for calculating the position) as well as the times of powering. Since the system allows moving the blinds to a predefined position (not only fully-up or fully-down) the target positions can be set. In the part of auto-shade settings one needs to set the start and end sun position, the inertia (time from the moment when light or temperatures thresholds are crossed until the autho-shading turns on – needed to exclude reaction to small clouds) and timeout after manual blind control.
“Blinds timers” make it possible to set when and at what circumstances the blinds should automatically move up or down.
Their movement can be made dependable on the sunrise/sunset signal or setting of schedulers. It is also possible to decide if when moving down, the blinds should move down completely or to a predefined position. Each blind has two schedulers to use – for example one for week days and the other for weekends.
So much about individual pages. I still need to work on some lights to get access to setting of automatic switching on or off.
To sum up, the integrated administration dashboard gives me: