Energy Management
The Energy Management module provides the main interface to the OpenWebNet energy management system.
pyown.items.energy.energy.WhatEnergy
¶
What tags for energy management items. It is used only internally to send the correct command to the gateway.
Attributes:
Name | Type | Description |
---|---|---|
AUTO_RESET_ON |
Activate the auto reset. |
|
AUTO_RESET_OFF |
Deactivate the auto reset. |
|
SEND_DAILY_REPORT |
Send the power consumption for the day for each hour. |
|
SEND_MONTHLY_REPORT |
Send the hourly average power consumption for the month. |
|
SEND_YEARLY_REPORT |
Send the daily average power consumption for the year. |
|
SEND_LAST_YEAR_REPORT |
Send the daily average power consumption for the last year. |
|
ENABLE_ACTUATOR |
Command to enable the actuator. |
|
FORCE_ACTUATOR_ON |
Command to force the actuator on for a specific time. |
|
FORCE_ACTUATOR_OFF |
End the forced actuator. |
|
RESET_REPORT |
Command to reset the measurements. |
options: show_inheritance_diagram: true
pyown.items.energy.energy.DimensionEnergy
¶
Dimension tags for energy management items. It is used only internally to send the correct command and parse the event messages.
Attributes:
Name | Type | Description |
---|---|---|
ACTIVE_POWER |
Active Power |
|
END_AUTOMATIC_UPDATE_SIZE |
End Automatic Update size |
|
ENERGY_UNIT_TOTALIZER |
Energy/Unit Totalizer |
|
ENERGY_UNIT_PER_MONTH |
Energy/Unit per month |
|
PARTIAL_TOTALIZER_CURRENT_MONTH |
Partial totalizer for current month |
|
PARTIAL_TOTALIZER_CURRENT_DAY |
Partial totalizer for current day |
|
ACTUATORS_INFO |
Actuators info |
|
TOTALIZERS |
Totalizers |
|
DIFFERENTIAL_CURRENT_LEVEL |
Differential current level |
|
STATUS_STOP_GO_GENERAL |
Status Stop&Go (General) |
|
STATUS_STOP_GO_OPEN_CLOSE |
Status Stop&Go (open/close) |
|
STATUS_STOP_GO_FAILURE_NO_FAILURE |
Status Stop&Go (failure/no failure) |
|
STATUS_STOP_GO_BLOCK_NOT_BLOCK |
Status Stop&Go (block/not block) |
|
STATUS_STOP_GO_OPEN_CC_BETWEEN_N |
Status Stop&Go (open for CC between the N/not open for CC between the N) |
|
STATUS_STOP_GO_OPENED_GROUND_FAULT |
Status Stop&Go (opened ground fault/not opened ground fault) |
|
STATUS_STOP_GO_OPEN_VMAX |
Status Stop&Go (open for Vmax/Not open for Vmax) |
|
STATUS_STOP_GO_SELF_TEST_DISABLED |
Status Stop&Go (Self-test disabled/close) |
|
STATUS_STOP_GO_AUTOMATIC_RESET_OFF |
Status Stop&Go (Automatic reset off/close) |
|
STATUS_STOP_GO_CHECK_OFF |
Status Stop&Go (check off/close) |
|
STATUS_STOP_GO_WAITING_FOR_CLOSING |
Status Stop&Go (Waiting for closing/close) |
|
STATUS_STOP_GO_FIRST_24H_OPENING |
Status Stop&Go (First 24 hours of opening/close) |
|
STATUS_STOP_GO_POWER_FAILURE_DOWNSTREAM |
Status Stop&Go (Power failure downstream/close) |
|
STATUS_STOP_GO_POWER_FAILURE_UPSTREAM |
Status Stop&Go (Power failure upstream/close) |
|
DAILY_TOTALIZERS_HOURLY_16BIT |
Daily totalizers on an hourly basis for 16-bit Daily graphics |
|
MONTHLY_AVERAGE_HOURLY_16BIT |
Monthly average on an hourly basis for 16-bit Media Daily graphics |
|
MONTHLY_TOTALIZERS_CURRENT_YEAR_32BIT |
Monthly totalizers current year on a daily basis for 32-bit Monthly graphics |
|
MONTHLY_TOTALIZERS_LAST_YEAR_32BIT |
Monthly totalizers on a daily basis last year compared to 32-bit graphics TouchX Previous Year |
options: show_inheritance_diagram: true
pyown.items.energy.energy.TypeEnergy
¶
Bases: Enum
Type of energy management items.
Attributes:
Name | Type | Description |
---|---|---|
POWER_METER |
Power meter. |
|
ACTUATOR |
Actuator. |
|
STOP_GO |
Stop&Go device. |
pyown.items.energy.energy.EnergyManagement
¶
EnergyManagement(
client: BaseClient,
where: Where | str,
*,
who: Who | str | None = None
)
Bases: BaseItem
Used to control energy management items, like actuators with current sensors, etc...
Allowed where tags: - 1N (N=[1-127]): Stop&Go devices, these are circuit breakers capable of detecting a fault and opening the circuit. - 5N (N=[1-255]): Power meters, these are devices that measure the power consumption. - 7N#0 (N=[1-255]): Actuators, these implement the same functionalities as power meters but can also control the power flow.
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
|
Raises:
Type | Description |
---|---|
InvalidTag
|
If the where tag is not valid. |
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. Args: what: The action to perform. Returns: A normal message.
create_status_message
¶
create_status_message() -> StatusRequest
create_dimension_writing_message
¶
create_dimension_writing_message(
dimension: Dimension, *args: Value
) -> DimensionWriting
Creates a dimension message for the item. Args: dimension: the dimension value to set. *args: the values to set.
Returns:
create_dimension_request_message
¶
create_dimension_request_message(
dimension: Dimension,
) -> DimensionRequest
Creates a dimension request message for the item. Args: dimension: the dimension value to request.
Returns:
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_type
¶
get_type() -> TypeEnergy
The type of the item.
Returns:
Type | Description |
---|---|
TypeEnergy
|
The type of the item. |
Raises:
Type | Description |
---|---|
InvalidTag
|
If the where tag is not valid. |
start_sending_daily_totalizers_hourly
async
¶
Start sending daily totalizers on an hourly basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_monthly_average_hourly
async
¶
start_sending_monthly_average_hourly(month: int | None)
Start sending monthly average on an hourly basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_monthly_totalizers_current_year
async
¶
start_sending_monthly_totalizers_current_year(
month: int | None,
)
Start sending monthly totalizers current year on a daily basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_monthly_totalizers_last_year
async
¶
start_sending_monthly_totalizers_last_year(
month: int | None,
)
Start sending monthly totalizers last year on a daily basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
enable_actuator
async
¶
enable_actuator()
Enable the actuator.
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
force_actuator_on
async
¶
force_actuator_on(time: int | None = None)
Force the actuator on for a specific time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
int | None
|
The time in tens of minutes [1-254]. Use default time if None. |
None
|
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
force_actuator_off
async
¶
force_actuator_off()
End the forced actuator.
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
reset_totalizers
async
¶
reset_totalizers(tot_n: int)
Reset the totalizers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tot_n
|
int
|
The totalizer number to reset [1-2] |
required |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_instant_power
async
¶
Start sending the instant power consumption on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
int
|
Indicates after how many minutes it sends the consumption if it changes [1-255] |
required |
power_type
|
int
|
1 for active power |
1
|
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
stop_sending_instant_power
async
¶
stop_sending_instant_power(power_type: int = 1)
Stop sending the instant power consumption on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
power_type
|
int
|
1 for active power |
1
|
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
get_active_power
async
¶
get_active_power() -> float
Get the active power.
Returns:
Type | Description |
---|---|
float
|
The active power in W. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_energy_unit_totalizer
async
¶
get_energy_unit_totalizer() -> float
Get the energy/unit totalizer.
Returns:
Type | Description |
---|---|
float
|
The energy/unit totalizer in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_energy_unit_per_month
async
¶
Get the energy/unit per month.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
month
|
int | None
|
The month to get the energy from [1-12]. Use the current month if None. |
None
|
year
|
int | None
|
The year to get the energy from. Format: YY (e.g., 21). Use the current year if None. |
None
|
Returns:
Type | Description |
---|---|
float
|
The energy measured in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_partial_totalizer_current_month
async
¶
get_partial_totalizer_current_month() -> float
Get the partial totalizer for the current month. This is equivalent to get_energy_unit_per_month() without any args.
Returns:
Type | Description |
---|---|
float
|
The partial totalizer for the current month in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_partial_totalizer_current_day
async
¶
get_partial_totalizer_current_day() -> float
Get the partial totalizer for the current day.
Returns:
Type | Description |
---|---|
float
|
The partial totalizer for the current day in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_actuators_info
async
¶
get_actuators_info(
*, message: EventMessage = None
) -> ActuatorStatus
Get the actuator info.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
EventMessage
|
The message to parse the status from. It's used internally to avoid code duplication. |
None
|
Returns:
Type | Description |
---|---|
ActuatorStatus
|
The status of the actuator. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_totalizers
async
¶
get_totalizers(
tot_n: int, *, message: EventMessage = None
) -> tuple[datetime, float]
Get the energy measured from the last reset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tot_n
|
int
|
The totalizer number to get [1-2] |
required |
message
|
EventMessage
|
The message to parse the status from. It's used internally to avoid code duplication. |
None
|
Returns:
Type | Description |
---|---|
tuple[datetime, float]
|
A tuple containing the date and time of the last reset and the energy measured in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
on_daily_totalizers_hourly
classmethod
¶
on_daily_totalizers_hourly(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the daily totalizers on an hourly basis event.
Note
To start receiving the event, use the start_sending_daily_totalizers_hourly() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the day, the month, the hour, and the energy measured in Wh. If the hour is 25, it means that the energy is the total for the day. |
required |
on_monthly_average_hourly
classmethod
¶
on_monthly_average_hourly(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the monthly average on an hourly basis event.
Note
To start receiving the event, use the start_sending_monthly_average_hourly() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the hour, and the energy measured in Wh. |
required |
on_monthly_totalizers_current_year
classmethod
¶
on_monthly_totalizers_current_year(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the monthly totalizers current year on a daily basis event.
Note
To start receiving the event, use the start_sending_monthly_totalizers_current_year() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the day, and the energy measured in Wh. |
required |
on_monthly_totalizers_last_year
classmethod
¶
on_monthly_totalizers_last_year(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the monthly totalizers last year on a daily basis event.
Note
To start receiving the event, use the start_sending_monthly_totalizers_last_year() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the day, and the energy measured in Wh. |
required |
on_stop_go_status
classmethod
¶
on_stop_go_status(
callback: Callable[
[Self, StopGoStatus], Coroutine[None, None, None]
]
)
Register a callback for the stop&go status change event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, StopGoStatus], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item and the status of the stop&go device. |
required |
on_instant_power
classmethod
¶
on_energy_unit_totalizer
classmethod
¶
on_energy_unit_per_month
classmethod
¶
on_energy_unit_per_month(
callback: Callable[
[Self, int, int, float], Coroutine[None, None, None]
]
)
Register a callback for the energy/unit per month event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, float], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the year, and the energy measured in Wh. |
required |
on_partial_totalizer_current_month
classmethod
¶
on_partial_totalizer_current_day
classmethod
¶
on_actuators_info
classmethod
¶
on_totalizer_since_reset
classmethod
¶
on_totalizer_since_reset(
callback: Callable[
[Self, int, datetime, float],
Coroutine[None, None, None],
]
)
Register a callback for the totalizer since reset event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, datetime, float], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the totalizer number, the date and time of the last reset, and the energy measured in Wh. |
required |
on_differential_current_level
classmethod
¶
call_callbacks
async
classmethod
¶
call_callbacks(
item: Self, message: BaseMessage
) -> list[Task]
Calls the registered callbacks for the event. Used internally by the client to dispatch the events to the correct callbacks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
BaseItem
|
The item that triggered the event. |
required |
message
|
BaseMessage
|
The message that triggered the event. |
required |
Returns:
Type | Description |
---|---|
list[Task]
|
list[Task]: A list of tasks scheduled to run the callbacks. |
options: show_inheritance_diagram: true
pyown.items.energy.stop_go.StopGoStatus
dataclass
¶
StopGoStatus(
open: bool | None = None,
failure: bool | None = None,
block: bool | None = None,
open_cc: bool | None = None,
open_ground_fault: bool | None = None,
open_vmax: bool | None = None,
self_test_off: bool | None = None,
auto_reset_off: bool | None = None,
check_off: bool | None = None,
waiting_closing: bool | None = None,
first_24h_open: bool | None = None,
power_fail_down: bool | None = None,
power_fail_up: bool | None = None,
)
Status of a Stop&Go device.
Attributes:
Name | Type | Description |
---|---|---|
open |
bool | None
|
set if the circuit is open |
failure |
bool | None
|
set if a failure is detected |
block |
bool | None
|
set if the circuit is blocked |
open_cc |
bool | None
|
set if the circuit is open due to a current overload |
open_ground_fault |
bool | None
|
set if the circuit is open due to a ground fault |
open_vmax |
bool | None
|
set if the circuit is open due to a voltage overload |
auto_reset_off |
bool | None
|
set if the automatic reset is disabled |
check_off |
bool | None
|
set if the check is disabled |
waiting_closing |
bool | None
|
set if the circuit is waiting to be closed |
first_24h_open |
bool | None
|
set if the circuit was open for the first 24 hours |
power_fail_down |
bool | None
|
set if the circuit is open due to a power failure downstream |
power_fail_up |
bool | None
|
set if the circuit is open due to a power failure upstream |
pyown.items.energy.stop_go.StopGo
¶
StopGo(
client: BaseClient,
where: Where | str,
*,
who: Who | str | None = None
)
Bases: EnergyManagement
Used to manage the Stop&Go items.
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
|
Raises:
Type | Description |
---|---|
InvalidTag
|
If the where tag is not valid. |
client
property
writable
¶
client: BaseClient
Returns the client used to communicate with the server.
call_callbacks
async
classmethod
¶
call_callbacks(
item: Self, message: BaseMessage
) -> list[Task]
Calls the registered callbacks for the event. Used internally by the client to dispatch the events to the correct callbacks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item
|
BaseItem
|
The item that triggered the event. |
required |
message
|
BaseMessage
|
The message that triggered the event. |
required |
Returns:
Type | Description |
---|---|
list[Task]
|
list[Task]: A list of tasks scheduled to run the callbacks. |
create_normal_message
¶
create_normal_message(what: What | str) -> NormalMessage
Creates a normal message for the item. Args: what: The action to perform. Returns: A normal message.
create_status_message
¶
create_status_message() -> StatusRequest
create_dimension_writing_message
¶
create_dimension_writing_message(
dimension: Dimension, *args: Value
) -> DimensionWriting
Creates a dimension message for the item. Args: dimension: the dimension value to set. *args: the values to set.
Returns:
create_dimension_request_message
¶
create_dimension_request_message(
dimension: Dimension,
) -> DimensionRequest
Creates a dimension request message for the item. Args: dimension: the dimension value to request.
Returns:
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_type
¶
get_type() -> TypeEnergy
The type of the item.
Returns:
Type | Description |
---|---|
TypeEnergy
|
The type of the item. |
Raises:
Type | Description |
---|---|
InvalidTag
|
If the where tag is not valid. |
start_sending_daily_totalizers_hourly
async
¶
Start sending daily totalizers on an hourly basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_monthly_average_hourly
async
¶
start_sending_monthly_average_hourly(month: int | None)
Start sending monthly average on an hourly basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_monthly_totalizers_current_year
async
¶
start_sending_monthly_totalizers_current_year(
month: int | None,
)
Start sending monthly totalizers current year on a daily basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_monthly_totalizers_last_year
async
¶
start_sending_monthly_totalizers_last_year(
month: int | None,
)
Start sending monthly totalizers last year on a daily basis on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Args:
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
enable_actuator
async
¶
enable_actuator()
Enable the actuator.
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
force_actuator_on
async
¶
force_actuator_on(time: int | None = None)
Force the actuator on for a specific time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
int | None
|
The time in tens of minutes [1-254]. Use default time if None. |
None
|
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
force_actuator_off
async
¶
force_actuator_off()
End the forced actuator.
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
reset_totalizers
async
¶
reset_totalizers(tot_n: int)
Reset the totalizers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tot_n
|
int
|
The totalizer number to reset [1-2] |
required |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
start_sending_instant_power
async
¶
Start sending the instant power consumption on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
int
|
Indicates after how many minutes it sends the consumption if it changes [1-255] |
required |
power_type
|
int
|
1 for active power |
1
|
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
stop_sending_instant_power
async
¶
stop_sending_instant_power(power_type: int = 1)
Stop sending the instant power consumption on an event session.
Note
Even if the data is sent to the event session, this command must be sent on a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
power_type
|
int
|
1 for active power |
1
|
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not acknowledge the command |
get_active_power
async
¶
get_active_power() -> float
Get the active power.
Returns:
Type | Description |
---|---|
float
|
The active power in W. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_energy_unit_totalizer
async
¶
get_energy_unit_totalizer() -> float
Get the energy/unit totalizer.
Returns:
Type | Description |
---|---|
float
|
The energy/unit totalizer in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_energy_unit_per_month
async
¶
Get the energy/unit per month.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
month
|
int | None
|
The month to get the energy from [1-12]. Use the current month if None. |
None
|
year
|
int | None
|
The year to get the energy from. Format: YY (e.g., 21). Use the current year if None. |
None
|
Returns:
Type | Description |
---|---|
float
|
The energy measured in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_partial_totalizer_current_month
async
¶
get_partial_totalizer_current_month() -> float
Get the partial totalizer for the current month. This is equivalent to get_energy_unit_per_month() without any args.
Returns:
Type | Description |
---|---|
float
|
The partial totalizer for the current month in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_partial_totalizer_current_day
async
¶
get_partial_totalizer_current_day() -> float
Get the partial totalizer for the current day.
Returns:
Type | Description |
---|---|
float
|
The partial totalizer for the current day in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_actuators_info
async
¶
get_actuators_info(
*, message: EventMessage = None
) -> ActuatorStatus
Get the actuator info.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message
|
EventMessage
|
The message to parse the status from. It's used internally to avoid code duplication. |
None
|
Returns:
Type | Description |
---|---|
ActuatorStatus
|
The status of the actuator. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
get_totalizers
async
¶
get_totalizers(
tot_n: int, *, message: EventMessage = None
) -> tuple[datetime, float]
Get the energy measured from the last reset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tot_n
|
int
|
The totalizer number to get [1-2] |
required |
message
|
EventMessage
|
The message to parse the status from. It's used internally to avoid code duplication. |
None
|
Returns:
Type | Description |
---|---|
tuple[datetime, float]
|
A tuple containing the date and time of the last reset and the energy measured in kWh. |
Raises:
Type | Description |
---|---|
ResponseError
|
When the gateway does not respond with the requested data |
on_daily_totalizers_hourly
classmethod
¶
on_daily_totalizers_hourly(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the daily totalizers on an hourly basis event.
Note
To start receiving the event, use the start_sending_daily_totalizers_hourly() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the day, the month, the hour, and the energy measured in Wh. If the hour is 25, it means that the energy is the total for the day. |
required |
on_monthly_average_hourly
classmethod
¶
on_monthly_average_hourly(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the monthly average on an hourly basis event.
Note
To start receiving the event, use the start_sending_monthly_average_hourly() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the hour, and the energy measured in Wh. |
required |
on_monthly_totalizers_current_year
classmethod
¶
on_monthly_totalizers_current_year(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the monthly totalizers current year on a daily basis event.
Note
To start receiving the event, use the start_sending_monthly_totalizers_current_year() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the day, and the energy measured in Wh. |
required |
on_monthly_totalizers_last_year
classmethod
¶
on_monthly_totalizers_last_year(
callback: Callable[
[Self, int, int, int, int],
Coroutine[None, None, None],
]
)
Register a callback for the monthly totalizers last year on a daily basis event.
Note
To start receiving the event, use the start_sending_monthly_totalizers_last_year() with a command session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, int, int], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the day, and the energy measured in Wh. |
required |
on_stop_go_status
classmethod
¶
on_stop_go_status(
callback: Callable[
[Self, StopGoStatus], Coroutine[None, None, None]
]
)
Register a callback for the stop&go status change event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, StopGoStatus], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item and the status of the stop&go device. |
required |
on_instant_power
classmethod
¶
on_energy_unit_totalizer
classmethod
¶
on_energy_unit_per_month
classmethod
¶
on_energy_unit_per_month(
callback: Callable[
[Self, int, int, float], Coroutine[None, None, None]
]
)
Register a callback for the energy/unit per month event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, int, float], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the month, the year, and the energy measured in Wh. |
required |
on_partial_totalizer_current_month
classmethod
¶
on_partial_totalizer_current_day
classmethod
¶
on_actuators_info
classmethod
¶
on_totalizer_since_reset
classmethod
¶
on_totalizer_since_reset(
callback: Callable[
[Self, int, datetime, float],
Coroutine[None, None, None],
]
)
Register a callback for the totalizer since reset event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[Self, int, datetime, float], Coroutine[None, None, None]]
|
The callback to call when the event is received. It will receive the item, the totalizer number, the date and time of the last reset, and the energy measured in Wh. |
required |
on_differential_current_level
classmethod
¶
enable_automatic_reset
async
¶
enable_automatic_reset() -> None
Enable the automatic reset of the Stop&Go device.
disable_automatic_reset
async
¶
disable_automatic_reset() -> None
Disable the automatic reset of the Stop&Go device.
request_status
async
¶
request_status(
*,
messages: (
AsyncIterator[DimensionResponse] | None
) = None,
dim_req: DimensionEnergy = STATUS_STOP_GO_GENERAL
) -> StopGoStatus
Request the status of the Stop&Go device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
messages
|
AsyncIterator[DimensionResponse] | None
|
The messages to parse the status from. It's used internally to avoid code duplication. |
None
|
dim_req
|
DimensionEnergy
|
The dimension to request the status from. It's used internally to avoid code duplication. |
STATUS_STOP_GO_GENERAL
|
Returns:
Type | Description |
---|---|
StopGoStatus
|
The status of the Stop&Go device. |
Raises:
Type | Description |
---|---|
InvalidMessage
|
If the response is invalid. |
options: show_inheritance_diagram: true