pyziggy.run¶
Provides the functionality for the pyziggy run
and pyziggy check
subcommands.
Functions
|
This is the function that's called by the |
Classes
|
Used for parsing and checking the |
- class pyziggy.run.PyziggyConfig(host: str, port: int, keepalive: int, base_topic: str, username: str | None, password: str | None, ca_crt: Path | None, client_crt: Path | None, client_key: Path | None, check_server_crt: bool, flask_port: int)¶
Bases:
object
Used for parsing and checking the
config.toml
file, to be passed torun_command()
.- static create_default() PyziggyConfig ¶
Creates a default configuration object.
- static load(config_file: Path) PyziggyConfig | None ¶
Loads the specified configuration file, checks its correctness and returns a
PyziggyConfig
object if it passes all checks. Returns None otherwise.This function is used by
pyziggy run
to load and parse theconfig.toml
file in the current automation project directory.
- write(config_file: Path) None ¶
Writes the configuration information to the specified file. Currently, this function isn’t used by
pyziggy
.
- static write_default(config_file: Path) None ¶
Writes a default
.toml
file to the specified Path. This is used by thepyziggy run
command to create the defaultconfig.toml
file if one isn’t present in the specified automation directory.
- pyziggy.run.run_command(devices_client_param: DevicesClient | Path, config: PyziggyConfig, no_startup_query: bool = False, no_mypy: bool = False, flask_app: Flask | None = None, pre_run_check_only: bool = False) None ¶
This is the function that’s called by the
pyziggy run
command-line program after theAvailableDevices
type has been regenerated.- Parameters:
devices_client_param – Either the DevicesClient object i.e. AvailableDevices, or the path to the module file that contains this object e.g.
automation.py
. If it’s the former, there is no need for importing, andrun()
can be called from the containing module file as well.config – A configuration object encapsulating all validated arguments to the run subcommand. See
PyziggyConfig
no_startup_query – If set to True, the command won’t query Z2M for parameter values on startup.
no_mypy – If set to True, the command won’t run mypy prior to entering operation.
flask_app – A
flask.Flask
object to serve HTTP requests.pre_run_check_only – Turns this function into the equivalent of the
check
subcommand.