Config¶
Configuration loading from environment variables and .env files.
Configuration loading for zigporter.
Reads environment variables from the global config file
(~/.config/zigporter/.env) or a project-level .env in the current
working directory. CWD .env takes precedence, making it easy to use
uv run zigporter against a local test instance during development.
backup_confirmed_path() -> Path
¶
Return the sentinel path written when the user confirms a HA backup.
The migrate wizard writes this file the first time the user acknowledges the backup prompt so they are not asked again on subsequent runs.
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
Source code in src/zigporter/config.py
config_dir() -> Path
¶
Return (and create) the XDG config directory for zigporter (~/.config/zigporter).
Source code in src/zigporter/config.py
default_convention_path() -> Path
¶
Return the default path for the naming convention file.
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
default_export_path() -> Path
¶
Return the default path for the ZHA device export file.
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
default_stale_path() -> Path
¶
Return the default path for the stale device state file.
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
default_state_path() -> Path
¶
Return the default path for the migration state file.
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
load_config() -> tuple[str, str, bool]
¶
Load HA_URL, HA_TOKEN, and HA_VERIFY_SSL from .env or environment variables.
Environment variables always take precedence over .env file values.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, str, bool]
|
Tuple of (ha_url, ha_token, verify_ssl) |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If HA_URL or HA_TOKEN are missing. |
Source code in src/zigporter/config.py
load_z2m_config() -> tuple[str, str]
¶
Load Z2M_URL and Z2M_MQTT_TOPIC from .env or environment variables.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, str]
|
Tuple of (z2m_url, mqtt_topic). mqtt_topic defaults to "zigbee2mqtt". |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If Z2M_URL is missing. |