Adjust rest integration

This commit is contained in:
Franck Nijhof
2020-10-26 17:27:18 +01:00
parent 885a544af9
commit 550432b473
4 changed files with 7 additions and 7 deletions

View File

@@ -84,7 +84,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if resource_template is not None:
resource_template.hass = hass
resource = resource_template.render()
resource = resource_template.render(parse_result=False)
if value_template is not None:
value_template.hass = hass
@@ -189,6 +189,6 @@ class RestBinarySensor(BinarySensorEntity):
async def async_update(self):
"""Get the latest data from REST API and updates the state."""
if self._resource_template is not None:
self.rest.set_url(self._resource_template.render())
self.rest.set_url(self._resource_template.render(parse_result=False))
await self.rest.async_update()

View File

@@ -163,7 +163,7 @@ class RestNotificationService(BaseNotificationService):
key: _data_template_creator(item) for key, item in value.items()
}
value.hass = self._hass
return value.async_render(kwargs)
return value.async_render(kwargs, parse_result=False)
data.update(_data_template_creator(self._data_template))

View File

@@ -103,7 +103,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if resource_template is not None:
resource_template.hass = hass
resource = resource_template.render()
resource = resource_template.render(parse_result=False)
if username and password:
if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
@@ -202,7 +202,7 @@ class RestSensor(Entity):
async def async_update(self):
"""Get the latest data from REST API and update the state."""
if self._resource_template is not None:
self.rest.set_url(self._resource_template.render())
self.rest.set_url(self._resource_template.render(parse_result=False))
await self.rest.async_update()

View File

@@ -162,7 +162,7 @@ class RestSwitch(SwitchEntity):
async def async_turn_on(self, **kwargs):
"""Turn the device on."""
body_on_t = self._body_on.async_render()
body_on_t = self._body_on.async_render(parse_result=False)
try:
req = await self.set_device_state(body_on_t)
@@ -178,7 +178,7 @@ class RestSwitch(SwitchEntity):
async def async_turn_off(self, **kwargs):
"""Turn the device off."""
body_off_t = self._body_off.async_render()
body_off_t = self._body_off.async_render(parse_result=False)
try:
req = await self.set_device_state(body_off_t)