mirror of https://github.com/home-assistant/core
emptying device state attributes if the update from the feed fails (#17249)
This commit is contained in:
parent
42fb886d71
commit
b637b48bd8
|
@ -145,3 +145,4 @@ class GeoRssServiceSensor(Entity):
|
|||
# If no events were found due to an error then just set state to
|
||||
# zero.
|
||||
self._state = 0
|
||||
self._state_attributes = {}
|
||||
|
|
|
@ -123,6 +123,10 @@ class TestGeoRssServiceUpdater(unittest.TestCase):
|
|||
assert len(all_states) == 1
|
||||
state = self.hass.states.get("sensor.event_service_any")
|
||||
assert int(state.state) == 0
|
||||
assert state.attributes == {
|
||||
ATTR_FRIENDLY_NAME: "Event Service Any",
|
||||
ATTR_UNIT_OF_MEASUREMENT: "Events",
|
||||
ATTR_ICON: "mdi:alert"}
|
||||
|
||||
@mock.patch('georss_client.generic_feed.GenericFeed')
|
||||
def test_setup_with_categories(self, mock_feed):
|
||||
|
|
Loading…
Reference in New Issue