Skip to content

Commit

Permalink
Fix for old configuration with sendDataOnlyOnChange
Browse files Browse the repository at this point in the history
  • Loading branch information
imbeacon committed Sep 19, 2024
1 parent a86571d commit cbbe8af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions thingsboard_gateway/connectors/modbus/slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ def __get_report_strategy_from_config(self, config: dict, default_report_strateg
report_strategy_config = default_report_strategy_config
if not config:
return report_strategy_config
if config.get(SEND_DATA_ONLY_ON_CHANGE_PARAMETER) is not None:
if config.get(SEND_DATA_ONLY_ON_CHANGE_PARAMETER) is not None and not (config.get(REPORT_STRATEGY_PARAMETER)):
report_strategy_config = {
'type': ReportStrategy.ON_CHANGE if config.get(SEND_DATA_ONLY_ON_CHANGE_PARAMETER) else ReportStrategy.ON_REPORT_PERIOD,
REPORT_PERIOD_PARAMETER: config.get(REPORT_PERIOD_PARAMETER, report_strategy_config.get(REPORT_PERIOD_PARAMETER, self.poll_period))
}
if config.get(REPORT_STRATEGY_PARAMETER) is not None:
elif config.get(REPORT_STRATEGY_PARAMETER) is not None:
try:
report_strategy_config = {
'type': ReportStrategy[config[REPORT_STRATEGY_PARAMETER].get('type', ReportStrategy.ON_REPORT_PERIOD.name).upper()],
Expand Down

0 comments on commit cbbe8af

Please sign in to comment.