Config extensions
- KNX consumption in W by template filter - pool pump: runtime in h
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from typing import List
|
||||
from util import DeviceInfo
|
||||
from util import DeviceInfo, name_to_id
|
||||
from util import extent as extend_general
|
||||
import functools
|
||||
|
||||
@@ -21,7 +21,8 @@ def extent(result_dict, input_dict):
|
||||
if k not in result_dict:
|
||||
result_dict[k] = []
|
||||
for entry in v:
|
||||
entry['platform'] = 'knx'
|
||||
if 'platform' not in entry:
|
||||
entry['platform'] = 'knx'
|
||||
result_dict[k] += v
|
||||
|
||||
|
||||
@@ -81,9 +82,18 @@ def create_power_plug(device_info: List[DeviceInfo],
|
||||
consumption = csv_contents.get(entry.csv_name + postfix_consumption, None)
|
||||
if consumption:
|
||||
result['sensor'].append({
|
||||
'name': entry.display_name + " Verbrauch",
|
||||
'name': entry.display_name + " Verbrauch mA",
|
||||
'address': consumption,
|
||||
'type': 'current',
|
||||
'type': 'DPT-9',
|
||||
})
|
||||
name = name_to_id(entry.display_name + " Verbrauch mA", 'sensor')
|
||||
result['sensor'].append({
|
||||
'platform': 'template',
|
||||
'sensors': {
|
||||
name_to_id(entry.display_name + " Verbrauch", None):
|
||||
{'friendly_name': entry.display_name + " Verbrauch",
|
||||
'unit_of_measurement': 'W',
|
||||
'value_template': f"{{{{ (states('{name}') | float / 1000 * 230) | round(1) }}}}"}}
|
||||
})
|
||||
consumption_sum = csv_contents.get(entry.csv_name + postfix_consumption_sum, None)
|
||||
if consumption_sum:
|
||||
@@ -152,6 +162,8 @@ def create_switches(device_info: List[DeviceInfo], csv_contents,
|
||||
}
|
||||
if on_off_read_addr:
|
||||
entry['state_address'] = on_off_read_addr
|
||||
else:
|
||||
entry['state_address'] = on_off_write_addr
|
||||
result.append(entry)
|
||||
except KeyError as e:
|
||||
raise ValueError(f"Skipping switch {entry.csv_name} - Could not find CSV File entry: {e}")
|
||||
|
||||
Reference in New Issue
Block a user