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.14.tar.gz (17.9 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.14-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiotica-1.0.14.tar.gz
  • Upload date:
  • Size: 17.9 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.14.tar.gz
Algorithm Hash digest
SHA256 b871b611f02ff667e025c2c44e1f5993c63c826696357d89e2682c8a3cac2455
MD5 9331154d0af622b569b11735512bda04
BLAKE2b-256 0632bf62609b5a05138fb78049cc968961b6f8c95ebb5d35dbfd9d8bd3366498

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiotica-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 21.5 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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 798f2e07a06252b7050076520ad98b170de13d568af1682fd9b532d358a8237d
MD5 1ba812af62057f3ee604c9b25302097c
BLAKE2b-256 4ae10b45106e3e470877fbb33413577585bb221ca05818401dbf44820a1fc226

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