After confirming this functionality, we added in the alarm set screen, adding an alarm state variable (embedded FSM) to keep track of which screen should be displayed. From here we went to add on touch event handling that allowed us to toggle the alarms and switch to the yet to be developed z-wave screen, and alarm set screen. After integrating/instantiating the alarm class, we tested our script to make sure our alarm home screen appeared as intended. After testing the GUI, we went on to develop the alarm class that would store all the relevant information for our alarm. In creating the alarm system, we began with developing the GUI that would allow us to display each alarm. While the z-wave GUI script was being written and tested, in parallel, we worked on the alarm setup. After testing this functionality we moved on to integrate the above with our pygame GUI and once again tested this script. After writing our own code, sans gui, we tested our z-wave controller and made sure we could control our light-bulb and switch the same way the example program allowed us to. After testing an example script we moved on to write our own python-openzwave code. In order to do so we installed the openzwave library, and first tested an example script. The first step of this approach was getting openzwave working on the pi. RASPBERRY PI SMART HOME CONTROL FULLWhile developing our smart home system we took a very iterative and incremental approach, unit testing each component prior to full integration. Each alarm also holds information in regards to the time of the alarm, whether or not it is on, and what z function to run when the alarm is triggered. The alarms themselves are held in their own Alarm_class(x,y) that is instantiated with the top left corner of their position on the alarm home screen (allowing us to dynamically draw/redraw each of our alarms). The background blocks and Z symbol are part of the overall background image, and the alarm time and status (on or off) are drawn dynamically based on each alarms settings. The first screen we worked on was the alarm screen which displays the four configurable alarms and allows us to configure each of them separately. In order to achieve this functionality we created a subsystem of our overall program that was centered around the alarm and alarm set screens shown below. The A large portion of the functionality of this project was creating a custom alarm system that interacts with our openzwave things - allowing us to turn on and off 4 independant alarms, each with the ability to turn on their own thing. Similarly, the event checking function takes in the state of the program as well as the mouse click location to check for the events befitting the characteristics of the node and/or program state. The drawing method selectively draws GUI components based on the characteristics of the node. It also contains methods used to draw the thing as well as handle events such as button clicks. All GUI components needed for control (dimmer slider, power switch, selection button) are included in the Thing. The current state of the thing (on/off, dim level) are also extracted from the node and stored. It is initialized to know its index within the list of Things referenced by the rest of the program for control (used for selection for Alarms), node object (enabling direct control over that node), and different fonts used for GUI rendering. The Thing class is used to display each node in the network and control it. After this period, we loop through all of the network object’s nodes and generate a list of Thing. Most of this was setting various options and configuration parameters to run the network, then giving it time to become ready. RASPBERRY PI SMART HOME CONTROL HOW TOUsing the provided hello_world.py example, we learned how to initialize the network and let it discover all connected nodes. The library itself was originally a C++ library but later offered a Python wrapper, which worked out well with our semester-long familiarity with Python. The first main component of the program deals with the Z-Wave network initialization and management using the openzwave library.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |