|
14 | 14 | from ..connection import StickController |
15 | 15 | from ..constants import UTF8 |
16 | 16 | from ..exceptions import CacheError, MessageError, NodeError, StickError, StickTimeout |
17 | | -from ..messages.requests import CirclePlusAllowJoiningRequest, NodePingRequest |
| 17 | +from ..messages.requests import ( |
| 18 | + CirclePlusAllowJoiningRequest, |
| 19 | + CircleMeasureIntervalRequest, |
| 20 | + NodePingRequest, |
| 21 | +) |
18 | 22 | from ..messages.responses import ( |
19 | 23 | NODE_AWAKE_RESPONSE_ID, |
20 | 24 | NODE_JOIN_ID, |
@@ -537,6 +541,17 @@ async def allow_join_requests(self, state: bool) -> None: |
537 | 541 | _LOGGER.debug("Sent AllowJoiningRequest to Circle+ with state=%s", state) |
538 | 542 | self.accept_join_request = state |
539 | 543 |
|
| 544 | + async def set_measure_interval(self, consumption: int, production: int) -> None: |
| 545 | + """Set the measure intervals for both consumption and production. |
| 546 | + |
| 547 | + Default: consumption = 60, production = 0. |
| 548 | + For measuring in both directions set both to 60. |
| 549 | + """ |
| 550 | + _LOGGER.debug("set_measure_interval | cons=%s, prod=%s", consumption, production) |
| 551 | + request = CircleMeasureIntervalRequest(self, consumption, production) |
| 552 | + if (response := await request.send()) is None: |
| 553 | + raise NodeError("No response for CircleMeasureIntervalRequest.") |
| 554 | + |
540 | 555 | def subscribe_to_node_events( |
541 | 556 | self, |
542 | 557 | node_event_callback: Callable[[NodeEvent, str], Coroutine[Any, Any, None]], |
|
0 commit comments