Merge pull request #32327 from home-assistant/rc

0.106.2
This commit is contained in:
Paulus Schoutsen 2020-02-28 12:40:20 -08:00 committed by GitHub
commit 3b147bcbf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 64 additions and 17 deletions

View File

@ -3,7 +3,7 @@
"name": "Home Assistant Frontend", "name": "Home Assistant Frontend",
"documentation": "https://www.home-assistant.io/integrations/frontend", "documentation": "https://www.home-assistant.io/integrations/frontend",
"requirements": [ "requirements": [
"home-assistant-frontend==20200220.4" "home-assistant-frontend==20200220.5"
], ],
"dependencies": [ "dependencies": [
"api", "api",

View File

@ -104,6 +104,9 @@ class LovelaceStorage:
async def async_save(self, config): async def async_save(self, config):
"""Save config.""" """Save config."""
if self._hass.config.safe_mode:
raise HomeAssistantError("Deleting not supported in safe mode")
if self._data is None: if self._data is None:
await self._load() await self._load()
self._data["config"] = config self._data["config"] = config
@ -112,6 +115,9 @@ class LovelaceStorage:
async def async_delete(self): async def async_delete(self):
"""Delete config.""" """Delete config."""
if self._hass.config.safe_mode:
raise HomeAssistantError("Deleting not supported in safe mode")
await self.async_save(None) await self.async_save(None)
async def _load(self): async def _load(self):

View File

@ -202,6 +202,8 @@ class RestSensor(Entity):
self.rest.update() self.rest.update()
value = self.rest.data value = self.rest.data
_LOGGER.debug("Data fetched from resource: %s", value) _LOGGER.debug("Data fetched from resource: %s", value)
if self.rest.headers is not None:
# If the http request failed, headers will be None
content_type = self.rest.headers.get("content-type") content_type = self.rest.headers.get("content-type")
if content_type and content_type.startswith("text/xml"): if content_type and content_type.startswith("text/xml"):

View File

@ -338,4 +338,4 @@ class UniFiDeviceTracker(ScannerEntity):
@property @property
def should_poll(self): def should_poll(self):
"""No polling needed.""" """No polling needed."""
return False return True

View File

@ -62,4 +62,4 @@ class UniFiClient(Entity):
@property @property
def should_poll(self) -> bool: def should_poll(self) -> bool:
"""No polling needed.""" """No polling needed."""
return False return True

View File

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

View File

@ -11,7 +11,7 @@ cryptography==2.8
defusedxml==0.6.0 defusedxml==0.6.0
distro==1.4.0 distro==1.4.0
hass-nabucasa==0.31 hass-nabucasa==0.31
home-assistant-frontend==20200220.4 home-assistant-frontend==20200220.5
importlib-metadata==1.5.0 importlib-metadata==1.5.0
jinja2>=2.10.3 jinja2>=2.10.3
netdisco==2.6.0 netdisco==2.6.0

View File

@ -683,7 +683,7 @@ hole==0.5.0
holidays==0.10.1 holidays==0.10.1
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20200220.4 home-assistant-frontend==20200220.5
# homeassistant.components.zwave # homeassistant.components.zwave
homeassistant-pyozw==0.1.8 homeassistant-pyozw==0.1.8

View File

@ -254,7 +254,7 @@ hole==0.5.0
holidays==0.10.1 holidays==0.10.1
# homeassistant.components.frontend # homeassistant.components.frontend
home-assistant-frontend==20200220.4 home-assistant-frontend==20200220.5
# homeassistant.components.zwave # homeassistant.components.zwave
homeassistant-pyozw==0.1.8 homeassistant-pyozw==0.1.8

View File

@ -45,6 +45,16 @@ async def test_lovelace_from_storage(hass, hass_ws_client, hass_storage):
assert not response["success"] assert not response["success"]
assert response["error"]["code"] == "config_not_found" assert response["error"]["code"] == "config_not_found"
await client.send_json(
{"id": 9, "type": "lovelace/config/save", "config": {"yo": "hello"}}
)
response = await client.receive_json()
assert not response["success"]
await client.send_json({"id": 10, "type": "lovelace/config/delete"})
response = await client.receive_json()
assert not response["success"]
async def test_lovelace_from_storage_save_before_load( async def test_lovelace_from_storage_save_before_load(
hass, hass_ws_client, hass_storage hass, hass_ws_client, hass_storage

View File

@ -589,6 +589,35 @@ class TestRestSensor(unittest.TestCase):
assert mock_logger.warning.called assert mock_logger.warning.called
assert mock_logger.debug.called assert mock_logger.debug.called
@patch("homeassistant.components.rest.sensor._LOGGER")
def test_update_with_failed_get(self, mock_logger):
"""Test attributes get extracted from a XML result with bad xml."""
value_template = template("{{ value_json.toplevel.master_value }}")
value_template.hass = self.hass
self.rest.update = Mock(
"rest.RestData.update", side_effect=self.update_side_effect(None, None),
)
self.sensor = rest.RestSensor(
self.hass,
self.rest,
self.name,
self.unit_of_measurement,
self.device_class,
value_template,
["key"],
self.force_update,
self.resource_template,
self.json_attrs_path,
)
self.sensor.update()
assert {} == self.sensor.device_state_attributes
assert mock_logger.warning.called
assert mock_logger.debug.called
assert self.sensor.state is None
assert self.sensor.available is False
class TestRestData(unittest.TestCase): class TestRestData(unittest.TestCase):
"""Tests for RestData.""" """Tests for RestData."""