Fix pvoutput template use and REST integer parsing (#61171)
* Fix pvoutput template use and REST integer parsing * revert accepting templates as inputpull/61254/head
parent
9f3a4c3617
commit
17a542689f
|
@ -25,9 +25,10 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.template import Template
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
_ENDPOINT = "http://pvoutput.org/service/r2/getstatus.jsp"
|
||||
_ENDPOINT = "https://pvoutput.org/service/r2/getstatus.jsp"
|
||||
|
||||
ATTR_ENERGY_GENERATION = "energy_generation"
|
||||
ATTR_POWER_GENERATION = "power_generation"
|
||||
|
@ -59,7 +60,10 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
method = "GET"
|
||||
payload = auth = None
|
||||
verify_ssl = DEFAULT_VERIFY_SSL
|
||||
headers = {"X-Pvoutput-Apikey": api_key, "X-Pvoutput-SystemId": system_id}
|
||||
headers = {
|
||||
"X-Pvoutput-Apikey": Template(api_key, hass),
|
||||
"X-Pvoutput-SystemId": Template(system_id, hass),
|
||||
}
|
||||
|
||||
rest = RestData(hass, method, _ENDPOINT, auth, headers, None, payload, verify_ssl)
|
||||
await rest.async_update()
|
||||
|
|
|
@ -23,5 +23,5 @@ def render_templates(tpl_dict: dict[str, Template] | None):
|
|||
rendered_items = {}
|
||||
for item_name, template_header in tpl_dict.items():
|
||||
if (value := template_header.async_render()) is not None:
|
||||
rendered_items[item_name] = value
|
||||
rendered_items[item_name] = str(value)
|
||||
return rendered_items
|
||||
|
|
Loading…
Reference in New Issue