Skip to content

Commit b3966fc

Browse files
authored
Merge pull request #734 from h2bagel/hassio-control-center-widget
2 parents 22899f8 + a451108 commit b3966fc

3 files changed

Lines changed: 81 additions & 4 deletions

File tree

hassio/ControlCenterWidget.qml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import QtQuick
2+
import Quickshell
3+
import qs.Commons
4+
import qs.Widgets
5+
import qs.Services.UI
6+
7+
NIconButtonHot {
8+
id: root
9+
10+
property ShellScreen screen
11+
property var pluginApi: null
12+
property var main: pluginApi?.mainInstance ?? null
13+
14+
readonly property string status: {
15+
if (!main || main.haToken === "")
16+
return "Unconfigured";
17+
if (main.authFailed)
18+
return "AuthFailed";
19+
if (main.authenticated)
20+
return "Connected";
21+
if (main.isReconnecting)
22+
return "Disconnected";
23+
return "Connecting";
24+
}
25+
26+
icon: "smart-home"
27+
colorFg: {
28+
switch (status) {
29+
case "Connected": return Color.mPrimary;
30+
case "Connecting": return Color.mOnError;
31+
case "Disconnected": return Color.mError;
32+
case "AuthFailed": return Color.mError;
33+
default: return Color.mOnSurfaceVariant;
34+
}
35+
}
36+
37+
tooltipText: {
38+
switch (status) {
39+
case "Connected": return pluginApi?.tr("widget.status_connected");
40+
case "Connecting": return pluginApi?.tr("widget.status_connecting");
41+
case "Disconnected": return pluginApi?.tr("widget.status_disconnected");
42+
case "AuthFailed": return pluginApi?.tr("widget.status_auth_failed");
43+
default: return pluginApi?.tr("widget.status_unconfigured");
44+
}
45+
}
46+
47+
onClicked: {
48+
if (pluginApi)
49+
pluginApi.togglePanel(screen);
50+
}
51+
52+
onRightClicked: {
53+
if (pluginApi && pluginApi.manifest)
54+
BarService.openPluginSettings(screen, pluginApi.manifest);
55+
}
56+
57+
SequentialAnimation on opacity {
58+
running: status === "Connecting"
59+
loops: Animation.Infinite
60+
61+
NumberAnimation { to: 0.4; duration: 600; easing.type: Easing.InOutSine }
62+
NumberAnimation { to: 1.0; duration: 600; easing.type: Easing.InOutSine }
63+
}
64+
}

hassio/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ Click the 🏠 icon in the bar to open the panel. The icon color reflects the co
8585
| Pulsing | Connecting / authenticating |
8686
| Error (red) | Disconnected |
8787

88+
### Control Center Widget
89+
90+
Click the 🏠 icon in the control center to open the panel. The icon color reflects the connection state:
91+
92+
| Color | Meaning |
93+
|-------|---------|
94+
| Primary (accent) | Connected and authenticated |
95+
| Pulsing | Connecting / authenticating |
96+
| Error (red) | Disconnected |
97+
98+
8899
### Panel - Entity List
89100

90101
Shows your pinned entities. Each entity row displays:
@@ -116,6 +127,7 @@ hassio/
116127
├── manifest.json # Plugin metadata
117128
├── Main.qml # WebSocket service, entity state, reconnect logic
118129
├── BarWidget.qml # Bar icon with connection status
130+
├── ControlCenterWidget.qml # Controlcenter Icon with connection status
119131
├── Panel.qml # Main panel - entity list and browser switcher
120132
├── BrowserView.qml # Entity browser with search and pin controls
121133
├── Settings.qml # URL and token configuration
@@ -169,4 +181,4 @@ MIT
169181

170182
## Author
171183

172-
**Pozzoo** - [github.com/Pozzoo](https://github.com/Pozzoo)
184+
**Pozzoo** - [github.com/Pozzoo](https://github.com/Pozzoo)

hassio/manifest.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "hassio",
33
"name": "Home Assistant",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"minNoctaliaVersion": "3.6.0",
66
"author": "Pozzoo",
77
"license": "MIT",
@@ -12,7 +12,8 @@
1212
"main": "Main.qml",
1313
"barWidget": "BarWidget.qml",
1414
"panel": "Panel.qml",
15-
"settings": "Settings.qml"
15+
"settings": "Settings.qml",
16+
"controlCenterWidget": "ControlCenterWidget.qml"
1617
},
1718
"dependencies": {
1819
"plugins": []
@@ -24,4 +25,4 @@
2425
"entities": []
2526
}
2627
}
27-
}
28+
}

0 commit comments

Comments
 (0)