Giter Club home page Giter Club logo

homebridgestatuswidget's Introduction

Homebridge Status Widget

  • Script for the iOS App Scriptable that shows a small summary of your Homebridge instance
  • All infos shown are based and provided by the Homebridge Config UI X found at https://github.com/oznu/homebridge-config-ui-x
  • Thanks to the github user oznu for providing such a nice programm!
  • This script does not work if you don't have the Homebridge service (Homebridge Config UI X) running
  • This script was developed with Homebridge Config UI X in version 4.32.0 (2020-11-06), Homebridge at version 1.1.6 and Scriptable app in version 1.6.1 on iOS 14.2. Maybe you need to update the UI-service OR Homebridge OR the Scriptable app OR your iPhone if this script does not work for you
  • also thanks to github user kevinkub for providing a line chart example at https://gist.github.com/kevinkub/b74f9c16f050576ae760a7730c19b8e2

How to use (3 setup possibilities)

  • the best way (updatable, supporting the install script from https://scriptdu.de (very recommended)):

    • the script has a configuration mechanism that saves all configurations (in the Configuration class) to iCloud persistently
    • this means the configuration you make can be reused once you install a newer version of this script
    • following variables exist in the configuration:
    • three variables controll this mechanism:
      • configurationFileName = 'purple.json' // change this to an own name e.g. 'configBlack.json' . This name can then be given as a widget parameter in the form 'USE_CONFIG:yourfilename.json' so you don't loose your preferred configuration across script updates (but you will loose it if i have to change the configuration format)
      • usePersistedConfiguration = true; // false would mean to use the visible configuration below; true means the state saved in iCloud (or locally) will be used
      • overwritePersistedConfig = false; // if you like your configuration, run the script ONCE with this param to true, then it is saved and can be used via 'USE_CONFIG:yourfilename.json' in widget params
    • so basically what you need to do is:
      • choose a configurationFileName (must end with '.json')
      • set overwritePersistedConfig to true
      • configure every configuration-variable exactly as you want (including the CREDENTIALS and the URL!)
      • run the script once (this creates a json file in icloud, you can always delete it to start from scratch)
      • set overwritePersistedConfig to false
      • set the widget up with a single parameter in the format 'USE_CONFIG:yourfilename.json'
    • as long as overwritePersistedConfig is false, any change to the config won't take any effect because the persisted one is used if usePersistedConfiguration is true
  • another updatable way (but configuration is lost):

    • set the widget up with parameter in the format <username>,,<password>,,<hbServiceMachineBaseUrl>
    • a valid real example: "admin,,mypassword123,,http://192.168.178.33:8581"
    • if you have authentication set to non in UI-X then just provide any char. Valid would be e.g. "x,,x,,http://192.168.178.33:8581"
    • maybe you need to set usePersistedConfiguration in the config to false to use this older way
    • screenshot of an example when setting it up:
  • hard coded way in the script (not recommended): you need to configure

    • the URL of the system running the Homebridge Config UI X (the hb-service), including the port e.g. http://192.168.178.33:8581
    • username of the administrator of the homebridge-config-ui-x instance (not the actual linux user)
    • password of the administrator of the homebridge-config-ui-x instance
    • the residual parameter can be tweaked a bit for your needs
    • e.g. fileManagerMode, must be set to LOCAL if you do not use iCloud Drive. Default is ICLOUD
    • e.g. the systemGuiName, the name of your system running the Homebridge Config UI X (the hb-service)
    • e.g. the timeout could be increased if your system does not respond within 2 second
    • e.g. set the temperatureUnitConfig to 'FAHRENHEIT' to use °F instead of °C
  • if your homebridge-config-ui-x instance is not reached within the specified timeout (currently 2sec) the following screen is shown:

Notifications

  • the widget now can notify you when a status has changed
  • you will get a notification if:
    • your Homebridge stopped running
    • there is an update available for Homebridge
    • there is an update available for one of your plugins
    • there is an update available for node.js
  • disable notifications by setting notificationEnabled to false
  • enable getting notification when any status was red and is now back to green (normal) by setting the variable disableStateBackToNormalNotifications to false
  • edit the variable notificationIntervalInDays to lengthen or shorten the time between getting the same notification (e.g. plugin update available) again
    • 0 means you get a notification every time the script runs (not recommended)
    • 1 means you get each possible notification to a maximum of 1 time per day
    • 0.5 means you get each possible notification to a maximum of 2 times per day
  • Open a notification to reveal the "Show me!" button which takes you directly to Homebridge Config UI X
  • Here are some screenshots:

Ignoring specific plugin or software updates

  • by filling the empty array of the variable pluginsOrSwUpdatesToIgnore with strings, you can now configure to ignore plugins, Homebridge or Node.js during checking for updates
  • succesfully ignored software will not influence the shown status (e.g. ignoring homebridge UTD status will result in showing the green status always even if there is an update available)
    • for ignoring plugins, enter their npm name (e.g. 'homebridge-fritz') as string in the given empty array
    • for ignoring Homebridge enter 'HOMEBRIDGE_UTD' and for Node enter 'NODEJS_UTD' in the empty array
    • a valid example of the variable would be const pluginsOrSwUpdatesToIgnore = ['homebridge-fritz', 'HOMEBRIDGE_UTD', 'NODEJS_UTD'];
    • if you specify something and run the script inside the Scriptable app, you will get a log output to let you know that you ignored something successfully

Special GUI when running the script via Siri shortcut

  • when you set up a shortcut that executes the script, a different GUI is shown
  • the Siri GUI shows a simple list of available updates so you can check now which of the software have an update
  • also i coded in to let siri speak an answer. This can be disabled by setting the according property in the configuration.
  • this is what it looks like:

Support for iOS 16 lock screen widgets

  • you can configure the widget to show on iOS 16's lock screen
  • there is nothing to do additionally, the configuration is just as before
  • there is only support for the widget that takes up 2 of the 4 slots
  • this is what it looks like:

Styling

  • all things shown below are saved in the configuration file and can be reused in the future after the script logic updates
  • all important texts can be changed to your own texts
    • if you change the top right texts you probably need to adapt the spacing (play around with the variables spacer_beforeFirstStatusColumn, etc and also with spaces in the text)
  • at the top of the script there is a variable bgColorMode that you can set to 'PURPLE_LIGHT', 'PURPLE_DARK', 'BLACK_LIGHT', BLACK_DARK', or 'CUSTOM'
  • in CUSTOM mode the values defined in customBackgroundColor1_light, customBackgroundColor2_light, customBackgroundColor1_dark and customBackgroundColor2_dark are used (you can choose!)
  • adaptToLightOrDarkMode toggles to react to light/dark mode automatically
    • if you use adaptToLightOrDarkMode with mode CUSTOM then customBackgroundColor1_light and customBackgroundColor2_light together are used in the light version and of course customBackgroundColor1_dark and customBackgroundColor2_dark in the dark version
  • fontColor_light and fontColor_dark sets all texts to your chosen color (default is fontColor_light). Works together with adaptToLightOrDarkMode
  • chartColor_light and chartColor_dark controls which color the charts have (default is chartColor_light). Works together with adaptToLightOrDarkMode
  • you even can experiment with logoUrl and choose another logo to download from anywhere
  • you can change the SFSymbols used together with their color (the icons) and the emojis failIcon = ❌ and bulletPointIcon = 🔸 by providing any other emoji

Infos shown in the widget

  • if Homebridge is running
  • if Homebridge is up to date
  • if all of the installed plugins (including Homebridge Config UI X) are up to date
  • if node.js is up to date
  • CPU load
  • CPU temperature
  • RAM usage
  • Uptime for the system the hb-service is running on
  • Uptime for the hb-service (Homebridge Config UI X)

Troubleshoot

  • if the temperature is not shown for you, then the information is not available on your machine
  • triple check the credentials (2FA currently not supported)
  • consider increasing the requestTimeoutInterval variable
  • if some error occurs always check that you have the matching versions
    • the Scriptable app 1.6.1
    • Homebridge Config UI X 4.32.0 (2020-11-06)
    • Homebridge 1.1.6
    • iOS 14.2
  • if your Homebridge Config UI X is reachable and the authentication process succeeded but the further API requests take to long or fail you will get a screen similar to
  • open a github issue if you can't figure it out what the problem is

homebridgestatuswidget's People

Contributors

lwitzani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridgestatuswidget's Issues

Update intervals

Hi,

Is there a way to specify how frequent the widget will be updated?

Thanks!

UI-Service not reachable

I copied and pasted the code into Scriptable, I putted my IP address, the user and password, when I run the script I get that message

Homebridge Config UI with self signed certs

Hello

I am using self signed certs Homebridge config UI.
To install this script I am hardcoding the values in script.
If I disable https on Homebridge config UI the script works, but with https enabled I am getting UI-Service not reachable error.

How can I make this script work with self signed certs on Homebridge config UI?

TypeError

getting TypeError: undefined is not a function (near '...plugin of pluginsData...')

Homebridge is running on a MacMini (Catalina), everything up to date, just config-ui-x v.4.33.0 and Laundrify Plugin installed at the moment

Homebridge installed on Docker

I moved the Homebridge from RPI to Synology Docker.
I changed the IP but it still shows the old IP in widget. I dont know where it gets the old one. In the script its just once...

Is it at least working with Docker ? Homebridge UI is active, but I am not really sure about the required service.

Thanks !

Feature Request: Notification if UI-Service not reachable.

I travel outside of my home's wifi network frequently and sometimes I forget to turn on my iPhone's VPN service thus making the Homebridge UI unreachable from my iPhone's Safari web browser.

When I do turn it on I have a seperate Safari bookmark, having my VPN's assigned IP in the URL, allowing me to reach the Homebridge UI.

I've currently created two versions of your script, one for home, one for away from home each having the appropriate IP address and "widgetTitle"s.

Using the two scripts I've created two widgets.

Currently, if my iPhone's VPN service is off, the away from home widget displays "X UI-Service not reachable!" reminding me to turn on my VPN if I'm actually away from home.

It would be great if the script could perform a notification when it encounters a "UI-Service not reachable" condition and have this notification be a true/false configuration option. Typically, real world, the user choosing to receive it would receive the notification long before they would swipe their iPhone to view the widget itself.

Same network

unfortunately it doesn't work for me.
your widget also works if the raspbery is connected via ethernet?
or is it because I have HB version 1.2.3.

Exception Occured. Only on iPhone, iPad ist running without problems.

Hey, got an issue on my iPhone 12 Pro with iOS 14.2.1. On my iPad the same Scriptabel script is running without any error.
When I start the Script on my iPhone I got the following error:

Exception Occured
Error on line 582:22: TypeError: null is not an object (evaluating ´CONFIGURATION.hbServiceMachine-BaseURL`)

The version of the Script is from 2 days ago, so the actual version. The scripts in the Scriptable App are synced over iCloud, so there is the same version on both devices. Can`t figure out, where the problem is.

hbLogo.png in iCloud not downloaded causing error?

Hi there! Awesome widget!!

Just having a problem in the last hours, here's the log:

2020-11-26 13:02:34: hbLogo.png is stored in iCloud but the file have not been downloaded. Use downloadFileFromiCloud(filePath) on a FileManager to download the file before accessing it.
2020-11-26 13:02:34: Error on line 252:42: Expected value of type Image but got value of type null.

If someone has time to check in this, if not I'll try myself <3

Update

Hi!

First of all thanks for your work, it is amazing!

I have a problem, the widget not update itself, only when I run the scipt again.

Not working now

Hi.
yesterday I updated my docker container to latest version.

Now I get this error message, and thats the only thing I get

2022-03-20 12:25:27: Error on line 337:16: TypeError: undefined is not a function (near '...plugin of pluginsData...')

Any advices?

Widget not working /executed any more under iOS 16(.3?)

Hi, I just upgraded to iOS 16.3 but Homebridge Status is not working any more on home screens, it just remains empty:

If I run it from the Scriptable App it works. And also, all other Scriptable Widgets still work, well, except another one which also stays empty ... but the majority still work.

Do you know about such a behavior ?
It's the same for for the tiny HB widget ...

Exception Line 337:16 TypeError

I am getting the following error when the script is checking wehter the plugins are up to date:

Exception Occurred:
Error on line 337:16: TypeError:
undefined is not a function (near
'....plugin of pluginsData....')

Any idea why this might be or ehat this actually means?

thanks

NB:
Its having trouble with this code somewhere:

Auto-select LAN or WAN

Hi!! And thanks for this fantastic plugin!

You could put two variables, one as a local network, i.e: 192.168.1.20 and another as DDNS such as the No-IP services, and so if the first address fails, try the second, and if not, it returns that the host is unreachable.

At the moment, in order not to modify anything, I have duplicate script with both directions, but if it were possible in the same one, having both would be ideal!

thank you!!

[Enhancement] more widget parameter

@lwitzani First of all thanks for this awesome script and your great work sharing with us all.

Is there a chance to have more widget parameter in the near future not only user,,password,,ip ?

I have four homebridge running and now using the widget four times.
Always changing systemGuiName = 'Raspberry Pi' to
'HB Pi 3'
'HB Pi 3 2nd'
'HB macOS'
'HB NAS DS920+'

Also I always change bgColorMode = 'PURPLE' to 'BLUE_TO_RED'

It would be very helpful to have this parameters also permanent set.

example: "admin,,mypassword123,,http://192.168.178.33:8581,,HB Pi 3,,BLUE_TO_RED"

Thanks in advance for the consideration.

ERROR

Hello, I can't get the widget to work although I entered everything correctly.

Can it be that the widget does not work with Homebridge Vers. 1.2.3 and Homebridge UI 4.33.0?

thx

Use with not admin iser

Hello,
It would be better if we could use the script with a non-admin user for security reasons.

Widget HOOBS

Bonjour, widget très intéressant, est-il possible d'avoir la même chose pour HOOBS en modifiant le script ?

Je vous avoue ne pas savoir coder d'où ma demande...

Error: Request timeout.

I had to set up my Homebridge from scratch. Everything's working but the widget. Also set up the Scriptable widget and configured starting from zero. I unfortunately always get an error message showing that the request runs into a timeout. Tried different variants iCloud or local, added a new admin user, checked IP/port - so far I was not lucky. You have an idea?

multiple instances cross notifi about update

I have 2 homebridge instances running, one where I'm currently waiting to update node.js because I wanted to display the error I'm getting, when one of the scriptable discover a new version of node.js the notification comes about an available update, one the next with the updated node.js refreshes it sees it as if the first instance was updated :)

SSL connection

Hi,

is a connection via SSL supposed to work? I use homebridge-config-ui-x with a self-signed certificate but I'm not able to connect.

X UI-Service not reachable!

  • Server started? Yes
  • UI-Service process started? Yes
  • Server-URL https://homepi.lan:8088 correct? Yes, can be opened in Safari
  • Are you in the same network? Not me, but my iPhone is. :-D
  • Did you doublecheck you configuration? Yes, 11 times.

Any idea?

Scriptable iOS 16 Homescreen widget

Hi there,

I'm using the Widget every day. Great work!

Are there any plans for an update that the widget fits to a Home Screen widget? The scriptable app was just updated to allow widget as Home Screen widget.

Thanks!

Exception on launch

Hi there!

Triple-checked all info, but get the following on launch:

29258EF0-25A4-435C-92B7-AC7C75970540

Thoughts?

inital run fails with Error on line 671:16: TypeError:

Hi,

I get the following error here whilst running the inital setup:
Error on line 671:16: TypeError: undefined is not a function (near '...plugin of pluginsData...')

what I am doing wrong ? :-)

many thanks in advance,
Rob

Not working anymore

I’m not sure what has happened but I haven’t gotten it to work again for the last month

UI-Service not reachable!

Good afternoon,

I have been following all instructions, created the script, but appears to me the message UI-service not reachable. See Pic attached, also appear a in Log configuration iphoneconfig.json has been loaded and is used! but I can't see anything in the widget.

How can I fix it?
IMG_9C7E7F570A5A-1
IMG_7E88B59EE0C9-1

Is the widget working only when connected to the same network?

Hello, good morning, As I wrote yesterday UI-Service not reachable! #18, the widget finally was working good, this morning as well, but when I left home and get into the the office wifi, the widget is not reporting any more, I have it connected to the cloud.

Is it supported or I have to be in the same net to get the information?

Thnak you

purple.json is not being created

Hi ,

I have removed and downloaded the script via ScriptDude again.
However, there is no default JSON file "purple.json" is not created by default, can I download a template somewhere?

thx

help on installation

Hi, I readed all readme but I don't understand in which way I can install and configure it, someone can help me?

2FA setup

I have 2FA setup on my homebridge so it’s not connecting. Is there a parameter / setting to allow the script to work with 2FA?

help dev Hoobs Widget

I thought why not create a widget like this for hoobs. Problem the api request returns me a null in data. I don't understand can you enlighten me?

async function fetchData() {
let req = new Request('http://hoobs.local/api/system/cpu');
let headers = {
'accept': '/', 'Content-Type': 'application/json',
'Authorization': token
};
req.headers = headers;
let result;
try {
result = req.loadJSON();
console.log(req)
} catch (e) {
return undefined;
}
return result;
}

reponse :

,"timeoutInterval":60,"response":null,"allowInsecureRequest":false}

IOS 16.1 error

FYI Home script has stopped working on the latest iOs16.1 beta. It was fine on ios16 but the .1 has broken it

Error on line 252:42.

I have a problem... Error on line 252:42.

I copy code from homebridgeStatusWidget.js to scriptable, then I change only configurationFileName, username, password and URL.

IMG_6752

[Enhancement] custom notifications

Is it possible to add the status notifications to the configuration mechanism and save the „custom“ notifications to the JSON file for easy restore or update.

'Homebridge Status changed:'
'Your Homebridge instance stopped 😱'
'Your Homebridge instance is back online 😁'
'Update available for Homebridge 😎'
'Homebridge is now up to date ✌️'
'Update available for one of your Plugins 😎'
'Plugins are now up to date ✌️'
'Update available for Node.js 😎'
'Node.js is now up to date ✌️'

This would make it more easy to change text or language for custom notifications.

Thanks

Username and password hb-service

Hello 👋
I want to create the widget but I don’t know what is the username and password of hb-service, I tryed the username and password of the Raspberry Pi and of homebridge but it don’t work, can you help me please ?
Thanks

Error

Hi

I have this error on my iPad.
5036BCA5-E281-41FA-982E-3CEF7335C9C2

On my iPhone run thia script without problems.

Thanks
Marc

Widget saying credentials not correct when they are??

I have been trying to use the first method u mentioned but that didn't work, it says config file with provided name doesn't exist.
When I use the Seine method it says my credentials are incorrect even though they are correct

SytaxError on line 573

Hi,

since a few days I got an error :
2020-11-30 08:37:18: Error on line 573: SyntaxError: Unexpected token '{'. Expected ')' to end an 'if' condition.
As far as I can check the code everything is fine and unchanged.

this are the lines:
function useCredentialsFromWidgetParameter(givenParameter) {
if (givenParameter.includes(',,')) {
let credentials = givenParameter.split(',,');
if (credentials.length === 3 && credentials[0].length > 0 && credentials[1].length > 0 &&
credentials[2].length > 0 && credentials[2].startsWith('http')) {
CONFIGURATION.userName = credentials[0].trim();
CONFIGURATION.password = credentials[1].trim();
CONFIGURATION.hbServiceMachineBaseUrl = credentials[2].trim();
return true;
}
}
return false;
}

my credentials are OK and proved.
BTW: the IP Adress was changed by my router, so I checked the IP-Adress, which is fine.

Thanks for you support and Thanks for that beautiful script!
Kind Regards Thomas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.