This is a simple sensor widget for iOS using Scriptable. It will provide a relativly simple way to add you sensor in a widget.
Download the Scriptable app and add the script file as a script. You can then edit the config and add a small scriptable widget to your screen.
When added the widget edit the widget and choose the script as widget. Voila!
- Find your home assistant base URL (typicallly something like
https://myinstance.ui.nabu.casa
orhttp://192.168.1.32:8123
) - Create a long lived token (Bearer token) for your desired user.
- Find you sensor entity ids (something like
sensor.oregonv1_x080_temp
orbinary_sensor.smart_water_leak_12
)
Add your base URL and Bearer token. It should look something like below.
const hassUrl = "http://192.168.1.32:8123"
const hassToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
Add titles and sensor to the array. You can add any number of titles and sensors as long as there are room. The widget will automatically recognize titles and sensors. If it does not find the entry in your home assistant states it will diplay it as a title.
const widgetTitlesAndSensors = [
"Solar",
"sensor.solar_power",
"sensor.solar_yield_today",
"Wind",
"sensor.wind_now"
]
Long press the widget, choose edit widget, and choose Open URL. Add disired link, as described below.
To add a link you just mimic your web url to a view but use the homeassistant
scheme together with navigate
. E.g. to navigate to a lovelace view: homeassistant://navigate/lovelace-my-home/1
, the digit at the end represent the tab number (starting at 0
).