added entity update debugs #18

This commit is contained in:
tomaae 2020-04-04 19:46:40 +02:00
parent 35936352a8
commit 1ec4e13eb8
4 changed files with 7 additions and 5 deletions

View file

@ -103,6 +103,7 @@ def update_items(inst, mikrotik_controller, async_add_entities, sensors):
for sensor in SENSOR_TYPES:
if "traffic_" not in sensor:
item_id = f"{inst}-{sensor}"
_LOGGER.debug("Updating sensor %s", item_id)
if item_id in sensors:
if sensors[item_id].enabled:
sensors[item_id].async_schedule_update_ha_state()
@ -116,9 +117,9 @@ def update_items(inst, mikrotik_controller, async_add_entities, sensors):
if "traffic_" in sensor:
for uid in mikrotik_controller.data["interface"]:
if mikrotik_controller.data["interface"][uid][
"type"] == "ether":
if mikrotik_controller.data["interface"][uid]["type"] == "ether":
item_id = f"{inst}-{sensor}-{mikrotik_controller.data['interface'][uid]['default-name']}"
_LOGGER.debug("Updating sensor %s", item_id)
if item_id in sensors:
if sensors[item_id].enabled:
sensors[item_id].async_schedule_update_ha_state()