mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Upgrade gitterpy to 0.1.7 (#14643)
This commit is contained in:
parent
5acfe5da68
commit
2d88f47795
@ -8,12 +8,12 @@ import logging
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_NAME, CONF_API_KEY, CONF_ROOM
|
from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_ROOM
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
REQUIREMENTS = ['gitterpy==0.1.6']
|
REQUIREMENTS = ['gitterpy==0.1.7']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
username = gitter.auth.get_my_id['name']
|
username = gitter.auth.get_my_id['name']
|
||||||
except GitterTokenError:
|
except GitterTokenError:
|
||||||
_LOGGER.error("Token is not valid")
|
_LOGGER.error("Token is not valid")
|
||||||
return False
|
return
|
||||||
|
|
||||||
add_devices([GitterSensor(gitter, room, name, username)], True)
|
add_devices([GitterSensor(gitter, room, name, username)], True)
|
||||||
|
|
||||||
@ -96,7 +96,14 @@ class GitterSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data and updates the state."""
|
"""Get the latest data and updates the state."""
|
||||||
|
from gitterpy.errors import GitterRoomError
|
||||||
|
|
||||||
|
try:
|
||||||
data = self._data.user.unread_items(self._room)
|
data = self._data.user.unread_items(self._room)
|
||||||
|
except GitterRoomError as error:
|
||||||
|
_LOGGER.error(error)
|
||||||
|
return
|
||||||
|
|
||||||
if 'error' not in data.keys():
|
if 'error' not in data.keys():
|
||||||
self._mention = len(data['mention'])
|
self._mention = len(data['mention'])
|
||||||
self._state = len(data['chat'])
|
self._state = len(data['chat'])
|
||||||
|
@ -344,7 +344,7 @@ gTTS-token==1.1.1
|
|||||||
gearbest_parser==1.0.5
|
gearbest_parser==1.0.5
|
||||||
|
|
||||||
# homeassistant.components.sensor.gitter
|
# homeassistant.components.sensor.gitter
|
||||||
gitterpy==0.1.6
|
gitterpy==0.1.7
|
||||||
|
|
||||||
# homeassistant.components.notify.gntp
|
# homeassistant.components.notify.gntp
|
||||||
gntp==1.0.3
|
gntp==1.0.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user