Since the last time I blogged we finished the research and started programing. I was responsible for the Python code running on the RaspberryPi, I also updated the scripts so that it works with our new features and I started work on the OpenID login page.
The RaspberryPi Python code is meant to be doing the bulk of computation between the components. It should be processing the requests from the UI and send the commands to the appropriate components. Python also stores the house structure and sends the relevant information to the UI when requested. That all is done through a RESTful interface.
My work I started from making a database which would store the house structure and other relevant information about any of the items present in the house, like the type (e.g. door/window and so on). The house structure is basically a list of rooms and each room can have a list of items.
After I finished the database I made functions which would construct JSON appropriate for the relevant REST command. I also made a priority queue system, so that the commands from the UI are executed in a particular order and it does not crash when too many are made at once.
We changed from using CherryPy to Flask, and as such the dependencies and other packages had to be updated. We also decided not to include the speech recognition for now, and focus more on making the base system stable and running. This also meant I needed to remove the installation from it.
The server on the RaspberryPi in a final version will be, hopefully, accessible from outside the local network, therefore to check if the user has the permissions to interact with the house. Because we did not want to store sensitive information, we decided to use OpenID.
The implementation of OpenID on Flask was fairly simple, since there is a special package Flask-OpenID, which helps managing it easier. However there are some logistics issues that are more problematic. The main issue was that I wanted to support multiple users for one house, at the same time it would be essential to check that they are actually living in the house before letting them register. I still did not find a perfect solution for it.
The three ideas are that either just allows one user (which is currently implemented, and which is not the ideal option), check and allow users to only register from within the local network, or create a whitelist of email addresses that can register, as a part of the initial setup. I am still not sure which is the best way to go about it, and I will research it further.