enhomie.homie.addons package#

Subpackages#

Submodules#

enhomie.homie.addons.aspired 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.addons.aspired.HomieAspired(homie: Homie)[source]#

Bases: object

Contain information related to the aspired child state.

Parameters:

homie – Primary class instance for Homie Automate.

items(sitem: HomieStreamItem) list[HomieAspiredItem][source]#

Return the action state objects for the related targets.

..note::

Somewhat similar to same method within HomieDesire.

Parameters:

sitem – Item containing information for operation.

Returns:

Action state objects for the related targets.

class enhomie.homie.addons.aspired.HomieAspiredItem(target: HomieActionNode, aspire: HomieAspire)[source]#

Bases: object

Contain information related to the aspired child state.

aspire: HomieAspire#
color: str | None = None#
level: int | None = None#
scene: HomieScene | None = None#
state: HomieState | None = None#
target: HomieActionNode#

enhomie.homie.addons.desired 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.addons.desired.HomieDesired(homie: Homie)[source]#

Bases: object

Contain information related to the desired child state.

Parameters:

homie – Primary class instance for Homie Automate.

items(time: Time) list[HomieDesiredItem][source]#

Return the action state objects for the related targets.

..note::

Somewhat similar to same method within HomieAspire.

Parameters:

time – Time that will be used in the conditionals.

Returns:

Action state objects for the related targets.

class enhomie.homie.addons.desired.HomieDesiredItem(target: HomieActionNode, desire: HomieDesire)[source]#

Bases: object

Contain information related to the desired child state.

property applied: bool#

Return the boolean indicating that there will be change.

Returns:

Boolean indicating that there will be change.

color: str | None = None#
desire: HomieDesire#
level: int | None = None#
matched() None[source]#

Perform operations when this desire is the most desired.

omitted() None[source]#

Perform operations when this desire is the most desired.

property paused: bool#

Return the boolean indicating whether operation delayed.

Returns:

Boolean indicating whether operation delayed.

scene: HomieScene | None = None#
state: HomieState | None = None#
target: HomieActionNode#
weight: int#

enhomie.homie.addons.jinja2 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.addons.jinja2.HomieJinja2(homie: Homie)[source]#

Bases: Jinja2

Parse the provided input and intelligently return value.

Parameters:

homie – Primary class instance for Homie Automate.

enhomie.homie.addons.logger 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.addons.logger.HomieLogger(homie: Homie)[source]#

Bases: object

Methods for extending use of underlying logging library.

log(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log().

Parameters:

kwargs – Keyword arguments for populating message.

log_c(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_c().

Parameters:

kwargs – Keyword arguments for populating message.

log_d(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_d().

Parameters:

kwargs – Keyword arguments for populating message.

log_e(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_e().

Parameters:

kwargs – Keyword arguments for populating message.

log_i(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_i().

Parameters:

kwargs – Keyword arguments for populating message.

log_w(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_w().

Parameters:

kwargs – Keyword arguments for populating message.

start() None[source]#

Initialize the Python logging library using parameters.

stop() None[source]#

Deinitialize the Python logging library using parameters.

enhomie.homie.addons.persist 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.addons.persist.HomiePersist(homie: Homie)[source]#

Bases: object

Store the persistent information in the key value store.

Parameters:

homie – Primary class instance for Homie Automate.

delete(unique: str) None[source]#

Delete the value within the persistent key value store.

Parameters:

unique – Unique identifier from within the table.

expire() None[source]#

Remove the expired persistent key values from the table.

insert(unique: str, value: int | float | bool | str | None, expire: int | float | str | None = None, *, value_unit: str | None = None, value_label: str | None = None, value_icon: str | None = None, about: str | None = None, about_label: str | None = None, about_icon: str | None = None, level: Literal['failure', 'information', 'success', 'warning'] | None = None, tags: list[str] | None = None, statics: dict[str, Any] | None = None) None[source]#

Insert the value within the persistent key value store.

record(unique: str) HomiePersistRecord[source]#

Return the record within the persistent key value store.

Parameters:

unique – Unique identifier from within the table.

Returns:

Record within the persistent key value store.

records() list[HomiePersistRecord][source]#

Return all records within the persistent key value store.

Returns:

Records within the persistent key value store.

select(unique: str) int | float | bool | str | None[source]#

Return the value from within persistent key value store.

Parameters:

unique – Unique identifier from within the table.

Returns:

Value from within persistent key value store.

class enhomie.homie.addons.persist.HomiePersistRecord(record: HomiePersistTable | None = None, *, unique: Annotated[str, MinLen(min_length=1)], value: int | float | bool | str | None, value_unit: Annotated[str | None, MinLen(min_length=1)] = None, value_label: Annotated[str | None, MinLen(min_length=1)] = None, value_icon: Annotated[str | None, MinLen(min_length=1)] = None, about: Annotated[str | None, MinLen(min_length=1)] = None, about_label: Annotated[str | None, MinLen(min_length=1)] = None, about_icon: Annotated[str | None, MinLen(min_length=1)] = None, level: Annotated[Literal['failure', 'information', 'success', 'warning'] | None, MinLen(min_length=1)] = None, tags: Annotated[list[str] | None, MinLen(min_length=1)] = None, expire: Annotated[str | None, MinLen(min_length=20), MaxLen(max_length=32)] = None, update: Annotated[str, MinLen(min_length=20), MaxLen(max_length=32)])[source]#

Bases: BaseModel

Contain the information regarding the persistent value.

Parameters:
  • record – Record from the SQLAlchemy query routine.

  • kwargs – Keyword arguments passed for downstream.

about: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='About the persist entry', metadata=[MinLen(min_length=1)])]#
about_icon: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Icon for persist entry', metadata=[MinLen(min_length=1)])]#
about_label: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Label for persist entry', metadata=[MinLen(min_length=1)])]#
expire: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='After when the key expires', metadata=[MinLen(min_length=20), MaxLen(max_length=32)])]#
level: Annotated[Literal['failure', 'information', 'success', 'warning'] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Severity of persist entry', metadata=[MinLen(min_length=1)])]#
model_config = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tags: Annotated[list[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Tags for persist entry', metadata=[MinLen(min_length=1)])]#
unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique key for the value', metadata=[MinLen(min_length=1)])]#
update: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='When the value was updated', metadata=[MinLen(min_length=20), MaxLen(max_length=32)])]#
value: Annotated[int | float | bool | str | None, FieldInfo(annotation=NoneType, required=True, description='Value stored at unique')]#
value_icon: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Icon for persist value', metadata=[MinLen(min_length=1)])]#
value_label: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Label for persist value', metadata=[MinLen(min_length=1)])]#
value_unit: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Unit for persist value', metadata=[MinLen(min_length=1)])]#
class enhomie.homie.addons.persist.HomiePersistTable(**kwargs)[source]#

Bases: SQLBase

Schematic for the database operations using SQLAlchemy.

Note

Fields are not completely documented for this model.

about#
about_icon#
about_label#
expire#
level#
tags#
unique#
update#
value#
value_icon#
value_label#
value_unit#
class enhomie.homie.addons.persist.SQLBase(**kwargs: Any)[source]#

Bases: DeclarativeBase

Some additional class that SQLAlchemy requires to work.

metadata: ClassVar[MetaData] = MetaData()#

Refers to the _schema.MetaData collection that will be used for new _schema.Table objects.

registry: ClassVar[registry] = <sqlalchemy.orm.decl_api.registry object>#

Refers to the _orm.registry in use where new _orm.Mapper objects will be associated.

enhomie.homie.addons.queue 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.addons.queue.HomieQueue(homie: Homie, size: int = 10000)[source]#

Bases: Generic[HomieQueueItemType]

Queue object that will allow to handle full conditions.

Parameters:
  • homie – Primary class instance for Homie Automate.

  • size – Maximum size for the created queue object.

property empty: bool#

Return the boolean indicating whether the queue is full.

Returns:

Boolean indicating whether the queue is full.

get() HomieQueueItemType[source]#

Return the next item within the queue in blocking mode.

Returns:

Next item within the queue in blocking mode.

put(item: HomieQueueItemType) None[source]#

Store the provided item within the queue class instance.

Parameters:

item – Item containing information for operation.

property qsize: int#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

class enhomie.homie.addons.queue.HomieQueueItem[source]#

Bases: object

Contain information for sharing using the Python queue.

time: Time#

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.addons.HomieAspired(homie: Homie)[source]#

Bases: object

Contain information related to the aspired child state.

Parameters:

homie – Primary class instance for Homie Automate.

items(sitem: HomieStreamItem) list[HomieAspiredItem][source]#

Return the action state objects for the related targets.

..note::

Somewhat similar to same method within HomieDesire.

Parameters:

sitem – Item containing information for operation.

Returns:

Action state objects for the related targets.

class enhomie.homie.addons.HomieAspiredItem(target: HomieActionNode, aspire: HomieAspire)[source]#

Bases: object

Contain information related to the aspired child state.

aspire: HomieAspire#
color: str | None = None#
level: int | None = None#
scene: HomieScene | None = None#
state: HomieState | None = None#
target: HomieActionNode#
class enhomie.homie.addons.HomieDesired(homie: Homie)[source]#

Bases: object

Contain information related to the desired child state.

Parameters:

homie – Primary class instance for Homie Automate.

items(time: Time) list[HomieDesiredItem][source]#

Return the action state objects for the related targets.

..note::

Somewhat similar to same method within HomieAspire.

Parameters:

time – Time that will be used in the conditionals.

Returns:

Action state objects for the related targets.

class enhomie.homie.addons.HomieDesiredItem(target: HomieActionNode, desire: HomieDesire)[source]#

Bases: object

Contain information related to the desired child state.

property applied: bool#

Return the boolean indicating that there will be change.

Returns:

Boolean indicating that there will be change.

color: str | None = None#
desire: HomieDesire#
level: int | None = None#
matched() None[source]#

Perform operations when this desire is the most desired.

omitted() None[source]#

Perform operations when this desire is the most desired.

property paused: bool#

Return the boolean indicating whether operation delayed.

Returns:

Boolean indicating whether operation delayed.

scene: HomieScene | None = None#
state: HomieState | None = None#
target: HomieActionNode#
weight: int#
class enhomie.homie.addons.HomieJinja2(homie: Homie)[source]#

Bases: Jinja2

Parse the provided input and intelligently return value.

Parameters:

homie – Primary class instance for Homie Automate.

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

Bases: object

Methods for extending use of underlying logging library.

log(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log().

Parameters:

kwargs – Keyword arguments for populating message.

log_c(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_c().

Parameters:

kwargs – Keyword arguments for populating message.

log_d(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_d().

Parameters:

kwargs – Keyword arguments for populating message.

log_e(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_e().

Parameters:

kwargs – Keyword arguments for populating message.

log_i(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_i().

Parameters:

kwargs – Keyword arguments for populating message.

log_w(**kwargs: Any) None[source]#

Pass the provided keyword arguments into logger object.

Note

Uses method encommon.config.Logger.log_w().

Parameters:

kwargs – Keyword arguments for populating message.

start() None[source]#

Initialize the Python logging library using parameters.

stop() None[source]#

Deinitialize the Python logging library using parameters.

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

Bases: object

Store the persistent information in the key value store.

Parameters:

homie – Primary class instance for Homie Automate.

delete(unique: str) None[source]#

Delete the value within the persistent key value store.

Parameters:

unique – Unique identifier from within the table.

expire() None[source]#

Remove the expired persistent key values from the table.

insert(unique: str, value: int | float | bool | str | None, expire: int | float | str | None = None, *, value_unit: str | None = None, value_label: str | None = None, value_icon: str | None = None, about: str | None = None, about_label: str | None = None, about_icon: str | None = None, level: Literal['failure', 'information', 'success', 'warning'] | None = None, tags: list[str] | None = None, statics: dict[str, Any] | None = None) None[source]#

Insert the value within the persistent key value store.

record(unique: str) HomiePersistRecord[source]#

Return the record within the persistent key value store.

Parameters:

unique – Unique identifier from within the table.

Returns:

Record within the persistent key value store.

records() list[HomiePersistRecord][source]#

Return all records within the persistent key value store.

Returns:

Records within the persistent key value store.

select(unique: str) int | float | bool | str | None[source]#

Return the value from within persistent key value store.

Parameters:

unique – Unique identifier from within the table.

Returns:

Value from within persistent key value store.

class enhomie.homie.addons.HomiePersistRecord(record: HomiePersistTable | None = None, *, unique: Annotated[str, MinLen(min_length=1)], value: int | float | bool | str | None, value_unit: Annotated[str | None, MinLen(min_length=1)] = None, value_label: Annotated[str | None, MinLen(min_length=1)] = None, value_icon: Annotated[str | None, MinLen(min_length=1)] = None, about: Annotated[str | None, MinLen(min_length=1)] = None, about_label: Annotated[str | None, MinLen(min_length=1)] = None, about_icon: Annotated[str | None, MinLen(min_length=1)] = None, level: Annotated[Literal['failure', 'information', 'success', 'warning'] | None, MinLen(min_length=1)] = None, tags: Annotated[list[str] | None, MinLen(min_length=1)] = None, expire: Annotated[str | None, MinLen(min_length=20), MaxLen(max_length=32)] = None, update: Annotated[str, MinLen(min_length=20), MaxLen(max_length=32)])[source]#

Bases: BaseModel

Contain the information regarding the persistent value.

Parameters:
  • record – Record from the SQLAlchemy query routine.

  • kwargs – Keyword arguments passed for downstream.

about: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='About the persist entry', metadata=[MinLen(min_length=1)])]#
about_icon: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Icon for persist entry', metadata=[MinLen(min_length=1)])]#
about_label: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Label for persist entry', metadata=[MinLen(min_length=1)])]#
expire: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='After when the key expires', metadata=[MinLen(min_length=20), MaxLen(max_length=32)])]#
level: Annotated[Literal['failure', 'information', 'success', 'warning'] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Severity of persist entry', metadata=[MinLen(min_length=1)])]#
model_config = {'extra': 'forbid'}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tags: Annotated[list[str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Tags for persist entry', metadata=[MinLen(min_length=1)])]#
unique: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Unique key for the value', metadata=[MinLen(min_length=1)])]#
update: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='When the value was updated', metadata=[MinLen(min_length=20), MaxLen(max_length=32)])]#
value: Annotated[int | float | bool | str | None, FieldInfo(annotation=NoneType, required=True, description='Value stored at unique')]#
value_icon: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Icon for persist value', metadata=[MinLen(min_length=1)])]#
value_label: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Label for persist value', metadata=[MinLen(min_length=1)])]#
value_unit: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Unit for persist value', metadata=[MinLen(min_length=1)])]#
class enhomie.homie.addons.HomieQueue(homie: Homie, size: int = 10000)[source]#

Bases: Generic[HomieQueueItemType]

Queue object that will allow to handle full conditions.

Parameters:
  • homie – Primary class instance for Homie Automate.

  • size – Maximum size for the created queue object.

property empty: bool#

Return the boolean indicating whether the queue is full.

Returns:

Boolean indicating whether the queue is full.

get() HomieQueueItemType[source]#

Return the next item within the queue in blocking mode.

Returns:

Next item within the queue in blocking mode.

put(item: HomieQueueItemType) None[source]#

Store the provided item within the queue class instance.

Parameters:

item – Item containing information for operation.

property qsize: int#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

class enhomie.homie.addons.HomieQueueItem[source]#

Bases: object

Contain information for sharing using the Python queue.

time: Time#