Skip to content

Commit

Permalink
Add scraped HTML page to debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
erikkastelec committed Feb 23, 2021
1 parent b809f68 commit 4f7bb89
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Add the following to your `configuration.yaml` file:
# Example configuration.yaml entry
sensor:
- platform: wemportal
#scan_interval: 900
#scan_interval: 1800
username: your_username
password: your_password
resources:
Expand Down
3 changes: 1 addition & 2 deletions custom_components/wemportal/const.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
""" Constants for the WEM Portal Integration """

import logging

_LOGGER = logging.getLogger('wemportal')
_LOGGER = logging.getLogger('custom_component.wemportal')
DOMAIN = "wemportal"
DEFAULT_NAME = "Weishaupt WEM Portal"
DEFAULT_TIMEOUT = 60
Expand Down
2 changes: 1 addition & 1 deletion custom_components/wemportal/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://github.com/erikkastelec/hass-WEM-Portal",
"issue_tracker": "https://github.com/erikkastelec/hass-WEM-Portal/issues",
"dependencies": [],
"version": "1.0.2",
"version": "1.0.3",
"codeowners": [
"@erikkastelec"
],
Expand Down
8 changes: 5 additions & 3 deletions custom_components/wemportal/wemportalapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class WemPortalApi(object):
""" Wrapper class to the Atag One API """
""" Wrapper class for Weishaupt WEM Portal"""

def __init__(self, username, password):
self.data = None
Expand Down Expand Up @@ -61,12 +61,13 @@ def parse(self, response):
callback=self.navigate_to_expert_page)

def navigate_to_expert_page(self, response):
_LOGGER.debug("Print user page HTML: %s", response.text)
if response.url == 'https://www.wemportal.com/Web/login.aspx?AspxAutoDetectCookieSupport=1':
_LOGGER.debug("Authhentication failed")
_LOGGER.debug("Authentication failed")
self.authErrorFlag = True
form_data = {}
else:
_LOGGER.debug("Authhentication successful")
_LOGGER.debug("Authentication successful")
form_data = self.generate_form_data(response)
_LOGGER.debug("Form data processed")
return FormRequest(url='https://www.wemportal.com/Web/default.aspx',
Expand Down Expand Up @@ -102,6 +103,7 @@ def generate_form_data(self, response):
}

def scrape_pages(self, response):
_LOGGER.debug("Print expert page HTML: %s", response.text)
if self.authErrorFlag:
yield {'authErrorFlag': True}
_LOGGER.debug("Scraping page")
Expand Down

0 comments on commit 4f7bb89

Please sign in to comment.