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