mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-02 21:44:31 +02:00
removed extra cycle in sensor update_items
This commit is contained in:
parent
8b410eab19
commit
f1a239f118
1 changed files with 18 additions and 23 deletions
|
@ -104,9 +104,7 @@ def update_items(inst, mikrotik_controller, async_add_entities, sensors):
|
|||
new_sensors = []
|
||||
|
||||
for sensor in SENSOR_TYPES:
|
||||
if "traffic_" in sensor:
|
||||
continue
|
||||
|
||||
if "traffic_" not in sensor:
|
||||
item_id = "{}-{}".format(inst, sensor)
|
||||
if item_id in sensors:
|
||||
if sensors[item_id].enabled:
|
||||
|
@ -116,10 +114,7 @@ def update_items(inst, mikrotik_controller, async_add_entities, sensors):
|
|||
sensors[item_id] = MikrotikControllerSensor(mikrotik_controller=mikrotik_controller, inst=inst, sensor=sensor)
|
||||
new_sensors.append(sensors[item_id])
|
||||
|
||||
for sensor in SENSOR_TYPES:
|
||||
if "traffic_" not in sensor:
|
||||
continue
|
||||
|
||||
if "traffic_" in sensor:
|
||||
for uid in mikrotik_controller.data['interface']:
|
||||
if mikrotik_controller.data['interface'][uid]['type'] == "ether":
|
||||
item_id = "{}-{}-{}".format(inst, sensor, mikrotik_controller.data['interface'][uid]['default-name'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue