Skip to content

Commit

Permalink
Add devices list logger to help user report issues
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantasWeng committed Jan 21, 2021
1 parent 7179a81 commit a46f909
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.

### Add
- Login Checking
- Devices List

## [0.1.1] - 2021-01-20
### Add
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,18 @@ This project only test with `Panasonic air conditioner - PX series` which use `C
### You can also...

<a href="https://www.buymeacoffee.com/phantas"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=phantas&button_colour=FFDD00&font_colour=000000&font_family=Poppins&outline_colour=000000&coffee_colour=ffffff"></a>


--

# Logs
How to open the logs record?

Set config in `configuration.yaml` like below:

```yaml
logger:
default: warning
logs:
custom_components.panasonic_smart_app: debug
```
3 changes: 2 additions & 1 deletion custom_components/panasonic_smart_app/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def wrapper_call(*args, **kwargs):

def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the panasonic cloud components."""
_LOGGER.debug('The panasonic_smart_app is setting up Platform.')
_LOGGER.info('The panasonic_smart_app is setting up Platform.')
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
# _LOGGER.debug(f'The panasonic_smart_app info {username} {password}.')
Expand All @@ -72,6 +72,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
_LOGGER.debug(f'The panasonic_smart_app devices {device}.')
devices.append(PanasonicDevice(device, api))
add_entities(devices, True)
_LOGGER.info('The panasonic_smart_app setup is done.')


class PanasonicDevice(ClimateEntity):
Expand Down
3 changes: 3 additions & 0 deletions custom_components/panasonic_smart_app/smartApp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# from .secrets import *
from . import _taiseia as taiSEIA

_LOGGER = logging.getLogger(__name__)

APP_TOKEN = 'D8CBFF4C-2824-4342-B22D-189166FEF503'

class SmartApp(object):
Expand Down Expand Up @@ -33,6 +35,7 @@ def login(self):
def getDevices(self):
response = requests.get(urls.getDevices(), headers = self.header)
response.raise_for_status()
_LOGGER.debug(f"[getDevices {response.status_code}] - {response.json()}")
self._devices = response.json()
return self._devices

Expand Down

0 comments on commit a46f909

Please sign in to comment.