Skip to main content

Gateway programming library of KASO AioTica

Project description

# aiotica

![License](https://img.shields.io/badge/license-MIT-blue.svg)

## Overview

`aiotica` is a gateway programming library designed for the KASO IoT platform. This library provides various modules to handle event reception, access control, sensor data processing, and more, facilitating seamless interaction with IoT devices and services.

## Features

- Event reception and handling
- IoT access control
- MQTT messaging support
- AWS Greengrass integration
- Sensor data processing
- API service configuration

## Installation

You can install the `aiotica` library using `pip`:

```sh
pip install aiotica

Usage

Setting Up Your Environment

Create a Python Virtual Environment

python3 -m venv env

Activate the Virtual Environment

source env/bin/activate

Install the Library

pip install -r requirements.txt

Only for GDK Build Environment

python3 -m pip install -U git+https://github.com/aws-greengrass/aws-greengrass-gdk-cli.git@v1.6.2

Export Environment Variables

For Linux
export AWS_IOT_THING_NAME=YOUR_THING_NAME
export DEV_ACCESS_KEY=YOUR_ACCESS_KEY
export DEV_SECURITY_KEY=YOUR_SECURITY_KEY
export APPLICATION_NAME=WORKING_APPLICATION_NAME
export ENVIRONMENT=Dev
For Windows (PowerShell)
$env:AWS_IOT_THING_NAME = "YOUR_THING_NAME"
$env:DEV_ACCESS_KEY = "YOUR_AWS_ACCESS_KEY"
$env:DEV_SECURITY_KEY = "YOUR_AWS_SECURITY_KEY"
$env:APPLICATION_NAME = "CORRECT_APPLICATOIN_NAME"
$env:ENVIRONMENT = "Dev"

Importing Modules

Here's an example of how to import and use the various modules provided by aiotica:

from aiotica.event_receiver import EventReceiver
from aiotica.iot_access_control import IotAccessControl
from aiotica.model.sensor_value import SensorValue
from aiotica.platform.greengrass_client import GreengrassClient

# Initialize modules
event_receiver = EventReceiver()
access_control = IotAccessControl()
sensor_value = SensorValue()
greengrass_client = GreengrassClient()

# Example usage
event_receiver.receive_event()
sensor_data = sensor_value.get_value()
greengrass_client.connect()

Project Structure

The library has the following directory structure:

aiotica/
├── event_receiver.py
├── iot_access_control.py
├── model/
│   ├── error_log.py
│   ├── iot_credentials.py
│   ├── log_base.py
│   ├── mqtt_message.py
│   ├── sensor_value.py
│   └── thing_config.py
├── platform/
│   ├── greengrass_client.py
│   ├── ipc_client.py
│   ├── mqtt_base_interface.py
│   └── paho_mqtt_client.py
├── service/
│   ├── api_service.py
│   └── config.py
└── setup.py

Dependencies

The aiotica library requires the following dependencies:

  • Rx==3.2.0
  • paho-mqtt==2.1.0
  • boto3==1.34.95
  • awsiotsdk==1.21.4
  • requests==2.31.0

These dependencies are automatically installed when you install the library via pip.

Deploying Your Python Library to Test PyPI

To deploy your Python library to Test PyPI, follow these steps:

Step 1: Install Required Libraries

Ensure you have setuptools, wheel, and twine installed. You can install them using pip:

pip install setuptools wheel twine

Step 2: Prepare Your Distribution Files

Create the distribution packages for your library. This includes the source distribution (.tar.gz) and the built distribution (.whl).

In the directory containing your setup.py file, run:

python setup.py sdist bdist_wheel

This command will generate the distribution files in a dist/ directory.

Step 3: Publish to Test PyPI

Use twine to upload these files to Test PyPI. Use the API token you obtained from Test PyPI.

twine upload dist/* -u __token__ -p <your-api-token>

Replace <your-api-token> with your actual API token from Test PyPI.

Alternative: Using an API Command to Publish

If you prefer to use an API command for publishing, you can use curl to upload your files. Here’s an example command:

Make sure to replace yourpackage-0.0.1-py3-none-any.whl and yourpackage-0.0.1.tar.gz with the actual filenames of your distribution files, and <your-api-token> with your API token.

Recap of Commands

  1. Install required libraries:

    pip install setuptools wheel twine
    
  2. Create distribution files:

    python setup.py sdist bdist_wheel
    
  3. Upload to Test PyPI using twine:

    twine upload dist/* -u __token__ -p <your-api-token>
    

    Or, upload using curl:

    curl -F "content=@dist/yourpackage-0.0.1-py3-none-any.whl" -F "content=@dist/yourpackage-0.0.1.tar.gz" -u __token__:<your-api-token> https://test.pypi.org/legacy/
    

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Author

KASO

For any queries or further information, you can reach out to [author's email] (you@example.com).

Acknowledgements

  • Thanks to the developers of the dependencies used in this project.
  • Special thanks to the KASO team for their continuous support.

Feel free to replace placeholders like `YOUR_THING_NAME`, `YOUR_ACCESS_KEY`, `YOUR_SECURITY_KEY`, `WORKING_APPLICATION_NAME`, and `you@example.com` with actual values or instructions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiotica-1.0.16.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiotica-1.0.16-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file aiotica-1.0.16.tar.gz.

File metadata

  • Download URL: aiotica-1.0.16.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for aiotica-1.0.16.tar.gz
Algorithm Hash digest
SHA256 514f66b91b5605d4c11912836c134f15e4f2aab828a16a7222f21a839a2745ea
MD5 2d21018e5a3ca5eda4cf8936bcdcb419
BLAKE2b-256 08624a76af2b9a4dd40a5ff47767beb31ae06b780594ff6a610a45db3262f255

See more details on using hashes here.

File details

Details for the file aiotica-1.0.16-py3-none-any.whl.

File metadata

  • Download URL: aiotica-1.0.16-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for aiotica-1.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 c210f8b77096d7f81847176fefa7da3f6254e4ea627302c2c44da323d4e78943
MD5 72cb1f5ebf144e982229cabf5ceab9b2
BLAKE2b-256 6d5ed723edde57d540b868ea2fd5de2433e5318d2423785590cca4cae2ae7605

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page