Giter Club home page Giter Club logo

pi7's Introduction

UNIVESP - Projeto Integrador VII

ESP32 MQTT Client

[Código fonte]

Inicializar a constante DEBUG com valor true para desenvolvimento local sem TLS, ou valor false para comunicação segura com o broker remoto.

Para obter o certificado SSL (copiar o segundo certificado em root_ca)

openssl s_client -connect example.com:8883 -showcerts

As seguintes constantes precisam estar definidas em um arquivo include/secret.h

const char* mqtt_server = "example.com"
const char* root_ca = \
  "-----BEGIN CERTIFICATE-----\n" \
  "copiar aqui o certificado obtido pelo comando openssl\n" \
  "formatando cada linha como está em este modelo\n" \
  "-----END CERTIFICATE-----";
const char* ssid = "identificador da rede wifi"
const char* password = "senha da rede wifi"
const char* mqtt_user = "usuário para autenticação no broker"
const char* mqtt_pass = "senha para autenticação no broker"

Comando para testar o broker

Instalar cliente Mosquitto e executar:

# Adicionar usuário e senha
sudo mosquitto_passwd -c /etc/mosquitto/passwd mqtt_user

mosquitto_sub -h example.com -t esp32/test \
    -p 8883 --capath /etc/ssl/ \
    certs/ -u "mqtt_user" -P "mqtt_pass"

Flask MQTT WebApp

[Código fonte]

Definir variável de ambiente FLASK_ENV para produção ou desenvolvimento:

export FLASK_ENV=development            # local sem TLS
export FLASK_ENV=production             # conexão segura broker remoto

Executar:

make run

Vagrant:

cd webapp
vagrant up

Referências

pi7's People

Contributors

aledruetta avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.