iOS widget Scriptable

I tried to find a good and simple widget to Home Assistant to you on my iPhone. I could not find any that suited me.

I decided to make my own with Scriptable. Feel free to try it out and say what you think.

This is what it can look like.

There are some quirks, like getting good icons. I have not find any good way to use the SFSymbol lib.

You can find the widget here: GitHub - olahellgren/home-assistant-sensor-widget-scriptable

7 Likes

Awesome.
how did you round the values?
Could we add conditional colors, e.g. if energy price goes high use red as font color?

The solution to rounding you can find here: Add rounding support · Issue #2 · olahellgren/home-assistant-sensor-widget-scriptable · GitHub

If you want different color depending on values that will be very sensor specific, and out of scope of my simple script. I suggest adding a function by yourself that take care of that. Similar to how I did with sensor type for moisture, you should be able to apply the same principle to text color.

Good luck!

Also, to add to this, standard entities has support for precision if you go to their settings. There you can set decimal precision.

Hi , when i copy , modify url home assistant and save script into app scriptable , i have a url invalid error

Do u know why?

Just to be on the safe side:
the values in the widget don’t update automatically, do they?

2 Likes

Unfortunately I get an ssl error.

This is great, I set it up just fine!
Thank you so much

Did you find out how values update automatically?

1 Like

Would it be possible to modify the script, so that the icons are not set automatically by the device class, but described in another array?

Hi

Awesome solution, great job !

Can I use it to display what game is playing and the picture from sensor of Xbox or Switch ?

It would be great for me ?

Thanks a lot

They update automatically. But there can be a slight delay, as this is dependant on iOS.

FWIW: I’ve used data URIs with base64 encoded PNGs to show images in scriptable widgets. See eg. data URI scheme - Wikipedia for more information. Basically convert your image to a data URI (there are many free online services to do this), then

  let req = new Request('data:image/png;base64,....')
  someStack.addImage(req.loadImage())

is it possible to print attributes of sensors? How?

I have a longer text that is stored in an attribute (due to size limits for sensors) and I would like to show that attribute in the widget.

[later edit] - I managed to print a hard-coded attribute. What would be the filter syntax to return the attribute with a name written in the “sensor.homeassistant_widget_text” array?
I assumed I detect attributes by removing all chars after and including the second dot in the string…