Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volvooncall: Support configuration of region (no service url neccessary #10513

Merged
merged 1 commit into from
Nov 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions homeassistant/components/volvooncall.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@

DATA_KEY = DOMAIN

REQUIREMENTS = ['volvooncall==0.3.3']
REQUIREMENTS = ['volvooncall==0.4.0']

_LOGGER = logging.getLogger(__name__)

CONF_UPDATE_INTERVAL = 'update_interval'
MIN_UPDATE_INTERVAL = timedelta(minutes=1)
DEFAULT_UPDATE_INTERVAL = timedelta(minutes=1)
CONF_REGION = 'region'
CONF_SERVICE_URL = 'service_url'

SIGNAL_VEHICLE_SEEN = '{}.vehicle_seen'.format(DOMAIN)
Expand Down Expand Up @@ -58,18 +59,20 @@
{cv.slug: cv.string}),
vol.Optional(CONF_RESOURCES): vol.All(
cv.ensure_list, [vol.In(RESOURCES)]),
vol.Optional(CONF_REGION): cv.string,
vol.Optional(CONF_SERVICE_URL): cv.string,
}),
}, extra=vol.ALLOW_EXTRA)


def setup(hass, config):
"""Set up the Volvo On Call component."""
from volvooncall import Connection, DEFAULT_SERVICE_URL
from volvooncall import Connection
connection = Connection(
config[DOMAIN].get(CONF_USERNAME),
config[DOMAIN].get(CONF_PASSWORD),
config[DOMAIN].get(CONF_SERVICE_URL, DEFAULT_SERVICE_URL))
config[DOMAIN].get(CONF_SERVICE_URL),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question:
I assume the lib handles this internally now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, moved it there, should be backwards compatible ie no breaking change, explicit url can still be specified.

config[DOMAIN].get(CONF_REGION))

interval = config[DOMAIN].get(CONF_UPDATE_INTERVAL)

Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ upsmychoice==1.0.6
uvcclient==0.10.1

# homeassistant.components.volvooncall
volvooncall==0.3.3
volvooncall==0.4.0

# homeassistant.components.verisure
vsure==1.3.7
Expand Down