Has anyone found a way to display data from Home Assistant in the beautiful widget app Widgy? People are creating stunning widgets but I can’t find a way to populate it with data from Home Assistant.
I was just researching the same thing. Someone on reddit suggested writing data from Hass to a text file in iCloud and using the text file as the source in Widgy
That is interesting! So basically, idea idea is that I then setup a simple page that Scriptable get’s it’s data from and then I can present it in Widgyb the way I want. Sounds cool
Yes it works. I have a node.js middleware service running on my HA (and Homebridge) collecting information and making it available to many different tools. I can also send requests to Homebridge via post to turn on / off devices or force other routines in in HA.
In short, “open url” action in widgy, scriptable:///run?scriptName=name of script&var1=data1…&var2=data2
Yes it’s 3 /// to make it work.
Now TLDR stuff:
My current project is to make a full home control screen on top of the native apple IOS screen. I am using widgy and scriptable to get this done. Effectively widgy sends a get to scriptable and scriptable can extract the data like it was a traditional put (there is a way to get calling varibels in to a array), structures a POST to HA or Homebridge and sends it. You need to use App.close(); at the top of scriptable, and widgy will still open briefly while calling scriptable. It’s the only way I have gotten around the apple limitation url requests.
Notes:
There are some limitations that make placing real time information in a widget a bit difficult.
Apple only allows widgets to update every 15minutes. If you force an update with high contrast on, high contrast off, you may get results but the whole screen will blink.
Look at IOS shortcuts in combination with an AnyText widget (allows shortcut modification) as a way to place text on the screen more seamlessly. This works for Lock Screen data - that you don’t update frequently.
I was trying to find out if Widgy has global vars, and I ended on this thread.
I have been using Widgy with HA API for direct sensor calls for some time now. No middle ware.
To pass through Cloudflare security, I have a WAF rule for my chosen JSON endpoints and the requesting header must have a matching authorization token. Pretty simple and works flawlessly between internal and external HA sessions.
Unlike with Android, iOS widgets and refresh intervals are very restricted and limited by Apple.
Widgy will update itself as much as Apple allows. However, if you need the widget content to update, just tap it! It will always do a manual refresh of the JSON endpoint on demand.
Instead of trying to format states and numbers and decimal lengths etc. in Widgy layers, I’ve moved on to helper entities and templates to, for instance, change default word-text states to emoji / icons. Then Widgy calls the endpoint with the emoji .
The only real problem I’ve encountered is when I’ve had cause of an Auth Token change…. I must manually go through every widget and update the token. Very tedious. I’m currently attempting some kind of faux-var using a JavaScript layer, instead of a JSON endpoint, so I can build the GET with a concat of the token stored in a plain text on my iPhone and the rest of the url.