// Variables used by Scriptable. // These must be at the very top of the file. Do not edit. // icon-color: purple; icon-glyph: magic; const HASS_LLAT = Keychain.get("hass_llat"); const HASS_API_URL = "https://hass-new.adhd.energy/api"; async function fetchEntityState(entity_id) { if (entity_id === undefined) { return {"error":"entity_id is missing"} } let hass_req = new Request(HASS_API_URL + "/states/" + entity_id) hass_req.headers = { "Authorization": "Bearer " + HASS_LLAT, "Content-Type": "application/json" } return await hass_req.loadJSON(); }