Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
3bca66e
add dominos service
craigjmidwinter Oct 20, 2017
b4c34c2
change require
craigjmidwinter Oct 26, 2017
6a3813b
Merge branch 'dev' of https://github.com/home-assistant/home-assistan…
craigjmidwinter Oct 30, 2017
4faf97d
dump to log
craigjmidwinter Nov 3, 2017
64adc01
component fixes
craigjmidwinter Nov 4, 2017
27d63a9
clean-up use updated library
craigjmidwinter Nov 4, 2017
b536647
remove unnecessary import
craigjmidwinter Nov 4, 2017
18bbbca
fix hound errors
craigjmidwinter Nov 5, 2017
2793808
more lint fixes
craigjmidwinter Nov 5, 2017
a1ba981
Coverage rc
craigjmidwinter Nov 5, 2017
2b9749f
Merge branch 'dev' of https://github.com/home-assistant/home-assistan…
craigjmidwinter Nov 5, 2017
456a1c4
update requirements
craigjmidwinter Nov 5, 2017
fe574e6
cleanup as per notes
craigjmidwinter Nov 7, 2017
03ad3ac
missing message
craigjmidwinter Nov 7, 2017
646cebc
linting...
craigjmidwinter Nov 7, 2017
c5f70d2
schema validation and reducing requests
craigjmidwinter Nov 7, 2017
fd90800
Merge branch 'dev' of https://github.com/home-assistant/home-assistan…
craigjmidwinter Nov 7, 2017
c59fe34
fixlint
craigjmidwinter Nov 7, 2017
bd1f914
spacing
craigjmidwinter Nov 7, 2017
7838ceb
unused variable
craigjmidwinter Nov 7, 2017
f0d70ae
fix docstrings
craigjmidwinter Nov 7, 2017
a6c0ca6
update req
craigjmidwinter Nov 8, 2017
cffcd13
notes updates, pypi package, front-end panel
craigjmidwinter Nov 12, 2017
53f4acc
stale import
craigjmidwinter Nov 12, 2017
33e6062
fix constant name
craigjmidwinter Nov 12, 2017
db75ffb
docstrings
craigjmidwinter Nov 12, 2017
ca1a115
fix library import
craigjmidwinter Nov 12, 2017
28542ae
lint fixes
craigjmidwinter Nov 12, 2017
3172f43
pylint bug
craigjmidwinter Nov 12, 2017
fc9808d
remove built-in panel
craigjmidwinter Nov 15, 2017
810a248
Make synchronous
craigjmidwinter Nov 16, 2017
6c049cb
unused import and use throttle
craigjmidwinter Nov 16, 2017
b9815f1
Handle exceptions properly and update client
craigjmidwinter Nov 16, 2017
483934d
Import exceptions properly
craigjmidwinter Nov 16, 2017
81f7d10
unused import
craigjmidwinter Nov 16, 2017
0c1c81e
remove bloat from start-up, readability fixes from notes, retrieve me…
craigjmidwinter Nov 24, 2017
c91b719
whitespace on blank line
craigjmidwinter Nov 24, 2017
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
Prev Previous commit
Next Next commit
Handle exceptions properly and update client
  • Loading branch information
craigjmidwinter committed Nov 16, 2017
commit b9815f1849c48ddd613364511d4cb5c8526cd61d
23 changes: 10 additions & 13 deletions homeassistant/components/dominos.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=10)
MIN_TIME_BETWEEN_STORE_UPDATES = timedelta(minutes=3330)

REQUIREMENTS = ['pizzapi==0.0.2']
REQUIREMENTS = ['pizzapi==0.0.3']

DEPENDENCIES = ['http']

Expand Down Expand Up @@ -106,7 +106,6 @@ def __init__(self, hass, config):
country=config[DOMAIN].get(ATTR_COUNTRY))
self.country = config[DOMAIN].get(ATTR_COUNTRY)
self.closest_store = Store()
self._last_store_check = 0
self.update_closest_store()
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem to be async, yet you're calling it from an async context.

Copy link
Member

Choose a reason for hiding this comment

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

Why would you do this on startup? It's already done when the entities are updated


def handle_order(self, call):
Expand All @@ -122,13 +121,11 @@ def handle_order(self, call):
@Throttle(MIN_TIME_BETWEEN_STORE_UPDATES)
def update_closest_store(self):
"""Update the shared closest store (if open)."""
cur_time = time.time()
if self._last_store_check + MIN_TIME_BETWEEN_STORE_UPDATES < cur_time:
self._last_store_check = cur_time
try:
self.closest_store = self.address.closest_store()
except Exception:
self.closest_store = False
self.closest_store = self.address.closest_store()
try:
self.closest_store = self.address.closest_store()
except pizzapi.address.StoreException:

Choose a reason for hiding this comment

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

undefined name 'pizzapi'

self.closest_store = False

def show_menu(self, hass):
"""Dump the closest stores menu into the logs."""
Expand Down Expand Up @@ -200,15 +197,15 @@ def update(self):
"""Update the order state and refreshes the store."""
try:
self.dominos.update_closest_store()
except Exception:
except pizzapi.address.StoreException:

Choose a reason for hiding this comment

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

undefined name 'pizzapi'

self._orderable = False
return

Choose a reason for hiding this comment

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

blank line contains whitespace

Choose a reason for hiding this comment

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

blank line contains whitespace

try:
order = self.order()
order.pay_with()
self._orderable = True
except Exception:
except pizzapi.address.StoreException:

Choose a reason for hiding this comment

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

undefined name 'pizzapi'

self._orderable = False

def order(self):
Expand All @@ -230,7 +227,7 @@ def place(self):
try:
order = self.order()
order.place()
except Exception:
except pizzapi.address.StoreException:

Choose a reason for hiding this comment

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

undefined name 'pizzapi'

self._orderable = False
_LOGGER.warning(
'Attempted to order Dominos - Order invalid or store closed')
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ piglow==1.2.4
pilight==0.1.1

# homeassistant.components.dominos
pizzapi==0.0.2
pizzapi==0.0.3

# homeassistant.components.media_player.plex
# homeassistant.components.sensor.plex
Expand Down