Skip to content

Commit

Permalink
DB_ADDON:
Browse files Browse the repository at this point in the history
- use item_attributes direct from item_attributes_master.py
- add handling of pause_item
- add deinit() if plugin start fails
- rework parse_item sub methods
- extend some functions to get result as sum or list
-
  • Loading branch information
sisamiwe committed Nov 13, 2024
1 parent d2b73c2 commit a185402
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions db_addon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ def _query_log_timestamp(self, func: str, item_id: int, ts_start: int, ts_end: i
'last': 'LIMIT 1 ',
}

_where = "item_id = :item_id AND time <= :ts_start " if func == "next" else "item_id = :item_id AND time BETWEEN :ts_start AND :ts_end "
_where = "item_id = :item_id AND time <= :ts_end " if func == "next" else "item_id = :item_id AND time BETWEEN :ts_start AND :ts_end "

_db_table = 'log '

Expand Down Expand Up @@ -2765,7 +2765,7 @@ def _query_log_timestamp(self, func: str, item_id: int, ts_start: int, ts_end: i
# set params
params = {'item_id': item_id, 'ts_start': ts_start, 'ts_end': ts_end}
if func == "next":
params.pop('ts_end', None)
params.pop('ts_start', None)

# assemble query
query = f"SELECT {_select[func]}FROM {_db_table}WHERE {_where}{_group_by.get(group, '')}{_order.get(func, '')}{_limit.get(func, '')}{_table_alias.get(func, '')}{_group_by.get(group2, '')}".strip()
Expand Down
1 change: 0 additions & 1 deletion db_addon/webif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def get_data_html(self, dataSet=None):
data['items'][item.property.path]['last_update'] = item.property.last_update.strftime('%d.%m.%Y %H:%M:%S')
data['items'][item.property.path]['last_change'] = item.property.last_change.strftime('%d.%m.%Y %H:%M:%S')

data['plugin_suspended'] = self.plugin.suspended
data['maintenance'] = True if self.plugin.log_level == 10 else False
data['queue_length'] = self.plugin.queue_backlog()
data['active_queue_item'] = self.plugin.active_queue_item
Expand Down

0 comments on commit a185402

Please sign in to comment.