# Requête HHTP via Lua

cf. https://community.silverbullet.md/t/integrate-silverbullet-with-home-assistant-and-more/3366

```_space-lua
function getWeatherHASS()
       local HA_URL = "https://your.hass.url/api/states/"
       local ENTITY = "weather.forecast..."
       local HA_TOKEN = "YOUR_API_KEY"
    
       local url = HA_URL .. ENTITY
       local headers = {
            ["Authorization"] = "Bearer " .. HA_TOKEN,
            ["Content-Type"] = "application/json" 
           }
       local response = http.request(url,{method = "GET", headers = headers})
       local result = response.body.attributes.temperature
   return result .. "°C"
end
```
