diff --git a/homeassistant/components/pvoutput/sensor.py b/homeassistant/components/pvoutput/sensor.py index 8126e00d8e5..512fb75067b 100644 --- a/homeassistant/components/pvoutput/sensor.py +++ b/homeassistant/components/pvoutput/sensor.py @@ -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() diff --git a/homeassistant/components/rest/utils.py b/homeassistant/components/rest/utils.py index 24c58d294e1..35b3c22db31 100644 --- a/homeassistant/components/rest/utils.py +++ b/homeassistant/components/rest/utils.py @@ -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