iOS Widget for Home Assistant via Scriptable


I was surprised to see that there is no iOS widget that can display basic sensor data, yet. So I created one using the iOS Scriptable App. I hope this is helpful for some :slight_smile:

You can find the source code of the widget on GitHub. There are many known issues (support for UI dark mode, error handling of non-resposive APIs etc.) so please feel free to fork and improve!



while i liked your code a while ago i am still very impressed how besutiful this is and surprised that no comment came up, but ifelt like you deserved a bit feedback - this is AMAZING!!!
next tome i have so spare time i definitly will use it to imtegrate this


hey its been a while but im atm struggeling with the widget: my states doesnt seem to get updated, is it just me or is it scriptable whos causing this? greetings

I’m running Home Assistant 2021.9.6 and iOS 15 with Scriptable App 1.6.6 and everything is working smoothly.

I can imagine two things:

A) If it never worked, I guess you misconfigured/forgot to edit the widget code (which is required)
B) If it worked in the past and now simply stopped working, I guess the HASS REST API or your access token is not responding/working correctly.

Things to check:

If you have access to a Mac, you can also test and debug the widget on your computer using this:
Download: Scriptable for Mac

If you are into it, you can also poke the REST API via CLI (or have a look here for an less-techi solution)
curl --insecure -H 'Authorization: Bearer *--{Your HASS Long-Lived Access Token here}--*' -H 'content-type: application/json' https://*--{HASS IP}--*/api/states

it should return a long list/string of sensors and their states.

1 Like

Ah well, thanks for your answer. And i really will again appreciate your way of using scriptable for ios here!:slight_smile:
I can access the Values in the Scriptable Widget and can reflect my sensor states there and same Setup: HassIO 2021.9.6, iOS 15 and today updated scriptable. The Problem is more about the current state: scriptable seems to get everything correctly when running it but as a widget on my homescreen this state remains unchanged till i rerun the script in the scriptable app

Sounds like you are referring to a Scriptable iOS 15 bug, which has been fixed yesterday.


Nevertheless, this isn’t a bug that I can fix or address. Fingers crossed it is fixed now. Maybe you need to reboot your phone too.

I would also like to thank you for the great job you have done. This is really helpful:)
The code is working perfectly, but I would like to have the temperature to be displayed with decimals(float), like 24.5 degrees…is there a way I can do that ?

This is rather easy. You need to adjust this line.

I hope you get the idea using this screenshot.

In your case, the line should look similar to this:
room.temp = (Math.round(json[i]['state'] * 10) / 10).toFixed(1);

But you will likely run into space/formatting issues. Something you need to address/fix yourself.


Thanks. Problem solved :slight_smile:

Question about the images. If I host my HA on a VM at a local IP… where can I store the images as to access them just the one time?

Well, you could use images from the Google Image search. Other Scriptable widgets out there use links pointing to Imgur for example:

If your home assistant is running on your local network only, you will not be able to access your instance while - say - traveling etc. the widget would be quite useless in this case, right?!

I suggest you investigate how to host your instance using Let’s Encrypt. For example like this:

I have Nabu Casa so its just a matter of where do I place these images on my HA instance.

For instance, I would think that I would download the PNG and then transfer the PNG file to some directory on the HA (after accessing HA by SMB).

I will even take it a step further. What if I do not want the images at all. I just want a widget that displays the temperature of 3 different sensors. The thermometer png is wholly unnecessary.

Sure no problem, here is a version without images:

So I now get this message after inputting my sensors:

2021-10-17 16:12:59: Error: The data couldn’t be read because it isn’t in the correct format.

I have three sensors I want to teach so this is how I configured like 23 etc… to the file:

/* Parse data received from API */
    let data = {outdoor: {}, child: {}, office: {}}

    data.outdoor = addData(json, data.outdoor, ['sensor.pool_temperature']);
    data.child = addData(json, data.child, ['sensor.pit_temp']); = addData(json,, ['sensor.pizza_temp']);

Looks like your API (HASS) is not reachable/responding correctly.

Check the lines mentioned here:

1 Like

Got it working!! Thank you for the help.

1 Like

Hi all,

The script is working. But how do I get it on my home screen? I don’t see it in the widget list

Oh this is easy. Similar to moving an app on your Home Screen you can also move a Widget.

On your iPhone…

If you do not have the Widget yet

  1. Go to the Widget screen (Swipe to the right on your Home Screen)
  2. Scroll down and click on “Edit”
  3. Press the “+” on the top left corner to add a new widget
  4. From the now presented list, select the Scriptable app
  5. Choose the smallest Widget size, and click “Add Widget”
  6. Tap the new Widget, and select your HASS script
  7. Once the Widget is displayed it jiggles, by long pressing on the Widget you can move it
  8. Move the jiggling Widget to the right towards your Home Screen

If you already have the Widget on your Widget screen

  1. Long press on the Widget until it starts to jiggle
  2. Move the jiggling Widget to the right towards your Home Screen

This part is the problem. The app is not shown in the list at all.

Hard to find an example for this on YT, but here is one. Try to follow this:

1 Like