Skip to content

Commit 92dcaa7

Browse files
authored
Merge pull request #1016 from sisamiwe/dbaddon_dev
db_addon: Bugfix
2 parents ee85891 + 06af1a4 commit 92dcaa7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

db_addon/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DatabaseAddOn(SmartPlugin):
5959
Main class of the Plugin. Does all plugin specific stuff and provides the update functions for the items
6060
"""
6161

62-
PLUGIN_VERSION = '1.2.10'
62+
PLUGIN_VERSION = '1.2.11'
6363

6464
def __init__(self, sh):
6565
"""
@@ -469,6 +469,12 @@ def get_query_parameters_from_db_addon_params() -> Union[dict, None]:
469469
# add additional params
470470
if additional_params:
471471
new_db_addon_params.update(additional_params)
472+
473+
### NEW 1.2.11 ###
474+
if 'start' in new_db_addon_params and 'end' not in new_db_addon_params:
475+
new_db_addon_params['end'] = new_db_addon_params['start']
476+
if self.debug_log.prepare:
477+
self.logger.debug(f"'end' parameter has been added")
472478

473479
return new_db_addon_params
474480

@@ -1685,12 +1691,14 @@ def _handle_zaehlerstand(self, query_params: dict) -> Union[float, int, None]:
16851691
Die Vorgehensweise ist:
16861692
- Abfrage des letzten Eintrages vor dem Beginn des Zeitraums
16871693
"""
1688-
1694+
# change db query function
1695+
query_params.update({'func': 'next'})
1696+
1697+
# log final query_params
16891698
if self.debug_log.prepare:
16901699
self.logger.debug(f"called with {query_params=}")
16911700

16921701
# get last value of timeframe
1693-
query_params.update({'func': 'next'})
16941702
last_value = self._query_item(**query_params)[0][1]
16951703

16961704
if self.debug_log.prepare:

db_addon/plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugin:
1111
# keywords: iot xyz
1212
# documentation: https://github.com/smarthomeNG/smarthome/wiki/CLI-Plugin # url of documentation (wiki) page
1313
support: https://knx-user-forum.de/forum/supportforen/smarthome-py/1848494-support-thread-databaseaddon-plugin
14-
version: 1.2.10 # Plugin version (must match the version specified in __init__.py)
14+
version: 1.2.11 # Plugin version (must match the version specified in __init__.py)
1515
sh_minversion: 1.9.3.5 # minimum shNG version to use this plugin
1616
# sh_maxversion: # maximum shNG version to use this plugin (leave empty if latest)
1717
py_minversion: '3.9' # minimum Python version to use for this plugin

0 commit comments

Comments
 (0)