mmrelay 1.1.3__py3-none-any.whl → 1.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mmrelay might be problematic. Click here for more details.

@@ -0,0 +1,73 @@
1
+ """
2
+ Configuration section and key constants.
3
+
4
+ Contains configuration section names, key names, and default values
5
+ used throughout the configuration system.
6
+ """
7
+
8
+ # Configuration section names
9
+ CONFIG_SECTION_MATRIX = "matrix"
10
+ CONFIG_SECTION_MATRIX_ROOMS = "matrix_rooms"
11
+ CONFIG_SECTION_MESHTASTIC = "meshtastic"
12
+ CONFIG_SECTION_LOGGING = "logging"
13
+ CONFIG_SECTION_DATABASE = "database"
14
+ CONFIG_SECTION_PLUGINS = "plugins"
15
+ CONFIG_SECTION_COMMUNITY_PLUGINS = "community-plugins"
16
+ CONFIG_SECTION_CUSTOM_PLUGINS = "custom-plugins"
17
+
18
+ # Matrix configuration keys
19
+ CONFIG_KEY_HOMESERVER = "homeserver"
20
+ CONFIG_KEY_ACCESS_TOKEN = "access_token"
21
+ CONFIG_KEY_BOT_USER_ID = "bot_user_id"
22
+ CONFIG_KEY_PREFIX_ENABLED = "prefix_enabled"
23
+ CONFIG_KEY_PREFIX_FORMAT = "prefix_format"
24
+
25
+ # Matrix rooms configuration keys
26
+ CONFIG_KEY_ID = "id"
27
+ CONFIG_KEY_MESHTASTIC_CHANNEL = "meshtastic_channel"
28
+
29
+ # Meshtastic configuration keys (additional to network.py)
30
+ CONFIG_KEY_MESHNET_NAME = "meshnet_name"
31
+ CONFIG_KEY_MESSAGE_INTERACTIONS = "message_interactions"
32
+ CONFIG_KEY_REACTIONS = "reactions"
33
+ CONFIG_KEY_REPLIES = "replies"
34
+ CONFIG_KEY_BROADCAST_ENABLED = "broadcast_enabled"
35
+ CONFIG_KEY_DETECTION_SENSOR = "detection_sensor"
36
+ CONFIG_KEY_MESSAGE_DELAY = "message_delay"
37
+ CONFIG_KEY_HEALTH_CHECK = "health_check"
38
+ CONFIG_KEY_ENABLED = "enabled"
39
+ CONFIG_KEY_HEARTBEAT_INTERVAL = "heartbeat_interval"
40
+
41
+ # Logging configuration keys
42
+ CONFIG_KEY_LEVEL = "level"
43
+ CONFIG_KEY_LOG_TO_FILE = "log_to_file"
44
+ CONFIG_KEY_FILENAME = "filename"
45
+ CONFIG_KEY_MAX_LOG_SIZE = "max_log_size"
46
+ CONFIG_KEY_BACKUP_COUNT = "backup_count"
47
+ CONFIG_KEY_COLOR_ENABLED = "color_enabled"
48
+ CONFIG_KEY_DEBUG = "debug"
49
+
50
+ # Database configuration keys
51
+ CONFIG_KEY_PATH = "path"
52
+ CONFIG_KEY_MSG_MAP = "msg_map"
53
+ CONFIG_KEY_MSGS_TO_KEEP = "msgs_to_keep"
54
+ CONFIG_KEY_WIPE_ON_RESTART = "wipe_on_restart"
55
+
56
+ # Plugin configuration keys
57
+ CONFIG_KEY_ACTIVE = "active"
58
+ CONFIG_KEY_CHANNELS = "channels"
59
+ CONFIG_KEY_UNITS = "units"
60
+ CONFIG_KEY_REPOSITORY = "repository"
61
+ CONFIG_KEY_TAG = "tag"
62
+
63
+ # Default configuration values
64
+ DEFAULT_LOG_LEVEL = "info"
65
+ DEFAULT_WEATHER_UNITS = "metric"
66
+ DEFAULT_WEATHER_UNITS_IMPERIAL = "imperial"
67
+ DEFAULT_PREFIX_ENABLED = True
68
+ DEFAULT_BROADCAST_ENABLED = True
69
+ DEFAULT_DETECTION_SENSOR = True
70
+ DEFAULT_HEALTH_CHECK_ENABLED = True
71
+ DEFAULT_HEARTBEAT_INTERVAL = 60
72
+ DEFAULT_COLOR_ENABLED = True
73
+ DEFAULT_WIPE_ON_RESTART = False
@@ -0,0 +1,22 @@
1
+ """
2
+ Database-related constants.
3
+
4
+ Contains default values for database configuration, message retention,
5
+ and data management settings.
6
+ """
7
+
8
+ # Message retention defaults
9
+ DEFAULT_MSGS_TO_KEEP = 500
10
+ DEFAULT_MAX_DATA_ROWS_PER_NODE_BASE = 100 # Base plugin default
11
+ DEFAULT_MAX_DATA_ROWS_PER_NODE_MESH_RELAY = 50 # Reduced for mesh relay performance
12
+
13
+ # Progress tracking
14
+ PROGRESS_TOTAL_STEPS = 100
15
+ PROGRESS_COMPLETE = 100
16
+
17
+ # Text truncation
18
+ DEFAULT_TEXT_TRUNCATION_LENGTH = 50
19
+
20
+ # Distance calculations
21
+ DEFAULT_DISTANCE_KM_FALLBACK = 1000 # Fallback distance when calculation fails
22
+ DEFAULT_RADIUS_KM = 5 # Default radius for location-based filtering
@@ -0,0 +1,20 @@
1
+ """
2
+ Message format constants.
3
+
4
+ Contains default message prefixes, format templates, and other
5
+ formatting-related constants used for message display and relay.
6
+ """
7
+
8
+ # Default message prefix formats
9
+ DEFAULT_MESHTASTIC_PREFIX = "{display5}[M]: "
10
+ DEFAULT_MATRIX_PREFIX = "[{long}/{mesh}]: "
11
+
12
+ # Port number constants for message types
13
+ TEXT_MESSAGE_APP = "TEXT_MESSAGE_APP"
14
+ DETECTION_SENSOR_APP = "DETECTION_SENSOR_APP"
15
+
16
+ # Emoji flag value
17
+ EMOJI_FLAG_VALUE = 1
18
+
19
+ # Default channel
20
+ DEFAULT_CHANNEL = 0
@@ -0,0 +1,36 @@
1
+ """
2
+ User-facing messages and string templates.
3
+
4
+ Contains error messages, log templates, command responses, and other
5
+ strings that are displayed to users or logged.
6
+ """
7
+
8
+ # Log configuration defaults
9
+ DEFAULT_LOG_SIZE_MB = 5
10
+ DEFAULT_LOG_BACKUP_COUNT = 1
11
+ LOG_SIZE_BYTES_MULTIPLIER = 1024 * 1024 # Convert MB to bytes
12
+
13
+ # Numeric constants for comparisons
14
+ PORTNUM_NUMERIC_VALUE = 1 # Numeric equivalent of TEXT_MESSAGE_APP
15
+ DEFAULT_CHANNEL_VALUE = 0
16
+
17
+ # Component logger names
18
+ COMPONENT_LOGGERS = {
19
+ "matrix_nio": ["nio", "nio.client", "nio.http", "nio.crypto"],
20
+ "bleak": ["bleak", "bleak.backends"],
21
+ "meshtastic": [
22
+ "meshtastic",
23
+ "meshtastic.serial_interface",
24
+ "meshtastic.tcp_interface",
25
+ "meshtastic.ble_interface",
26
+ ],
27
+ }
28
+
29
+ # Log level styling
30
+ LOG_LEVEL_STYLES = {
31
+ "DEBUG": {"color": "cyan"},
32
+ "INFO": {"color": "green"},
33
+ "WARNING": {"color": "yellow"},
34
+ "ERROR": {"color": "red"},
35
+ "CRITICAL": {"color": "red", "bold": True},
36
+ }
@@ -0,0 +1,35 @@
1
+ """
2
+ Network and connection constants.
3
+
4
+ Contains timeout values, retry limits, connection types, and other
5
+ network-related configuration constants.
6
+ """
7
+
8
+ # Connection types
9
+ CONNECTION_TYPE_TCP = "tcp"
10
+ CONNECTION_TYPE_SERIAL = "serial"
11
+ CONNECTION_TYPE_BLE = "ble"
12
+ CONNECTION_TYPE_NETWORK = (
13
+ "network" # DEPRECATED: Legacy alias for tcp, use CONNECTION_TYPE_TCP instead
14
+ )
15
+
16
+ # Configuration keys for connection settings
17
+ CONFIG_KEY_BLE_ADDRESS = "ble_address"
18
+ CONFIG_KEY_SERIAL_PORT = "serial_port"
19
+ CONFIG_KEY_HOST = "host"
20
+ CONFIG_KEY_CONNECTION_TYPE = "connection_type"
21
+
22
+ # Connection retry and timing
23
+ DEFAULT_BACKOFF_TIME = 10 # seconds
24
+ DEFAULT_RETRY_ATTEMPTS = 1
25
+ INFINITE_RETRIES = 0 # 0 means infinite retries
26
+ MINIMUM_MESSAGE_DELAY = 2.0 # Minimum delay for message queue fallback
27
+
28
+ # Error codes
29
+ ERRNO_BAD_FILE_DESCRIPTOR = 9
30
+
31
+ # System detection
32
+ SYSTEMD_INIT_SYSTEM = "systemd"
33
+
34
+ # Time conversion
35
+ MILLISECONDS_PER_SECOND = 1000
@@ -0,0 +1,17 @@
1
+ """
2
+ Message queue constants.
3
+
4
+ Contains configuration values for the message queue system including
5
+ delays, size limits, and water marks for queue management.
6
+ """
7
+
8
+ # Message timing constants
9
+ DEFAULT_MESSAGE_DELAY = 2.0 # Firmware-enforced minimum delay in seconds
10
+
11
+ # Queue size management
12
+ MAX_QUEUE_SIZE = 500
13
+ QUEUE_HIGH_WATER_MARK = int(MAX_QUEUE_SIZE * 0.75) # 75% of MAX_QUEUE_SIZE
14
+ QUEUE_MEDIUM_WATER_MARK = int(MAX_QUEUE_SIZE * 0.50) # 50% of MAX_QUEUE_SIZE
15
+
16
+ # Queue logging thresholds
17
+ QUEUE_LOG_THRESHOLD = 2 # Only log queue status when size >= this value