I’m writing a custom component that queries data from a web API using request
as a python function
So how can I pass a request error (not 200) to homeassistant?
‘’’
async def async_setup(hass, config):
async def handle_pwr_relation(call):
erg = await hass.async_add_executor_job(ostrom_ha_power,hass.data[DOMAIN])
’’’
in ostrom_ha_power
response = requests.get(url, headers=headers)
on API / Web error
raise a exeption ? or return only a error string ?
using exeption: try around the await part ?
were shut i raise a HomeAssistantError
exeption ?