Merge pull request #10936 from home-assistant/release-0-59-1

0.59.1
This commit is contained in:
Paulus Schoutsen 2017-12-03 20:08:04 -08:00 committed by GitHub
commit 015cdd155c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 33 deletions

View File

@ -58,7 +58,8 @@ CONFIG_SCHEMA = vol.Schema({
vol.Required(ATTR_PHONE): cv.string, vol.Required(ATTR_PHONE): cv.string,
vol.Required(ATTR_ADDRESS): cv.string, vol.Required(ATTR_ADDRESS): cv.string,
vol.Optional(ATTR_SHOW_MENU): cv.boolean, vol.Optional(ATTR_SHOW_MENU): cv.boolean,
vol.Optional(ATTR_ORDERS): vol.All(cv.ensure_list, [_ORDERS_SCHEMA]), vol.Optional(ATTR_ORDERS, default=[]): vol.All(
cv.ensure_list, [_ORDERS_SCHEMA]),
}), }),
}, extra=vol.ALLOW_EXTRA) }, extra=vol.ALLOW_EXTRA)
@ -81,7 +82,8 @@ def setup(hass, config):
order = DominosOrder(order_info, dominos) order = DominosOrder(order_info, dominos)
entities.append(order) entities.append(order)
component.add_entities(entities) if entities:
component.add_entities(entities)
# Return boolean to indicate that initialization was successfully. # Return boolean to indicate that initialization was successfully.
return True return True
@ -93,7 +95,8 @@ class Dominos():
def __init__(self, hass, config): def __init__(self, hass, config):
"""Set up main service.""" """Set up main service."""
conf = config[DOMAIN] conf = config[DOMAIN]
from pizzapi import Address, Customer, Store from pizzapi import Address, Customer
from pizzapi.address import StoreException
self.hass = hass self.hass = hass
self.customer = Customer( self.customer = Customer(
conf.get(ATTR_FIRST_NAME), conf.get(ATTR_FIRST_NAME),
@ -105,7 +108,10 @@ class Dominos():
*self.customer.address.split(','), *self.customer.address.split(','),
country=conf.get(ATTR_COUNTRY)) country=conf.get(ATTR_COUNTRY))
self.country = conf.get(ATTR_COUNTRY) self.country = conf.get(ATTR_COUNTRY)
self.closest_store = Store() try:
self.closest_store = self.address.closest_store()
except StoreException:
self.closest_store = None
def handle_order(self, call): def handle_order(self, call):
"""Handle ordering pizza.""" """Handle ordering pizza."""
@ -123,29 +129,31 @@ class Dominos():
from pizzapi.address import StoreException from pizzapi.address import StoreException
try: try:
self.closest_store = self.address.closest_store() self.closest_store = self.address.closest_store()
return True
except StoreException: except StoreException:
self.closest_store = False self.closest_store = None
return False
def get_menu(self): def get_menu(self):
"""Return the products from the closest stores menu.""" """Return the products from the closest stores menu."""
if self.closest_store is False: if self.closest_store is None:
_LOGGER.warning('Cannot get menu. Store may be closed') _LOGGER.warning('Cannot get menu. Store may be closed')
return return []
else:
menu = self.closest_store.get_menu()
product_entries = []
menu = self.closest_store.get_menu() for product in menu.products:
product_entries = [] item = {}
if isinstance(product.menu_data['Variants'], list):
variants = ', '.join(product.menu_data['Variants'])
else:
variants = product.menu_data['Variants']
item['name'] = product.name
item['variants'] = variants
product_entries.append(item)
for product in menu.products: return product_entries
item = {}
if isinstance(product.menu_data['Variants'], list):
variants = ', '.join(product.menu_data['Variants'])
else:
variants = product.menu_data['Variants']
item['name'] = product.name
item['variants'] = variants
product_entries.append(item)
return product_entries
class DominosProductListView(http.HomeAssistantView): class DominosProductListView(http.HomeAssistantView):
@ -192,7 +200,7 @@ class DominosOrder(Entity):
@property @property
def state(self): def state(self):
"""Return the state either closed, orderable or unorderable.""" """Return the state either closed, orderable or unorderable."""
if self.dominos.closest_store is False: if self.dominos.closest_store is None:
return 'closed' return 'closed'
else: else:
return 'orderable' if self._orderable else 'unorderable' return 'orderable' if self._orderable else 'unorderable'
@ -217,6 +225,11 @@ class DominosOrder(Entity):
def order(self): def order(self):
"""Create the order object.""" """Create the order object."""
from pizzapi import Order from pizzapi import Order
from pizzapi.address import StoreException
if self.dominos.closest_store is None:
raise StoreException
order = Order( order = Order(
self.dominos.closest_store, self.dominos.closest_store,
self.dominos.customer, self.dominos.customer,

View File

@ -23,7 +23,7 @@ from homeassistant.const import CONF_NAME, EVENT_THEMES_UPDATED
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.loader import bind_hass from homeassistant.loader import bind_hass
REQUIREMENTS = ['home-assistant-frontend==20171130.0', 'user-agents==1.1.0'] REQUIREMENTS = ['home-assistant-frontend==20171204.0', 'user-agents==1.1.0']
DOMAIN = 'frontend' DOMAIN = 'frontend'
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log'] DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log']

View File

@ -264,7 +264,7 @@ class iOSIdentifyDeviceView(HomeAssistantView):
# return self.json_message(humanize_error(request.json, ex), # return self.json_message(humanize_error(request.json, ex),
# HTTP_BAD_REQUEST) # HTTP_BAD_REQUEST)
data[ATTR_LAST_SEEN_AT] = datetime.datetime.now() data[ATTR_LAST_SEEN_AT] = datetime.datetime.now().isoformat()
name = data.get(ATTR_DEVICE_ID) name = data.get(ATTR_DEVICE_ID)

View File

@ -4,8 +4,9 @@ Notifications for Android TV notification service.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.nfandroidtv/ https://home-assistant.io/components/notify.nfandroidtv/
""" """
import os
import logging import logging
import io
import base64
import requests import requests
import voluptuous as vol import voluptuous as vol
@ -31,6 +32,9 @@ DEFAULT_TRANSPARENCY = 'default'
DEFAULT_COLOR = 'grey' DEFAULT_COLOR = 'grey'
DEFAULT_INTERRUPT = False DEFAULT_INTERRUPT = False
DEFAULT_TIMEOUT = 5 DEFAULT_TIMEOUT = 5
DEFAULT_ICON = (
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGP6zwAAAgcBApo'
'cMXEAAAAASUVORK5CYII=')
ATTR_DURATION = 'duration' ATTR_DURATION = 'duration'
ATTR_POSITION = 'position' ATTR_POSITION = 'position'
@ -110,16 +114,13 @@ class NFAndroidTVNotificationService(BaseNotificationService):
self._default_color = color self._default_color = color
self._default_interrupt = interrupt self._default_interrupt = interrupt
self._timeout = timeout self._timeout = timeout
self._icon_file = os.path.join( self._icon_file = io.BytesIO(base64.b64decode(DEFAULT_ICON))
os.path.dirname(__file__), '..', 'frontend', 'www_static', 'icons',
'favicon-192x192.png')
def send_message(self, message="", **kwargs): def send_message(self, message="", **kwargs):
"""Send a message to a Android TV device.""" """Send a message to a Android TV device."""
_LOGGER.debug("Sending notification to: %s", self._target) _LOGGER.debug("Sending notification to: %s", self._target)
payload = dict(filename=('icon.png', payload = dict(filename=('icon.png', self._icon_file,
open(self._icon_file, 'rb'),
'application/octet-stream', 'application/octet-stream',
{'Expires': '0'}), type='0', {'Expires': '0'}), type='0',
title=kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT), title=kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT),
@ -129,7 +130,7 @@ class NFAndroidTVNotificationService(BaseNotificationService):
transparency='%i' % TRANSPARENCIES.get( transparency='%i' % TRANSPARENCIES.get(
self._default_transparency), self._default_transparency),
offset='0', app=ATTR_TITLE_DEFAULT, force='true', offset='0', app=ATTR_TITLE_DEFAULT, force='true',
interrupt='%i' % self._default_interrupt) interrupt='%i' % self._default_interrupt,)
data = kwargs.get(ATTR_DATA) data = kwargs.get(ATTR_DATA)
if data: if data:

View File

@ -2,7 +2,7 @@
"""Constants used by Home Assistant components.""" """Constants used by Home Assistant components."""
MAJOR_VERSION = 0 MAJOR_VERSION = 0
MINOR_VERSION = 59 MINOR_VERSION = 59
PATCH_VERSION = '0' PATCH_VERSION = '1'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 4, 2) REQUIRED_PYTHON_VER = (3, 4, 2)

View File

@ -331,7 +331,7 @@ hipnotify==1.0.8
holidays==0.8.1 holidays==0.8.1
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20171130.0 home-assistant-frontend==20171204.0
# homeassistant.components.camera.onvif # homeassistant.components.camera.onvif
http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a

View File

@ -74,7 +74,7 @@ hbmqtt==0.9.1
holidays==0.8.1 holidays==0.8.1
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20171130.0 home-assistant-frontend==20171204.0
# homeassistant.components.influxdb # homeassistant.components.influxdb
# homeassistant.components.sensor.influxdb # homeassistant.components.sensor.influxdb