Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/flexmeasures_client/s2/cem.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import asyncio
import json
import logging
import math
Expand Down Expand Up @@ -233,13 +232,7 @@ async def get_message(self) -> str:
"""

message = await self._sending_queue.get()
await asyncio.sleep(0.3)

# Pending for pydantic V2 to implement model.model_dump(mode="json") in
# PR #1409 (https://github.com/pydantic/pydantic/issues/1409)
message = json.loads(message.json())

return message
return message.model_dump(mode="json")

async def activate_control_type(
self, control_type: ControlType
Expand Down Expand Up @@ -390,7 +383,7 @@ async def handle_power_measurement(self, message: PowerMeasurement):
values=[avg_value],
unit=get_commodity_unit(commodity_quantity),
)
except Exception as e:
except Exception as e: # noqa: B902 - intentional safety net
self._logger.warning(
f"POSTing power measurement failed with error: {e}"
)
Expand Down
Loading