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.4.tar.gz (26.6 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.4-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gcn_manager-1.0.4.tar.gz
  • Upload date:
  • Size: 26.6 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.4.tar.gz
Algorithm Hash digest
SHA256 63477cac545271771515941b0b835c2ad590b1a8b8897e8e1308cc87c72c7dda
MD5 f325c73ed49bd00a05bf20a80cd13903
BLAKE2b-256 1647667a2b51c21747d7fb92665a3f3dc1fa0b4b2f16f5569e003e90c1085023

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gcn_manager-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 26.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bcdf78a3de6659098921a8aac301bc580ad3080f344def8dc7f895bbbc7ecafc
MD5 399ee44e8a799ce789191db0f92ccf52
BLAKE2b-256 4f507738af6f1797c7a5aaf73de8304fce1775727260bfe52b620a37759d88d8

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