Fix in config creation
This commit is contained in:
parent
a01222e001
commit
23d55ddf7a
|
@ -9,7 +9,7 @@ yaml = YAML()
|
||||||
yaml.preserve_quotes = True
|
yaml.preserve_quotes = True
|
||||||
|
|
||||||
|
|
||||||
sensors_to_ignore_in_logbook = [
|
sensor_exclude_list = [
|
||||||
'sensor.fritz_box_7490_bytes_received',
|
'sensor.fritz_box_7490_bytes_received',
|
||||||
'sensor.fritz_box_7490_bytes_sent',
|
'sensor.fritz_box_7490_bytes_sent',
|
||||||
#'sensor.fritz_box_7490_kbyte_sec_received',
|
#'sensor.fritz_box_7490_kbyte_sec_received',
|
||||||
|
@ -190,13 +190,15 @@ def make_sensor_exclude_list(all_devices, name_fragments):
|
||||||
exclude_list.append(name_to_id(name, 'sensor'))
|
exclude_list.append(name_to_id(name, 'sensor'))
|
||||||
|
|
||||||
for sensor_device in all_devices['sensor']:
|
for sensor_device in all_devices['sensor']:
|
||||||
|
if 'platform' in sensor_device and sensor_device['platform'] == 'time_date':
|
||||||
|
continue
|
||||||
if 'platform' in sensor_device and sensor_device['platform'] == 'template':
|
if 'platform' in sensor_device and sensor_device['platform'] == 'template':
|
||||||
for nested_sensor_dev in sensor_device['sensors'].values():
|
for nested_sensor_dev in sensor_device['sensors'].values():
|
||||||
handle_sensor(nested_sensor_dev)
|
handle_sensor(nested_sensor_dev)
|
||||||
elif 'name' in sensor_device:
|
elif 'name' in sensor_device:
|
||||||
handle_sensor(sensor_device)
|
handle_sensor(sensor_device)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError(f"Sensor {sensor_device}")
|
||||||
return exclude_list
|
return exclude_list
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,7 +206,7 @@ def logbook_config(all_devices):
|
||||||
sensor_excludes = ['Helligkeit', 'Betriebsstunden', 'Verbrauch', 'Bewegungsmelder']
|
sensor_excludes = ['Helligkeit', 'Betriebsstunden', 'Verbrauch', 'Bewegungsmelder']
|
||||||
|
|
||||||
exclude_list = []
|
exclude_list = []
|
||||||
exclude_list.extend(sensors_to_ignore_in_logbook)
|
exclude_list.extend(sensor_exclude_list)
|
||||||
exclude_list.extend(make_sensor_exclude_list(all_devices, sensor_excludes))
|
exclude_list.extend(make_sensor_exclude_list(all_devices, sensor_excludes))
|
||||||
return {
|
return {
|
||||||
'logbook': {
|
'logbook': {
|
||||||
|
@ -219,7 +221,7 @@ def logbook_config(all_devices):
|
||||||
def recorder_config(all_devices):
|
def recorder_config(all_devices):
|
||||||
recorder_excludes = ['Betriebsstunden', 'Verbrauch mA']
|
recorder_excludes = ['Betriebsstunden', 'Verbrauch mA']
|
||||||
exclude_list = ['sun.sun']
|
exclude_list = ['sun.sun']
|
||||||
exclude_list.extend(sensors_to_ignore_in_logbook)
|
exclude_list.extend(sensor_exclude_list)
|
||||||
exclude_list.extend(make_sensor_exclude_list(all_devices, recorder_excludes))
|
exclude_list.extend(make_sensor_exclude_list(all_devices, recorder_excludes))
|
||||||
return {
|
return {
|
||||||
'recorder': {
|
'recorder': {
|
||||||
|
|
Loading…
Reference in New Issue