mirror of
https://github.com/home-assistant/core.git
synced 2025-08-27 16:31:38 +02:00
Adjust rest integration
This commit is contained in:
@@ -84,7 +84,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
|
|
||||||
if resource_template is not None:
|
if resource_template is not None:
|
||||||
resource_template.hass = hass
|
resource_template.hass = hass
|
||||||
resource = resource_template.render()
|
resource = resource_template.render(parse_result=False)
|
||||||
|
|
||||||
if value_template is not None:
|
if value_template is not None:
|
||||||
value_template.hass = hass
|
value_template.hass = hass
|
||||||
@@ -189,6 +189,6 @@ class RestBinarySensor(BinarySensorEntity):
|
|||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Get the latest data from REST API and updates the state."""
|
"""Get the latest data from REST API and updates the state."""
|
||||||
if self._resource_template is not None:
|
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()
|
await self.rest.async_update()
|
||||||
|
@@ -163,7 +163,7 @@ class RestNotificationService(BaseNotificationService):
|
|||||||
key: _data_template_creator(item) for key, item in value.items()
|
key: _data_template_creator(item) for key, item in value.items()
|
||||||
}
|
}
|
||||||
value.hass = self._hass
|
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))
|
data.update(_data_template_creator(self._data_template))
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
|
|
||||||
if resource_template is not None:
|
if resource_template is not None:
|
||||||
resource_template.hass = hass
|
resource_template.hass = hass
|
||||||
resource = resource_template.render()
|
resource = resource_template.render(parse_result=False)
|
||||||
|
|
||||||
if username and password:
|
if username and password:
|
||||||
if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
|
if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
|
||||||
@@ -202,7 +202,7 @@ class RestSensor(Entity):
|
|||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Get the latest data from REST API and update the state."""
|
"""Get the latest data from REST API and update the state."""
|
||||||
if self._resource_template is not None:
|
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()
|
await self.rest.async_update()
|
||||||
|
|
||||||
|
@@ -162,7 +162,7 @@ class RestSwitch(SwitchEntity):
|
|||||||
|
|
||||||
async def async_turn_on(self, **kwargs):
|
async def async_turn_on(self, **kwargs):
|
||||||
"""Turn the device on."""
|
"""Turn the device on."""
|
||||||
body_on_t = self._body_on.async_render()
|
body_on_t = self._body_on.async_render(parse_result=False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = await self.set_device_state(body_on_t)
|
req = await self.set_device_state(body_on_t)
|
||||||
@@ -178,7 +178,7 @@ class RestSwitch(SwitchEntity):
|
|||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs):
|
||||||
"""Turn the device off."""
|
"""Turn the device off."""
|
||||||
body_off_t = self._body_off.async_render()
|
body_off_t = self._body_off.async_render(parse_result=False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
req = await self.set_device_state(body_off_t)
|
req = await self.set_device_state(body_off_t)
|
||||||
|
Reference in New Issue
Block a user