Raspberry Pi web-based home automation and security system. Code for the Raspberry Pi application