Automation module
The Automation module provides the main interface to the OpenWebNet automation system. This allows controlling shutter, blinds, and other similar devices.
pyown.items.automation.WhatAutomation
¶
flowchart TD
pyown.items.automation.WhatAutomation[WhatAutomation]
pyown.tags.what.What[What]
pyown.tags.base.TagWithParameters[TagWithParameters]
pyown.tags.base.Tag[Tag]
pyown.tags.what.What --> pyown.items.automation.WhatAutomation
pyown.tags.base.TagWithParameters --> pyown.tags.what.What
pyown.tags.base.Tag --> pyown.tags.base.TagWithParameters
click pyown.items.automation.WhatAutomation href "" "pyown.items.automation.WhatAutomation"
click pyown.tags.what.What href "" "pyown.tags.what.What"
click pyown.tags.base.TagWithParameters href "" "pyown.tags.base.TagWithParameters"
click pyown.tags.base.Tag href "" "pyown.tags.base.Tag"
This enum contains the possible commands and states for an automation.
Attributes:
| Name | Type | Description |
|---|---|---|
STOP |
The command to stop the automation. |
|
UP |
The command to go up. |
|
DOWN |
The command to go down. |
pyown.items.automation.AutomationEvents
¶
Bases: Enum
flowchart TD
pyown.items.automation.AutomationEvents[AutomationEvents]
click pyown.items.automation.AutomationEvents href "" "pyown.items.automation.AutomationEvents"
This enum is used internally to register the callbacks to the correct event.
Attributes:
| Name | Type | Description |
|---|---|---|
STOP |
The event for when the automation stops. |
|
UP |
The event for when the automation goes up. |
|
DOWN |
The event for when the automation goes down. |
|
ALL |
The event for all events. |
pyown.items.automation.Automation
¶
Automation(
client: BaseClient,
where: Where | str,
*,
who: Who | str | None = None,
)
Bases: BaseItem
flowchart TD
pyown.items.automation.Automation[Automation]
pyown.items.base.BaseItem[BaseItem]
pyown.items.base.BaseItem --> pyown.items.automation.Automation
click pyown.items.automation.Automation href "" "pyown.items.automation.Automation"
click pyown.items.base.BaseItem href "" "pyown.items.base.BaseItem"
Automation items are usually used to control blinds, shutters, etc...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
BaseClient
|
The client to use to communicate with the server. |
required |
where
|
Where | str
|
The location of the item. |
required |
who
|
Who | str | None
|
The type of item. |
None
|
client
property
writable
¶
client: BaseClient
Returns the client used to communicate with the server.
create_normal_message
¶
create_normal_message(what: What | str) -> NormalMessage
Creates a normal message for the item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
what
|
What | str
|
The action to perform. |
required |
Returns:
| Type | Description |
|---|---|
NormalMessage
|
A normal message. |
create_status_message
¶
create_status_message() -> StatusRequest
create_dimension_writing_message
¶
create_dimension_writing_message(
dimension: Dimension, *args: Value
) -> DimensionWriting
create_dimension_request_message
¶
create_dimension_request_message(
dimension: Dimension,
) -> DimensionRequest
Creates a dimension request message for the item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dimension
|
Dimension
|
the dimension value to request. |
required |
send_normal_message
async
¶
Sends a normal message to the server and check the response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
what
|
What | str
|
The action to perform. |
required |
Raises:
| Type | Description |
|---|---|
ResponseError
|
If the server does not acknowledge the message. |
send_status_request
async
¶
send_status_request() -> AsyncIterator[NormalMessage]
Sends a status request and receive multiple responses from the server.
Raises:
| Type | Description |
|---|---|
ResponseError
|
If the server responds with an invalid message. |
Returns:
| Type | Description |
|---|---|
AsyncIterator[NormalMessage]
|
The responses from the server. |
send_dimension_request
async
¶
send_dimension_request(
dimension: Dimension | str,
) -> AsyncIterator[DimensionResponse]
Sends a dimension request and receive multiple responses from the server.
Raises:
| Type | Description |
|---|---|
ResponseError
|
If the server responds with an invalid message. |
Returns:
| Type | Description |
|---|---|
AsyncIterator[DimensionResponse]
|
The responses from the server. |
send_dimension_writing
async
¶
Sends a dimension writing message to the server and check the response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dimension
|
Dimension | str
|
the dimension value to set. |
required |
*args
|
Value
|
the values to set. |
()
|
Raises:
| Type | Description |
|---|---|
ResponseError
|
If the server does not acknowledge the message. |
get_status
async
¶
get_status() -> AsyncIterator[tuple[Where, WhatAutomation]]
Requests the status of the automation.
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the automation is not a light point. |
Returns:
| Name | Type | Description |
|---|---|---|
WhatAutomation |
AsyncIterator[tuple[Where, WhatAutomation]]
|
The status of the automation. |
on_status_change
classmethod
¶
on_status_change(
callback: Callable[
[Self, WhatAutomation], Coroutine[None, None, None]
],
)
Registers a callback to be called when the status of the automation changes.
If the shutter is already down and a command is sent to go down, the gateway will sometimes return the stop event and before the down event. So, make sure to handle this case in your code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
callback
|
Callable[[Self, WhatAutomation], Coroutine[None, None, None]]
|
The callback to call. It will receive as arguments the item and the status. |
required |
call_callbacks
async
classmethod
¶
call_callbacks(
item: BaseItem, message: BaseMessage
) -> list[Task]
Dispatches the message to the registered automation callbacks.