Repository navigation
fix: consumer Lambda - #4269
fix: consumer Lambda#4269
Conversation
…ative (PV surplus) values
…_limit sign with send_values
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe Lambda consumer now sends register 102 values as signed 16-bit Modbus data and applies the required negative sign when writing calculated surplus limits, matching the documented E-Manager configuration and preventing incorrect power interpretation. Sequence diagram for Lambda consumer Modbus updatessequenceDiagram
participant Core
participant LambdaConsumer
participant EManager
Core->>LambdaConsumer: send_values(values)
LambdaConsumer->>EManager: write_register(102, values.evu_power, data_type=INT_16, wordorder=Little)
Core->>LambdaConsumer: set_power_limit(power_limit, data)
LambdaConsumer->>EManager: write_register(102, -max(power_limit, 0), data_type=INT_16, wordorder=Little)
EManager-->>LambdaConsumer: Interpret register 102 as Neg. E-Überschuss
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="packages/modules/consumers/lambda_/lambda_/consumer.py" line_range="32" />
<code_context>
# das kann openWB nicht per Modbus setzen. Wird vom Core automatisch aufgerufen,
# solange dieser Verbraucher als ConsumerUsage.SELF_CONTROLLED konfiguriert ist.
- client.write_register(102, values.evu_power, wordorder=Endian.Little, unit=config.configuration.modbus_id)
+ client.write_register(102, values.evu_power, data_type=ModbusDataType.INT_16,
+ wordorder=Endian.Little, unit=config.configuration.modbus_id)
</code_context>
<issue_to_address>
**Signed power writes fail**
When the EVU value is negative, a positive power limit is negated, or a float power value reaches the write, `ModbusClient.write_register` passes 16-bit values directly to pymodbus instead of encoding them as signed register words, so negative EVU values and negated limits are rejected; float values also reach pymodbus without integer conversion. The register write fails, and the Lambda does not receive the EVU or power-limit update.
Encode signed 16-bit values into valid register words, and convert float power inputs to integers, before calling pymodbus.
Also at `packages/modules/consumers/lambda_/lambda_/consumer.py:47-48`.
</issue_to_address>| # das kann openWB nicht per Modbus setzen. Wird vom Core automatisch aufgerufen, | ||
| # solange dieser Verbraucher als ConsumerUsage.SELF_CONTROLLED konfiguriert ist. | ||
| client.write_register(102, values.evu_power, wordorder=Endian.Little, unit=config.configuration.modbus_id) | ||
| client.write_register(102, values.evu_power, data_type=ModbusDataType.INT_16, |
There was a problem hiding this comment.
🟠 High · Signed power writes fail
When the EVU value is negative, a positive power limit is negated, or a float power value reaches the write, ModbusClient.write_register passes 16-bit values directly to pymodbus instead of encoding them as signed register words, so negative EVU values and negated limits are rejected; float values also reach pymodbus without integer conversion. The register write fails, and the Lambda does not receive the EVU or power-limit update.
Encode signed 16-bit values into valid register words, and convert float power inputs to integers, before calling pymodbus.
Also at packages/modules/consumers/lambda_/lambda_/consumer.py:47-48.
Prompt for AI agents
In `packages/modules/consumers/lambda_/lambda_/consumer.py` at line 32:
**Signed power writes fail**
When the EVU value is negative, a positive power limit is negated, or a float power value reaches the write, `ModbusClient.write_register` passes 16-bit values directly to pymodbus instead of encoding them as signed register words, so negative EVU values and negated limits are rejected; float values also reach pymodbus without integer conversion. The register write fails, and the Lambda does not receive the EVU or power-limit update.
Encode signed 16-bit values into valid register words, and convert float power inputs to integers, before calling pymodbus.
Also at `packages/modules/consumers/lambda_/lambda_/consumer.py:47-48`.|
THX Seaspotter |
UI: openWB/openwb-ui-settings#1162
#4226 (comment)
#4264
Fixt den Fehler und gibt im UI eindeutig vor welche Einstellung an der Lambda WP im E-Manager eingestellt werden muss, damit openWB die korrekten Werte sendet.
Will close: #4269
Summary by Sourcery
Fix Lambda consumer power exchange so openWB sends correctly signed values for the required E-Manager surplus configuration.
Bug Fixes:
Enhancements: