Skip to main content

Management application for mqtt-based gpio-change-notifier clients

Project description

Manager (in Python) for "Gpio Change Notifier (GCN)" clients

Usage:

python3 -m gcn_manager --help
options:
  -h, --help            show this help message and exit
  --trace
  --log-level LVL
  --print-env-then-exit
  --mqtt-host HOST
  --mqtt-port PORT
  --mqtt-user-name STR
  --mqtt-user-password STR
  --mqtt-keep-alive SEC
  --mqtt-connect-timeout SEC
  --mqtt-reconnect
  --mqtt-still-connecting-alert SEC
  --mqtt-transport STR
  --mqtt-client-id-random-bytes N
  --mqtt-tls-min-version VER
  --mqtt-tls-max-version VER
  --mqtt-tls-ciphers STR
  --mqtt-socket-send-buffer-size N
  --idle-loop-sleep SEC
  --client-heartbeat-max-skew SEC
  --client-heartbeat-watchdog SEC
  --enable-email-notifications
  --enable-sms-notifications
  --enable-twitter-notifications
  --notify-manager-starting-recipients A,B,C
  --notify-manager-still-connecting-recipients A,B,C
  --notify-manager-connected-recipients A,B,C
  --notify-manager-disconnected-recipients A,B,C
  --notify-manager-exiting-recipients A,B,C
  --notify-client-skewed-heartbeat-recipients A,B,C
  --notify-client-missed-heartbeat-recipients A,B,C
  --notify-client-dropped-items-recipients A,B,C
  --notify-client-status-change-online-recipients A,B,C
  --notify-client-status-change-offline-recipients A,B,C
  --notify-client-gpio-change-up-recipients A,B,C
  --notify-client-gpio-change-down-recipients A,B,C
  --email-from FROM
  --email-smtp-host HOST
  --email-smtp-port PORT
  --email-username NAME
  --email-password PASS
  --email-smtp-starttls
  --email-smtp-debug
  --sms-allow-country CODE
  --sms-ovh-sender-name NAME
  --sms-ovh-service-name NAME
  --sms-ovh-user-name USERNAME
  --sms-ovh-endpoint URL
  --sms-ovh-app-key SECRET
  --sms-ovh-app-secret SECRET
  --sms-ovh-consumer-key SECRET
  --sms-ovh-api-timeout SEC
  --twitter-app-consumer-key SECRET
  --twitter-app-consumer-secret SECRET
  --twitter-user-access-token SECRET
  --twitter-user-access-token-secret SECRET

Or use environment variables, see constants.py

Features

  • ENV

    • recipients
      • email -> DONE
      • sms -> DONE
      • twitter -> DONE
  • MQTT

    • tls
      • mandatory -> DONE
      • mandatory verification -> DONE
    • auth
      • login/password -> DONE
    • errors
      • retryable
        • dns resolution -> DONE
        • host unreachable -> DONE
        • port unreachable -> DONE
      • fatal
        • auth failed -> DONE
        • tls failed -> DONE
  • notifications

    • manager
      • starting -> DONE
      • exiting -> DONE
    • mqtt connection
      • failing -> DONE
      • established -> DONE
    • client
      • status
        • offline -> DONE
        • online -> DONE
      • heartbeat
        • skewed -> DONE
        • missed -> DONE
      • dropped item -> DONE
    • gpio
      • raising -> DONE
      • falling -> DONE
  • brain

    • monitored gpio -> DONE
    • gpio initial -> DONE
    • gpio changed -> DONE
    • untracked -> DONE

TODO

  • implement a safeguard regarding notifications : max N/day

  • external monitor for the manager, to ensure it is running

development

python asyncio debug

export PYTHONASYNCIODEBUG=1

install make on windows (for docker images) then restart powershell

winget install --id ezwinports.make

twitter-credentials

developer portal https://developer.x.com/en

project / app / keys and token

  • Consumer Keys / API Key and Secret : regenerate
  • Authentication Tokens
    • Bearer Token : not needed
    • Access Token and Secret : regenerate
  • OAuth 2.0 Client ID and Client Secret : regenerate

project / app / settings

  • oauth 1.0 : Read and write and Direct message
  • type of app : native app
  • oauth 2.0 / callback uri : https://localhost + mandatory website

IMPORTANT: regenerate Access Token and Secret each time you modify oauth 1.0 permissions !

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

gcn_manager-1.0.6.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

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

gcn_manager-1.0.6-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file gcn_manager-1.0.6.tar.gz.

File metadata

  • Download URL: gcn_manager-1.0.6.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for gcn_manager-1.0.6.tar.gz
Algorithm Hash digest
SHA256 3b862c64b7cda6bdd10e769c0bb0ff078b908f4c752091dd9d93e6fef175a8bd
MD5 4e56ceadb0d1821a5ae8f4bef54ac0a2
BLAKE2b-256 3b385e9a09de2ef674b53e68706fff658f8aa8792ab122b4dcfe7ca365cf6237

See more details on using hashes here.

File details

Details for the file gcn_manager-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: gcn_manager-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for gcn_manager-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae10192ca2536ea5f74210999ea9a99ce09f2dd91daf3adeafc80b66974ba5e
MD5 fd1044610918c78196ba69bfa1190d5d
BLAKE2b-256 44e84e88da52b0d40d7cb42af164982f43b9ff9935619f559661f362e65521be

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