securiphant.utils package

Submodules

securiphant.utils.camera module

securiphant.utils.config module

securiphant.utils.config.config_dir = '/root/.config/securiphant'

The directory containing all config and data files for securiphant

securiphant.utils.config.load_config() → Dict[str, Any]

Loads the config for securiphant :return: The configuration data

securiphant.utils.config.write_config(data: Dict[str, Any])

Writes data to the config file :param data: The data to write :return: None

securiphant.utils.db module

securiphant.utils.db.get_boolean_state(key: str, session: sqlalchemy.orm.session.Session)securiphant.db.states.BooleanState.BooleanState

Retrieves a boolean state from the database :param key: The key of the state entry :param session: The session to use for querying :return: The BooleanState object

securiphant.utils.db.get_int_state(key: str, session: sqlalchemy.orm.session.Session)securiphant.db.states.IntState.IntState

Retrieves an int state from the database :param key: The key of the state entry :param session: The session to use for querying :return: The IntState object

securiphant.utils.db.initialize_database()

Initializes the database, creating all tables and filling default key-value pairs. :return: The database session

securiphant.utils.door module

securiphant.utils.environment module

securiphant.utils.environment.environment_check_loop()

Checks the DFT22 sensor for temperature and humidity values and stores the result in the database :return: None

securiphant.utils.environment.environment_lock = <unlocked _thread.lock object>

Lock that makes sure no two threads ever access the environment sensor at the same time.

securiphant.utils.environment.get_environment_data() → Tuple[Optional[int], Optional[int]]

Reads the temperature and humidity from an Adafruit DHT22 sensor :return: The temperature, the humidity in integer values

securiphant.utils.init module

securiphant.utils.init.initialize(configurations: List[str])

Initializes the securiphant installation :param configurations: The securiphant configurations run by this device :return: None

securiphant.utils.nfc module

securiphant.utils.qt module

securiphant.utils.speech module

securiphant.utils.speech.queue_speaker_event(db_session: sqlalchemy.orm.session.Session, text: str)

Queues a new speaker event in the database :param db_session: The database session to use :param text: The text to speak :return: None

securiphant.utils.speech.speaker_loop()

Continuously checks for new speaker events and executes any ones that were not yet executed. :return: None

securiphant.utils.systemd module

securiphant.utils.systemd.is_active(service: str) → bool

Checks whether or not a systemd securiphant service is active or not :param service: The service to check :return: True if active, else False

securiphant.utils.systemd.reload_daemon()

Reloads the systemd daemon :return: None

securiphant.utils.systemd.securiphant_services = {'display': ['display'], 'door': ['door-sensor', 'nfc-sensor'], 'server': ['alert-bot', 'speaker']}

A dictionary mapping securiphant configurations to systemd services

securiphant.utils.systemd.start_service(service: str)

Starts a service if it’s not already running :param service: The service to start :return: None

securiphant.utils.systemd.stop_service(service: str)

Stops a service if it’s running :param service: The service to stop :return: None

securiphant.utils.systemd.systemctl_call(service: str, mode: str) → int

Calls a systemctl command for a service :param service: The service for which to call the command :param mode: The command mode (ex: start or stop) :return: The status code of the call

securiphant.utils.systemd.systemd_dir = '/root/.config/systemd/user'

Thje directory containing systemd service files

securiphant.utils.weather module

securiphant.utils.weather.get_weather() → Optional[Dict[str, str]]

Gets the weather data for a specified city :return: The weather data, including the following:

  • temperature

  • humidity

  • weather type

  • weather icon

Module contents