enhomie.homie package#

Subpackages#

Submodules#

enhomie.homie.common module#

Functions and routines associated with Enasis Network Homie Automate.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enhomie.homie.common.HomieStage(state: Literal['poweron', 'nopower'] | None = None, color: str | Color | None = None, level: int | None = None)[source]#

Bases: object

Contain information about the parameters for the scene.

color: Color | None = None#
level: int | None = None#
state: Literal['poweron', 'nopower'] | None = None#

enhomie.homie.config module#

Functions and routines associated with Enasis Network Homie Automate.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enhomie.homie.config.HomieConfig(sargs: dict[str, Any] | None = None, files: str | Path | list[str | Path] | tuple[str | Path] | set[str] | None = None, cargs: dict[str, Any] | None = None)[source]#

Bases: Config

Contain the configurations from the arguments and files.

Parameters:
  • sargs – Additional arguments on the command line.

  • files – Complete or relative path to config files.

  • cargs – Configuration arguments in dictionary form, which will override contents from the config files.

merge_params() None[source]#

Update the Pydantic model containing the configuration.

property params: HomieParams#

Return the Pydantic model containing the configuration.

Warning

This method completely overrides the parent but is based on that code, would be unfortunate if upstream changes meant this breaks or breaks something else.

Returns:

Pydantic model containing the configuration.

enhomie.homie.homie module#

Functions and routines associated with Enasis Network Homie Automate.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enhomie.homie.homie.Homie(config: HomieConfig)[source]#

Bases: object

Interact with supported devices to ensure desired state.

Parameters:

config – Primary class instance for configuration.

property aspired: HomieAspired#

Return the related desired state for the desired groups.

Returns:

Related desired state for the desired groups.

property childs: HomieChilds#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property config: HomieConfig#

Return the Config instance containing the configuration.

Returns:

Config instance containing the configuration.

property desired: HomieDesired#

Return the related actions matching the provided event.

Returns:

Related actions matching the provided event.

property dryrun: bool#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property dumped: dict[str, Any]#

Return the facts about the attributes from the instance.

Returns:

Facts about the attributes from the instance.

get_actions(target: HomieActionNode, *, state: HomieState | None = None, color: str | None = None, level: int | None = None, scene: HomieScene | None = None, force: bool = False, change: bool = True) HomieActionBase[source]#

Insert the new item containing information for operation.

Parameters:
  • target – Device or group settings will be updated.

  • state – Determine the state related to the target.

  • color – Determine the color related to the target.

  • level – Determine the level related to the target.

  • scene – Determine the scene related to the target.

  • force – Override the default for full idempotency.

  • change – Determine whether the change is executed.

j2parse(value: Any, statics: dict[str, Any] | None = None, literal: bool = True) Any[source]#

Return the provided input using the Jinja2 environment.

Parameters:
  • value – Input that will be processed and returned.

  • statics – Additional values available for parsing.

  • literal – Determine if Python objects are evaled.

Returns:

Provided input using the Jinja2 environment.

property jinja2: HomieJinja2#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property logger: HomieLogger#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property params: HomieParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property persist: HomiePersist#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property potent: bool#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

printer(source: HomiePrint, color: int = 6) None[source]#

Print the contents for the object within Homie instance.

Parameters:
  • source – Content which will be shown after header.

  • color – Override the color used for box character.

refresh(timeout: int | None = None) bool[source]#

Refresh the cached information for the remote upstream.

Parameters:

timeout – Timeout waiting for the server response.

Returns:

Boolean indicating the success of the refresh.

set_actions(aitems: HomieActionBase, force: bool = False, change: bool = True) bool[source]#

Insert the new item containing information for operation.

Parameters:
  • aitems – Constructed action objects for operation.

  • force – Override the default for full idempotency.

  • change – Determine whether the change is executed.

Returns:

Boolean indicating whether or not was changed.

enhomie.homie.models module#

Functions and routines associated with Enasis Network Homie Automate.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enhomie.homie.models.HomieModels[source]#

Bases: object

Return the class object that was imported within method.

classmethod action() Type[HomieActionItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod aspire() Type[HomieAspireParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod aspired() Type[HomieAspiredItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod builtins() Type[BltnModels][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod child() Type[HomieChildParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod desire() Type[HomieDesireParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod desired() Type[HomieDesiredItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod device() Type[HomieDeviceParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod group() Type[HomieGroupParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod homie() Type[HomieParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod hubitat() Type[HubiModels][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod occur() Type[HomieOccurParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod origin() Type[HomieOriginParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod philips() Type[PhueModels][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod plugin() Type[HomiePluginParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod printer() Type[HomiePrinterParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod queue() Type[HomieQueueItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod scene() Type[HomieSceneParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod service() Type[HomieServiceParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod stage() Type[HomieStage][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod stream() Type[HomieStreamItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod thread() Type[HomieThreadItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod ubiquiti() Type[UbiqModels][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod update() Type[HomieUpdateItem][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

classmethod where() Type[HomieWhereParams][source]#

Return the class object that was imported within method.

Returns:

Class object that was imported within method.

enhomie.homie.service module#

Functions and routines associated with Enasis Network Homie Automate.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enhomie.homie.service.HomieService(homie: Homie)[source]#

Bases: object

Multi-threaded service for processing the desired state.

Parameters:

homie – Primary class instance for Homie Automate.

property actions: HomieActions | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

check_congest() bool[source]#

Return the boolean indicating when queues are congested.

Returns:

Boolean indicating when queues are congested.

check_zombies() bool[source]#

Return the boolean indicating while threads are zombies.

Returns:

Boolean indicating while threads are zombies.

property congest: list[tuple[str, int]]#

Return the list of congested threads and members queues.

Returns:

List of congested threads and members queues.

property enqueue: list[tuple[str, int]]#

Return the list of congested threads and members queues.

Returns:

List of congested threads and members queues.

property homie: Homie#

Return the Homie instance to which the instance belongs.

Returns:

Homie instance to which the instance belongs.

operate() None[source]#

Perform the operation related to Homie service members.

operate_healths() None[source]#

Perform the operation related to Homie service members.

operate_streams() None[source]#

Perform the operation related to Homie service members.

operate_updates() None[source]#

Perform the operation related to Homie service members.

property params: HomieServiceParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property restful: HomieRestful | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property running: list[str]#

Return the list of threads which are determined running.

Returns:

List of threads which are determined running.

soft(*args: Any, **kwargs: Any) None[source]#

Stop the various threads within the Homie class object.

Parameters:
  • kwargs – Keyword arguments ignored by the method.

  • args – Positional arguments ignored by the method.

start() None[source]#

Start the various threads within the Homie class object.

stop(*args: Any, **kwargs: Any) None[source]#

Stop the various threads within the Homie class object.

Parameters:
  • kwargs – Keyword arguments ignored by the method.

  • args – Positional arguments ignored by the method.

property streams: HomieStreams | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property updates: HomieUpdates | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property zombies: list[str]#

Return the list of threads which are determined zombies.

Returns:

List of threads which are determined zombies.

Module contents#

Functions and routines associated with Enasis Network Homie Automate.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enhomie.homie.Homie(config: HomieConfig)[source]#

Bases: object

Interact with supported devices to ensure desired state.

Parameters:

config – Primary class instance for configuration.

property aspired: HomieAspired#

Return the related desired state for the desired groups.

Returns:

Related desired state for the desired groups.

property childs: HomieChilds#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property config: HomieConfig#

Return the Config instance containing the configuration.

Returns:

Config instance containing the configuration.

property desired: HomieDesired#

Return the related actions matching the provided event.

Returns:

Related actions matching the provided event.

property dryrun: bool#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property dumped: dict[str, Any]#

Return the facts about the attributes from the instance.

Returns:

Facts about the attributes from the instance.

get_actions(target: HomieActionNode, *, state: HomieState | None = None, color: str | None = None, level: int | None = None, scene: HomieScene | None = None, force: bool = False, change: bool = True) HomieActionBase[source]#

Insert the new item containing information for operation.

Parameters:
  • target – Device or group settings will be updated.

  • state – Determine the state related to the target.

  • color – Determine the color related to the target.

  • level – Determine the level related to the target.

  • scene – Determine the scene related to the target.

  • force – Override the default for full idempotency.

  • change – Determine whether the change is executed.

j2parse(value: Any, statics: dict[str, Any] | None = None, literal: bool = True) Any[source]#

Return the provided input using the Jinja2 environment.

Parameters:
  • value – Input that will be processed and returned.

  • statics – Additional values available for parsing.

  • literal – Determine if Python objects are evaled.

Returns:

Provided input using the Jinja2 environment.

property jinja2: HomieJinja2#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property logger: HomieLogger#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property params: HomieParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property persist: HomiePersist#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property potent: bool#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

printer(source: HomiePrint, color: int = 6) None[source]#

Print the contents for the object within Homie instance.

Parameters:
  • source – Content which will be shown after header.

  • color – Override the color used for box character.

refresh(timeout: int | None = None) bool[source]#

Refresh the cached information for the remote upstream.

Parameters:

timeout – Timeout waiting for the server response.

Returns:

Boolean indicating the success of the refresh.

set_actions(aitems: HomieActionBase, force: bool = False, change: bool = True) bool[source]#

Insert the new item containing information for operation.

Parameters:
  • aitems – Constructed action objects for operation.

  • force – Override the default for full idempotency.

  • change – Determine whether the change is executed.

Returns:

Boolean indicating whether or not was changed.

class enhomie.homie.HomieConfig(sargs: dict[str, Any] | None = None, files: str | Path | list[str | Path] | tuple[str | Path] | set[str] | None = None, cargs: dict[str, Any] | None = None)[source]#

Bases: Config

Contain the configurations from the arguments and files.

Parameters:
  • sargs – Additional arguments on the command line.

  • files – Complete or relative path to config files.

  • cargs – Configuration arguments in dictionary form, which will override contents from the config files.

merge_params() None[source]#

Update the Pydantic model containing the configuration.

property params: HomieParams#

Return the Pydantic model containing the configuration.

Warning

This method completely overrides the parent but is based on that code, would be unfortunate if upstream changes meant this breaks or breaks something else.

Returns:

Pydantic model containing the configuration.

class enhomie.homie.HomieService(homie: Homie)[source]#

Bases: object

Multi-threaded service for processing the desired state.

Parameters:

homie – Primary class instance for Homie Automate.

property actions: HomieActions | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

check_congest() bool[source]#

Return the boolean indicating when queues are congested.

Returns:

Boolean indicating when queues are congested.

check_zombies() bool[source]#

Return the boolean indicating while threads are zombies.

Returns:

Boolean indicating while threads are zombies.

property congest: list[tuple[str, int]]#

Return the list of congested threads and members queues.

Returns:

List of congested threads and members queues.

property enqueue: list[tuple[str, int]]#

Return the list of congested threads and members queues.

Returns:

List of congested threads and members queues.

property homie: Homie#

Return the Homie instance to which the instance belongs.

Returns:

Homie instance to which the instance belongs.

operate() None[source]#

Perform the operation related to Homie service members.

operate_healths() None[source]#

Perform the operation related to Homie service members.

operate_streams() None[source]#

Perform the operation related to Homie service members.

operate_updates() None[source]#

Perform the operation related to Homie service members.

property params: HomieServiceParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property restful: HomieRestful | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property running: list[str]#

Return the list of threads which are determined running.

Returns:

List of threads which are determined running.

soft(*args: Any, **kwargs: Any) None[source]#

Stop the various threads within the Homie class object.

Parameters:
  • kwargs – Keyword arguments ignored by the method.

  • args – Positional arguments ignored by the method.

start() None[source]#

Start the various threads within the Homie class object.

stop(*args: Any, **kwargs: Any) None[source]#

Stop the various threads within the Homie class object.

Parameters:
  • kwargs – Keyword arguments ignored by the method.

  • args – Positional arguments ignored by the method.

property streams: HomieStreams | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property updates: HomieUpdates | None#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property zombies: list[str]#

Return the list of threads which are determined zombies.

Returns:

List of threads which are determined zombies.