smartHome
Post image
smartHome · 13 January 2024

Creating a Personal Assistant to automate my lifestyle

Designing, Building and Programming a personal assistant to automate my lifestyle.

See project source code on github.

This project started off a number of years ago as a simple python script that was written to automatically classify and push images detected by my CCTV camera to my phone using the free telegram API. This program has evolved many times over time and is now tailored to help me accomplish my daily tasks easily on one platform.

The project was done on very very low budget using items that I already had lying around. I did not want to spend any money as I do not have any disposable income to spend here with minimal returns. But.. As the project kept growing I had the urge to spend some money on it hoping for benefits in terms of saving time and effort. I also ran to many issues while using sub-par hardware which pushed me to develop contngency plans to keep the project running.

The project has now come to an extent that I feel I should document it and maintain some documentation as to the improvements that I am doing.


The Hardware

The hardware used is straightforward. The entire solution is powered by a solar panel so as to not consume my home electricity.

Hardware costs to date

Item

Cost (LKR)

Cumulative Cost

Solar Panel (2022)

50,000

50,000

Charge Controller (2022)

Gift

50,000

Connectors (2022)

5,000 + existing

55,000

40Ah Car Battery (2022)

22,160

77,160

100Ah Deep Cycle Battery (2024)

30,900

108,060

Raspberry Pi (2013)

Gift

108,060

Hard Disk

From old Laptop

108,060

USB to SATA

Exsiting

108,060

HP PC Second Hand (2024)

17,500

125,560

12V ATX Cable

2,782

128,342

You can read more about the solar panel here: iamJohnnySam | Homemade Solar Solution

How it started:

How its going:

Software Setup

The project at this point consisted of 2 processors that perform dedicated tasks.

  • Raspberry Pi: The main processor which handles communication and decision making
  • PC: Handles the media sharing and heavier programs

I have had to setup and resetup these processors so many times that I have documented the setup steps so that it is easier to restart when needed. The files are saved in .sh files but are not meant to run as is.

    The Software

    The code can be broken down in to below main areas. Each area runs on its own thread and also has the ability to create further short-term threads if required.

    • Communicators
    • Scheduler
    • Job Handler
    • UI
    • Logger

    At the start of the program it will execute 'platform.node()' to identify which processor the code is running on. If the hostname of either processor is detected it will run in full operation mode. If the identified platform is not matching with the hostname it will only run the programmed functions for the purpose of debugging the code. The communicators will also switch the debugging communicators to prevent cross communication if there is already a system running in operation mode.

    Modules Running on Pi

    Modules Running on HP

    • Administrator
    • Backup
    • Socket Handler
    • Telepot Handler
    • News Handler
    • Baby Handler
    • Reminder
    • News Reader
    • Administrator
    • Backup
    • Socket Handler
    • Media Handler
      • Transmission
      • Folder Refactor
      • Movie Finder
    • CCTV Checker

    Communicators

    Job Handler

    Available Modules:
    • Admin
    • Baby
    • Backup
    • CCTV Checker
    • Finance
    • Fitness
    • Folder Manager
    • Movie Finder
    • News Reader
    • Reminder
    • Show Downloader
    • Smart Home
    • Subscription Manager
    • Transmission

    The Logger

    The logger is based off the python logging library but has been improved to record the essential information from the program. This is one of the most important functions which help to log the activities of the program to keep track, monitor and troubleshoot any issues that may come up. The logger function performs the following actions.

    • Creates a log file in the log folder with the current date
    • By default all log calls are of type 'debug' and job ID of 0
    • If the log is called with an error code, it will look up the error code from the dictionary and convert the log to type error
    • Adds the message in to the log file under the classification of debug, information, error or warning
    • Inspects the stack and identifies where the call is coming from
    • Prints the message type, timestamp, calling information and the message to the console

    The message to console is printed as follows:

    ,,,,>,

    Demonstration

    In progress

    AI Generated Logos

    Similar Posts

    Other projects and posts you might find interesting.

    0 Comments