From 18f747e3980699f23242706846a07af02d176760 Mon Sep 17 00:00:00 2001 From: Seb Ruiz Date: Tue, 30 Aug 2022 21:06:18 +1000 Subject: [PATCH] Return debug logging for devices --- custom_components/bhyve/config_flow.py | 4 ++-- debug/debug.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/custom_components/bhyve/config_flow.py b/custom_components/bhyve/config_flow.py index 6a5b149..9feadd4 100644 --- a/custom_components/bhyve/config_flow.py +++ b/custom_components/bhyve/config_flow.py @@ -1,6 +1,7 @@ """Config flow for BHyve integration.""" from __future__ import annotations +import json import logging from typing import Any @@ -204,8 +205,7 @@ async def async_step_init(self, user_input=None): except BHyveError: return self.async_abort(reason="cannot_connect") - # _LOGGER.debug("Devices: %s", json.dumps(devices)) - # _LOGGER.debug("Programs: %s", json.dumps(programs)) + _LOGGER.debug("Devices: %s", json.dumps(devices)) # _LOGGER.debug("ALL DEVICES") # _LOGGER.debug(str(self.config_entry.options)) diff --git a/debug/debug.py b/debug/debug.py index e9b96b3..fc45918 100644 --- a/debug/debug.py +++ b/debug/debug.py @@ -12,18 +12,18 @@ script_dir = os.path.dirname(os.path.realpath(__file__)) -devices_json = os.path.join(script_dir, folder + "/devices.json") +diagnostics_json = os.path.join(script_dir, folder + "/diagnostics.json") -with open(devices_json) as devicesFile: - devices = json.load(devicesFile) - devicesFile.close() +with open(diagnostics_json) as diagnosticsFile: + diagnostics = json.load(diagnosticsFile) + diagnosticsFile.close() - -for device in devices: +for device in diagnostics.get("data").get("devices"): if device.get("type") == "bridge": continue name = device.get("name") + print("") if device.get("type") == "sprinkler_timer": zones = device.get("zones")