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.15.tar.gz (19.4 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.15-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiotica-1.0.15.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for aiotica-1.0.15.tar.gz
Algorithm Hash digest
SHA256 ed3636c9f1d2a6e6e3d37a02d52416606daf7e57ada0d0f519774282473e78c5
MD5 8c5d550af016a08d52df0eb4b510955d
BLAKE2b-256 6ffae02093ed86f220e8e1229f5fcd4ebff7ed8e651df8a377ee59b2e20868ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiotica-1.0.15-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for aiotica-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 58d06c22e5df0d0a9c582c1e97611190c4b21199d580e3b2709bb40bcaa11183
MD5 eac8f1626e5ccac16033bf69fb93a3c3
BLAKE2b-256 02fdcec828fb7fba63d1a87db4bb93d977c838bd94e5812a50509512de5ecb92

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