YT video: https://www.youtube.com/watch?v=YLYDDjMH9fY
This project is an interactive Python application that enables the creation, editing, and management of complex JSONs based on a hierarchical structure, including aspects, types, and assets. It also allows the sending of the generated JSON to an MQTT broker with TLS certificate authentication, and viewing messages received from a subscribed topic.
- 
JSON Management: - Add, edit, and view aspects, types, and assets.
- Automatic configuration of mappings in the mappingModelfield.
 
- 
MQTT Connection: - Connect to a secure MQTT broker with username/password and TLS certificates.
- Send messages to an MQTT topic.
- Subscribe and receive messages from an MQTT topic.
 
- 
User-Friendly Graphical Interface: - Developed in Tkinter to facilitate use.
- Intuitive buttons for each action.
 
- Python:
- MQTT with TLS: Additional security for communication.
project/
├── mqtt_handler.py      # Manages MQTT connection logic
├── interface.py         # Manages the graphical interface and JSON manipulation
├── infos.json           # MQTT connection settings
├── data.json            # Output file with the generated JSON
├── mqttv4/certs/        # TLS Certificates
│   ├── ca.pem           # CA Certificate
│   ├── client.pem       # Client Certificate
│   └── client.key       # Private key of the client
- Python 3.8 or higher.
- Install the necessary libraries:
pip install paho-mqtt 
Edit the infos.json file to include your MQTT broker information:
{
    "infos": {
        "BROKER": "mqtts://your-broker-here.com",
        "PORT": 8883,
        "TOPIC": "your/publish/topic",
        "TOPIC_SUB": "your/subscription/topic",
        "USERNAME": "your-username",
        "PASSWORD": "your-password",
        "CLIENT_ID": "your-client-id"
    }
}- Click on the "Configure Tenant" button and enter the tenant name
- Click on "Add Aspect".
- Fill in the ID, description, and the variables associated with the aspect (name, type, and unit).
- Click on "Add Type".
- Fill in the ID, description, and associate previously created aspects with the type.
- Click on "Add Asset".
- Fill in the asset name and select an existing type.
- Click on "Generate Mappings".
- The system automatically associates the variables of the aspects with the assets.
- Click on "View JSON" to check the current structure.
- Click on "Send Message" to publish the JSON on the configured topic.
This project uses:
- TLS 1.2 to ensure security in communication.
- .pemcertificates for authentication.
- 
MQTT Connection Error: - Check the BROKER,PORT,USERNAMEandPASSWORDininfos.json.
- Ensure that the certificates in the mqttv4/certs/directory are valid.
 
- Check the 
- 
Error Generating Mappings: - Make sure that there are correctly configured aspects, types, and assets before generating mappings.
 
<<<<<<< HEAD
=======
79892fea490e807f4b82cc2427e3e0e53abb5458
Este projeto é uma aplicação interativa em Python que permite criar, editar e gerenciar JSONs complexos baseados em uma estrutura hierárquica, incluindo aspectos, tipos e ativos (aspects, types e assets). Além disso, ele permite enviar o JSON gerado para um broker MQTT com suporte a autenticação e certificados TLS, e visualizar as mensagens recebidas de um tópico assinado.
- 
Gerenciamento de JSON: - Adicionar, editar e visualizar aspectos, tipos e ativos.
- Configuração automática de mapeamentos no campo mappingModel.
 
- 
Conexão MQTT: - Conectar-se a um broker MQTT seguro com autenticação por usuário/senha e certificados TLS.
- Enviar mensagens para um tópico MQTT.
- Inscrever-se e receber mensagens de um tópico MQTT.
 
- 
Interface Gráfica Amigável: - Desenvolvida em Tkinter para facilitar o uso.
- Botões intuitivos para realizar cada ação.
 
- Python:
- MQTT com TLS: Segurança adicional para comunicação.
project/
├── mqtt_handler.py      # Gerencia a lógica de conexão MQTT
├── interface.py         # Gerencia a interface gráfica e manipulação do JSON
├── infos.json           # Configurações de conexão MQTT
├── dados.json           # Arquivo de saída com o JSON gerado
├── mqttv4/certs/        # Certificados TLS
│   ├── ca.pem           # Certificado CA
│   ├── client.pem       # Certificado do cliente
│   └── client.key       # Chave privada do cliente
- Python 3.8 ou superior.
- Instale as bibliotecas necessárias:
pip install paho-mqtt 
Edite o arquivo infos.json para incluir as informações do seu broker MQTT:
{
    "infos": {
        "BROKER": "mqtts://seu-broker-aqui.com",
        "PORT": 8883,
        "TOPIC": "seu/topico/publicacao",
        "TOPIC_SUB": "seu/topico/assinatura",
        "USERNAME": "seu-usuario",
        "PASSWORD": "sua-senha",
        "CLIENT_ID": "seu-client-id"
    }
}- Clique no botão "Configurar Tenant" e insira o nome do tenant.
- Clique em "Adicionar Aspect".
- Preencha o ID, descrição e as variáveis associadas ao aspect (nome, tipo e unidade).
- Clique em "Adicionar Type".
- Preencha o ID, descrição e associe aspectos já criados ao tipo.
- Clique em "Adicionar Asset".
- Preencha o nome do ativo e selecione um tipo já existente.
- Clique em "Gerar Mapeamentos".
- O sistema associa automaticamente as variáveis dos aspectos aos ativos.
- Clique em "Visualizar JSON" para conferir a estrutura atual.
- Clique em "Enviar Mensagem" para publicar o JSON no tópico configurado.
Este projeto usa:
- TLS 1.2 para garantir segurança na comunicação.
- Certificados .pempara autenticação.
- 
Erro de Conexão MQTT: - Verifique o BROKER,PORT,USERNAMEePASSWORDnoinfos.json.
- Certifique-se de que os certificados no diretório mqttv4/certs/são válidos.
 
- Verifique o 
- 
Erro ao Gerar Mapeamentos: <<<<<<< HEAD - Certifique-se de que há aspectos, tipos e ativos corretamente configurados antes de gerar os mapeamentos. =======
- Certifique-se de que há aspectos, tipos e ativos corretamente configurados antes de gerar os mapeamentos.
 
79892fea490e807f4b82cc2427e3e0e53abb5458