Skip to content

Commit

Permalink
Refactor show_page to resolve deprecation warning
Browse files Browse the repository at this point in the history
Add debugging logs
  • Loading branch information
NeonDaniel committed Jan 3, 2024
1 parent 9b52d2d commit dc04801
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions ovos_PHAL_plugin_homeassistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,19 +654,13 @@ def handle_show_dashboard(self, message=None):

self.gui["dashboardModel"] = display_list_model
self.gui["instanceAvailable"] = True
self.gui.send_event("ovos.phal.plugin.homeassistant.change.dashboard", {
"dash_type": "main"})
page = join(dirname(__file__), "ui", "Dashboard.qml")
self.gui["use_group_display"] = self.config.get("use_group_display", False)
self.gui.show_page(page, override_idle=True)
else:
self.gui["dashboardModel"] = {"items": []}
self.gui["instanceAvailable"] = False
self.gui.send_event("ovos.phal.plugin.homeassistant.change.dashboard", {
"dash_type": "main"})
page = join(dirname(__file__), "ui", "Dashboard.qml")
self.gui["use_group_display"] = self.config.get("use_group_display", False)
self.gui.show_page(page, override_idle=True)
self.gui.send_event("ovos.phal.plugin.homeassistant.change.dashboard", {
"dash_type": "main"})
self.gui["use_group_display"] = self.config.get("use_group_display", False)
self.gui.show_page("Dashboard", override_idle=True)

LOG.debug("Using group display")
LOG.debug(self.config["use_group_display"])
Expand Down Expand Up @@ -805,13 +799,14 @@ def start_oauth_flow(self):

def handle_qr_oauth_response(self, message):
qr_code_url = message.data.get("qr", None)
LOG.info(f"Got qr code: {qr_code_url}")
self.gui.send_event("ovos.phal.plugin.homeassistant.oauth.qr.update", {
"qr": qr_code_url
})

def handle_token_oauth_response(self, message):
response = message.data
access_token = response.get("access_token", None)
LOG.debug(f"Got oauth token response")
access_token = message.data.get("access_token", None)
if access_token:
self.get_long_term_token(access_token)

Expand Down

0 comments on commit dc04801

Please sign in to comment.