chkpt

5a949fd · gmorell · 2025-06-24 21:35

4 files +399 -184

Files changed

modified contents/ui/EntityControl.qml
+386 −156
@@ -56,7 +56,7 @@ Item {
56 56
57 57 // Expanded controls layout
58 58 ColumnLayout {
59 − visible: showExpandedControls && hasAdvancedControls
59 + visible: showExpandedControls
60 60 anchors.fill: parent
61 61 spacing: Kirigami.Units.largeSpacing
62 62
@@ -96,163 +96,405 @@ Item {
96 96 }
97 97 }
98 98
99 − // Brightness Control
100 − RowLayout {
101 − visible: supportsBrightness && isOn
99 + // Advanced Light Controls (only for lights with advanced features)
100 + ColumnLayout {
101 + visible: hasAdvancedControls
102 102 Layout.fillWidth: true
103 + spacing: Kirigami.Units.smallSpacing
103 104
104 − Kirigami.Icon {
105 − source: "brightness-low"
106 − Layout.preferredWidth: Kirigami.Units.iconSizes.small
107 − Layout.preferredHeight: Kirigami.Units.iconSizes.small
108 − }
109 −
110 − PlasmaComponents3.Label {
111 − text: "Brightness"
112 − Layout.preferredWidth: Kirigami.Units.gridUnit * 3
113 − }
114 −
115 − QQC2.Slider {
116 − id: expandedBrightnessSlider
105 + // Brightness Control
106 + RowLayout {
107 + visible: supportsBrightness && isOn
117 108 Layout.fillWidth: true
118 − from: 1
119 − to: 100
120 − value: currentBrightness
121 − stepSize: 1
122 109
123 − onMoved: {
124 − var brightnessValue = Math.round(value * 255 / 100)
125 − controlActivated(entityId, "turn_on", { brightness: brightnessValue })
110 + Kirigami.Icon {
111 + source: "brightness-low"
112 + Layout.preferredWidth: Kirigami.Units.iconSizes.small
113 + Layout.preferredHeight: Kirigami.Units.iconSizes.small
114 + }
115 +
116 + PlasmaComponents3.Label {
117 + text: "Brightness"
118 + Layout.preferredWidth: Kirigami.Units.gridUnit * 3
119 + }
120 +
121 + QQC2.Slider {
122 + id: expandedBrightnessSlider
123 + Layout.fillWidth: true
124 + from: 1
125 + to: 100
126 + value: currentBrightness
127 + stepSize: 1
128 +
129 + onMoved: {
130 + var brightnessValue = Math.round(value * 255 / 100)
131 + controlActivated(entityId, "turn_on", { brightness: brightnessValue })
132 + }
133 + }
134 +
135 + PlasmaComponents3.Label {
136 + text: currentBrightness + "%"
137 + Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
126 138 }
127 139 }
128 140
129 − PlasmaComponents3.Label {
130 − text: currentBrightness + "%"
131 − Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
132 − }
133 − }
134 −
135 − // Color Temperature Control
136 − RowLayout {
137 − visible: supportsCct && isOn
138 − Layout.fillWidth: true
139 −
140 − Kirigami.Icon {
141 − source: "weather-clear-night"
142 − Layout.preferredWidth: Kirigami.Units.iconSizes.small
143 − Layout.preferredHeight: Kirigami.Units.iconSizes.small
144 − }
145 −
146 − PlasmaComponents3.Label {
147 − text: "Color Temp"
148 − Layout.preferredWidth: Kirigami.Units.gridUnit * 3
149 − }
150 −
151 − QQC2.Slider {
152 − id: expandedColorTempSlider
141 + // Color Temperature Control
142 + RowLayout {
143 + visible: supportsCct && isOn
153 144 Layout.fillWidth: true
154 − from: 153 // ~6500K (cool)
155 − to: 500 // ~2000K (warm)
156 − value: currentColorTemp
157 − stepSize: 1
158 145
159 − onMoved: {
160 − controlActivated(entityId, "turn_on", { color_temp: Math.round(value) })
146 + Kirigami.Icon {
147 + source: "weather-clear-night"
148 + Layout.preferredWidth: Kirigami.Units.iconSizes.small
149 + Layout.preferredHeight: Kirigami.Units.iconSizes.small
150 + }
151 +
152 + PlasmaComponents3.Label {
153 + text: "Color Temp"
154 + Layout.preferredWidth: Kirigami.Units.gridUnit * 3
161 155 }
162 156
163 − background: Rectangle {
164 − x: expandedColorTempSlider.leftPadding
165 − y: expandedColorTempSlider.topPadding + expandedColorTempSlider.availableHeight / 2 - height / 2
166 − implicitWidth: 200
167 − implicitHeight: 8
168 − width: expandedColorTempSlider.availableWidth
169 − height: implicitHeight
170 − radius: 4
157 + QQC2.Slider {
158 + id: expandedColorTempSlider
159 + Layout.fillWidth: true
160 + from: 153 // ~6500K (cool)
161 + to: 500 // ~2000K (warm)
162 + value: currentColorTemp
163 + stepSize: 1
171 164
172 − gradient: Gradient {
173 − orientation: Gradient.Horizontal
174 − GradientStop { position: 0.0; color: "#87CEEB" } // Cool blue
175 − GradientStop { position: 1.0; color: "#FFA500" } // Warm orange
165 + onMoved: {
166 + controlActivated(entityId, "turn_on", { color_temp: Math.round(value) })
176 167 }
177 168
178 − border.color: Kirigami.Theme.separatorColor
179 − border.width: 1
169 + background: Rectangle {
170 + x: expandedColorTempSlider.leftPadding
171 + y: expandedColorTempSlider.topPadding + expandedColorTempSlider.availableHeight / 2 - height / 2
172 + implicitWidth: 200
173 + implicitHeight: 8
174 + width: expandedColorTempSlider.availableWidth
175 + height: implicitHeight
176 + radius: 4
177 +
178 + gradient: Gradient {
179 + orientation: Gradient.Horizontal
180 + GradientStop { position: 0.0; color: "#87CEEB" } // Cool blue
181 + GradientStop { position: 1.0; color: "#FFA500" } // Warm orange
182 + }
183 +
184 + border.color: Kirigami.Theme.separatorColor
185 + border.width: 1
186 + }
187 + }
188 +
189 + PlasmaComponents3.Label {
190 + text: Math.round(1000000 / currentColorTemp) + "K"
191 + Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
180 192 }
181 193 }
182 194
183 − PlasmaComponents3.Label {
184 − text: Math.round(1000000 / currentColorTemp) + "K"
185 − Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
186 − }
187 − }
188 −
189 − // RGB Color Control
190 − ColumnLayout {
191 − visible: supportsRgb && isOn
192 − Layout.fillWidth: true
193 − spacing: Kirigami.Units.smallSpacing
194 −
195 − PlasmaComponents3.Label {
196 − text: "RGB Colors"
197 − font.bold: true
198 − }
199 −
200 − // Color preset buttons
201 − GridLayout {
195 + // RGB Color Control
196 + ColumnLayout {
197 + visible: supportsRgb && isOn
202 198 Layout.fillWidth: true
203 − columns: 7
204 − columnSpacing: Kirigami.Units.smallSpacing
205 − rowSpacing: Kirigami.Units.smallSpacing
199 + spacing: Kirigami.Units.smallSpacing
200 +
201 + PlasmaComponents3.Label {
202 + text: "RGB Colors"
203 + font.bold: true
204 + }
206 205
207 − Repeater {
208 − model: [
209 − { color: "#FF0000", name: "Red" },
210 − { color: "#00FF00", name: "Green" },
211 − { color: "#0000FF", name: "Blue" },
212 − { color: "#FFFF00", name: "Yellow" },
213 − { color: "#FF00FF", name: "Magenta" },
214 − { color: "#00FFFF", name: "Cyan" },
215 − { color: "#FFFFFF", name: "White" }
216 − ]
206 + // Color preset buttons
207 + GridLayout {
208 + Layout.fillWidth: true
209 + columns: 7
210 + columnSpacing: Kirigami.Units.smallSpacing
211 + rowSpacing: Kirigami.Units.smallSpacing
217 212
218 − PlasmaComponents3.Button {
219 − Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
220 − Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
221 −
222 − background: Rectangle {
223 − radius: Kirigami.Units.cornerRadius
224 − color: modelData.color
225 − border.color: Qt.rgba(currentRgbColor[0]/255, currentRgbColor[1]/255, currentRgbColor[2]/255, 1.0) === color ?
226 − Kirigami.Theme.highlightColor : Kirigami.Theme.separatorColor
227 − border.width: Qt.rgba(currentRgbColor[0]/255, currentRgbColor[1]/255, currentRgbColor[2]/255, 1.0) === color ? 3 : 1
228 − }
213 + Repeater {
214 + model: [
215 + { color: "#FF0000", name: "Red" },
216 + { color: "#00FF00", name: "Green" },
217 + { color: "#0000FF", name: "Blue" },
218 + { color: "#FFFF00", name: "Yellow" },
219 + { color: "#FF00FF", name: "Magenta" },
220 + { color: "#00FFFF", name: "Cyan" },
221 + { color: "#FFFFFF", name: "White" }
222 + ]
229 223
230 − PlasmaComponents3.ToolTip {
231 − text: modelData.name
232 − }
233 −
234 − onClicked: {
235 − var rgb = hexToRgb(modelData.color)
236 − controlActivated(entityId, "turn_on", { rgb_color: [rgb.r, rgb.g, rgb.b] })
224 + PlasmaComponents3.Button {
225 + Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5
226 + Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5
227 +
228 + background: Rectangle {
229 + radius: Kirigami.Units.cornerRadius
230 + color: modelData.color
231 + border.color: Qt.rgba(currentRgbColor[0]/255, currentRgbColor[1]/255, currentRgbColor[2]/255, 1.0) === color ?
232 + Kirigami.Theme.highlightColor : Kirigami.Theme.separatorColor
233 + border.width: Qt.rgba(currentRgbColor[0]/255, currentRgbColor[1]/255, currentRgbColor[2]/255, 1.0) === color ? 3 : 1
234 + }
235 +
236 + PlasmaComponents3.ToolTip {
237 + text: modelData.name
238 + }
239 +
240 + onClicked: {
241 + var rgb = hexToRgb(modelData.color)
242 + controlActivated(entityId, "turn_on", { rgb_color: [rgb.r, rgb.g, rgb.b] })
243 + }
237 244 }
238 245 }
239 246 }
247 +
248 + // Current color indicator
249 + Rectangle {
250 + Layout.fillWidth: true
251 + Layout.preferredHeight: Kirigami.Units.gridUnit * 1
252 + radius: Kirigami.Units.cornerRadius
253 + color: Qt.rgba(currentRgbColor[0]/255, currentRgbColor[1]/255, currentRgbColor[2]/255, 1.0)
254 + border.color: Kirigami.Theme.separatorColor
255 + border.width: 1
256 +
257 + PlasmaComponents3.Label {
258 + anchors.centerIn: parent
259 + text: "Current: RGB(" + currentRgbColor[0] + ", " + currentRgbColor[1] + ", " + currentRgbColor[2] + ")"
260 + font.pointSize: Kirigami.Theme.smallFont.pointSize
261 + color: (currentRgbColor[0] + currentRgbColor[1] + currentRgbColor[2]) > 384 ? "black" : "white"
262 + }
263 + }
240 264 }
265 + }
266 +
267 + // Entity Information Section (previously shown in tooltips)
268 + Rectangle {
269 + Layout.fillWidth: true
270 + Layout.preferredHeight: entityInfoColumn.implicitHeight + Kirigami.Units.largeSpacing * 2
271 + color: Kirigami.Theme.alternateBackgroundColor
272 + border.color: Kirigami.Theme.separatorColor
273 + border.width: 1
274 + radius: Kirigami.Units.cornerRadius
241 275
242 − // Current color indicator
243 − Rectangle {
244 − Layout.fillWidth: true
245 − Layout.preferredHeight: Kirigami.Units.gridUnit * 1
246 − radius: Kirigami.Units.cornerRadius
247 − color: Qt.rgba(currentRgbColor[0]/255, currentRgbColor[1]/255, currentRgbColor[2]/255, 1.0)
248 − border.color: Kirigami.Theme.separatorColor
249 − border.width: 1
276 + ColumnLayout {
277 + id: entityInfoColumn
278 + anchors.fill: parent
279 + anchors.margins: Kirigami.Units.largeSpacing
280 + spacing: Kirigami.Units.smallSpacing
250 281
251 282 PlasmaComponents3.Label {
252 − anchors.centerIn: parent
253 − text: "Current: RGB(" + currentRgbColor[0] + ", " + currentRgbColor[1] + ", " + currentRgbColor[2] + ")"
254 − font.pointSize: Kirigami.Theme.smallFont.pointSize
255 − color: (currentRgbColor[0] + currentRgbColor[1] + currentRgbColor[2]) > 384 ? "black" : "white"
283 + text: "Entity Information"
284 + font.bold: true
285 + Layout.fillWidth: true
286 + }
287 +
288 + // Entity ID
289 + RowLayout {
290 + Layout.fillWidth: true
291 + PlasmaComponents3.Label {
292 + text: "Entity ID:"
293 + font.pointSize: Kirigami.Theme.smallFont.pointSize
294 + color: Kirigami.Theme.disabledTextColor
295 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
296 + }
297 + PlasmaComponents3.Label {
298 + text: entityId
299 + font.pointSize: Kirigami.Theme.smallFont.pointSize
300 + Layout.fillWidth: true
301 + wrapMode: Text.WrapAnywhere
302 + }
303 + }
304 +
305 + // Friendly Name (if different from display name)
306 + RowLayout {
307 + visible: entityState && entityState.attributes && entityState.attributes.friendly_name &&
308 + entityState.attributes.friendly_name !== displayName
309 + Layout.fillWidth: true
310 + PlasmaComponents3.Label {
311 + text: "Friendly Name:"
312 + font.pointSize: Kirigami.Theme.smallFont.pointSize
313 + color: Kirigami.Theme.disabledTextColor
314 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
315 + }
316 + PlasmaComponents3.Label {
317 + text: entityState && entityState.attributes ? (entityState.attributes.friendly_name || "") : ""
318 + font.pointSize: Kirigami.Theme.smallFont.pointSize
319 + Layout.fillWidth: true
320 + wrapMode: Text.WordWrap
321 + }
322 + }
323 +
324 + // Current State
325 + RowLayout {
326 + Layout.fillWidth: true
327 + PlasmaComponents3.Label {
328 + text: "State:"
329 + font.pointSize: Kirigami.Theme.smallFont.pointSize
330 + color: Kirigami.Theme.disabledTextColor
331 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
332 + }
333 + PlasmaComponents3.Label {
334 + text: entityState ? (entityState.state || "unknown") : "Unavailable"
335 + font.pointSize: Kirigami.Theme.smallFont.pointSize
336 + Layout.fillWidth: true
337 + color: isOn ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.textColor
338 + }
339 + }
340 +
341 + // Brightness (for lights)
342 + RowLayout {
343 + visible: entityState && entityState.attributes && entityState.attributes.brightness !== undefined
344 + Layout.fillWidth: true
345 + PlasmaComponents3.Label {
346 + text: "Brightness:"
347 + font.pointSize: Kirigami.Theme.smallFont.pointSize
348 + color: Kirigami.Theme.disabledTextColor
349 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
350 + }
351 + PlasmaComponents3.Label {
352 + text: entityState && entityState.attributes && entityState.attributes.brightness ?
353 + (Math.round(entityState.attributes.brightness / 255 * 100) + "%") : ""
354 + font.pointSize: Kirigami.Theme.smallFont.pointSize
355 + Layout.fillWidth: true
356 + }
357 + }
358 +
359 + // RGB Color (for lights)
360 + RowLayout {
361 + visible: entityState && entityState.attributes && entityState.attributes.rgb_color
362 + Layout.fillWidth: true
363 + PlasmaComponents3.Label {
364 + text: "RGB Color:"
365 + font.pointSize: Kirigami.Theme.smallFont.pointSize
366 + color: Kirigami.Theme.disabledTextColor
367 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
368 + }
369 + PlasmaComponents3.Label {
370 + text: entityState && entityState.attributes && entityState.attributes.rgb_color ?
371 + entityState.attributes.rgb_color.join(", ") : ""
372 + font.pointSize: Kirigami.Theme.smallFont.pointSize
373 + Layout.fillWidth: true
374 + }
375 + }
376 +
377 + // Color Temperature (for lights)
378 + RowLayout {
379 + visible: entityState && entityState.attributes && entityState.attributes.color_temp
380 + Layout.fillWidth: true
381 + PlasmaComponents3.Label {
382 + text: "Color Temp:"
383 + font.pointSize: Kirigami.Theme.smallFont.pointSize
384 + color: Kirigami.Theme.disabledTextColor
385 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
386 + }
387 + PlasmaComponents3.Label {
388 + text: entityState && entityState.attributes && entityState.attributes.color_temp ?
389 + (Math.round(1000000 / entityState.attributes.color_temp) + "K") : ""
390 + font.pointSize: Kirigami.Theme.smallFont.pointSize
391 + Layout.fillWidth: true
392 + }
393 + }
394 +
395 + // Supported Color Modes (for lights)
396 + RowLayout {
397 + visible: entityState && entityState.attributes && entityState.attributes.supported_color_modes && isLight
398 + Layout.fillWidth: true
399 + PlasmaComponents3.Label {
400 + text: "Supported:"
401 + font.pointSize: Kirigami.Theme.smallFont.pointSize
402 + color: Kirigami.Theme.disabledTextColor
403 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
404 + }
405 + PlasmaComponents3.Label {
406 + text: entityState && entityState.attributes && entityState.attributes.supported_color_modes ?
407 + entityState.attributes.supported_color_modes.join(", ") : ""
408 + font.pointSize: Kirigami.Theme.smallFont.pointSize
409 + Layout.fillWidth: true
410 + wrapMode: Text.WordWrap
411 + }
412 + }
413 +
414 + // Temperature (for climate/weather entities)
415 + RowLayout {
416 + visible: entityState && entityState.attributes && entityState.attributes.temperature !== undefined
417 + Layout.fillWidth: true
418 + PlasmaComponents3.Label {
419 + text: "Temperature:"
420 + font.pointSize: Kirigami.Theme.smallFont.pointSize
421 + color: Kirigami.Theme.disabledTextColor
422 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
423 + }
424 + PlasmaComponents3.Label {
425 + text: entityState && entityState.attributes && entityState.attributes.temperature !== undefined ?
426 + (entityState.attributes.temperature + "°") : ""
427 + font.pointSize: Kirigami.Theme.smallFont.pointSize
428 + Layout.fillWidth: true
429 + }
430 + }
431 +
432 + // Humidity (for climate/weather entities)
433 + RowLayout {
434 + visible: entityState && entityState.attributes && entityState.attributes.humidity !== undefined
435 + Layout.fillWidth: true
436 + PlasmaComponents3.Label {
437 + text: "Humidity:"
438 + font.pointSize: Kirigami.Theme.smallFont.pointSize
439 + color: Kirigami.Theme.disabledTextColor
440 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
441 + }
442 + PlasmaComponents3.Label {
443 + text: entityState && entityState.attributes && entityState.attributes.humidity !== undefined ?
444 + (entityState.attributes.humidity + "%") : ""
445 + font.pointSize: Kirigami.Theme.smallFont.pointSize
446 + Layout.fillWidth: true
447 + }
448 + }
449 +
450 + // Battery Level (for battery-powered devices)
451 + RowLayout {
452 + visible: entityState && entityState.attributes && entityState.attributes.battery_level !== undefined
453 + Layout.fillWidth: true
454 + PlasmaComponents3.Label {
455 + text: "Battery:"
456 + font.pointSize: Kirigami.Theme.smallFont.pointSize
457 + color: Kirigami.Theme.disabledTextColor
458 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
459 + }
460 + PlasmaComponents3.Label {
461 + text: entityState && entityState.attributes && entityState.attributes.battery_level !== undefined ?
462 + (entityState.attributes.battery_level + "%") : ""
463 + font.pointSize: Kirigami.Theme.smallFont.pointSize
464 + Layout.fillWidth: true
465 + color: {
466 + if (entityState && entityState.attributes && entityState.attributes.battery_level !== undefined) {
467 + var batteryLevel = entityState.attributes.battery_level
468 + if (batteryLevel < 20) return Kirigami.Theme.negativeTextColor
469 + if (batteryLevel < 50) return Kirigami.Theme.neutralTextColor
470 + return Kirigami.Theme.positiveTextColor
471 + }
472 + return Kirigami.Theme.textColor
473 + }
474 + }
475 + }
476 +
477 + // Last Updated
478 + RowLayout {
479 + visible: entityState && entityState.last_updated
480 + Layout.fillWidth: true
481 + PlasmaComponents3.Label {
482 + text: "Last Updated:"
483 + font.pointSize: Kirigami.Theme.smallFont.pointSize
484 + color: Kirigami.Theme.disabledTextColor
485 + Layout.preferredWidth: Kirigami.Units.gridUnit * 4
486 + }
487 + PlasmaComponents3.Label {
488 + text: {
489 + if (entityState && entityState.last_updated) {
490 + var lastUpdated = new Date(entityState.last_updated)
491 + return lastUpdated.toLocaleTimeString()
492 + }
493 + return ""
494 + }
495 + font.pointSize: Kirigami.Theme.smallFont.pointSize
496 + Layout.fillWidth: true
497 + }
256 498 }
257 499 }
258 500 }
@@ -395,39 +637,27 @@ Item {
395 637
396 638 tooltip += "\nState: " + stateText
397 639
398 − // Add additional info for specific entity types
640 + // Only show basic info in tooltip, since full details are in expanded view
399 641 if (entityState.attributes) {
400 − if (entityState.attributes.brightness) {
642 + // Show only the most relevant single piece of info
643 + if (entityState.attributes.brightness && isOn) {
401 644 tooltip += "\nBrightness: " + Math.round(entityState.attributes.brightness / 255 * 100) + "%"
402 − }
403 − if (entityState.attributes.rgb_color) {
404 − tooltip += "\nRGB: " + entityState.attributes.rgb_color.join(", ")
405 − }
406 − if (entityState.attributes.color_temp) {
407 − tooltip += "\nColor Temp: " + Math.round(1000000 / entityState.attributes.color_temp) + "K"
408 − }
409 − if (entityState.attributes.supported_color_modes && isLight) {
410 − tooltip += "\nSupported: " + entityState.attributes.supported_color_modes.join(", ")
411 − }
412 − if (entityState.attributes.temperature) {
645 + } else if (entityState.attributes.temperature !== undefined) {
413 646 tooltip += "\nTemperature: " + entityState.attributes.temperature + "°"
414 − }
415 − if (entityState.attributes.humidity) {
416 − tooltip += "\nHumidity: " + entityState.attributes.humidity + "%"
417 − }
418 − if (entityState.attributes.battery_level) {
647 + } else if (entityState.attributes.battery_level !== undefined) {
419 648 tooltip += "\nBattery: " + entityState.attributes.battery_level + "%"
420 649 }
421 − // Add last updated time
422 − if (entityState.last_updated) {
423 − var lastUpdated = new Date(entityState.last_updated)
424 − tooltip += "\nLast updated: " + lastUpdated.toLocaleTimeString()
425 − }
426 650 }
427 651
428 − // Add instruction for light controls - only show if not in expanded mode
429 − if (isLight && controlType === "light" && (supportsRgb || supportsCct || supportsBrightness) && !showExpandedControls) {
430 − tooltip += "\n\nAdvanced controls available in expanded view"
652 + // Add instruction for expanded view
653 + if (showExpandedControls) {
654 + tooltip += "\n\nDetailed information shown below"
655 + } else {
656 + if (isLight && controlType === "light" && (supportsRgb || supportsCct || supportsBrightness)) {
657 + tooltip += "\n\nRight-click for advanced controls & details"
658 + } else {
659 + tooltip += "\n\nRight-click for detailed information"
660 + }
431 661 }
432 662
433 663 return tooltip
modified contents/ui/main.qml
+13 −28
@@ -330,33 +330,23 @@ PlasmoidItem {
330 330
331 331 tooltip += "\nState: " + stateText
332 332
333 − // Add additional info for specific entity types
333 + // Only show basic info in tooltip, since full details are in expanded view
334 334 if (entityState.attributes) {
335 − if (entityState.attributes.brightness) {
335 + // Show only the most relevant single piece of info
336 + if (entityState.attributes.brightness && (entityState.state === "on")) {
336 337 tooltip += "\nBrightness: " + Math.round(entityState.attributes.brightness / 255 * 100) + "%"
337 − }
338 − if (entityState.attributes.rgb_color) {
339 − tooltip += "\nRGB: " + entityState.attributes.rgb_color.join(", ")
340 − }
341 − if (entityState.attributes.color_temp) {
342 − tooltip += "\nColor Temp: " + Math.round(1000000 / entityState.attributes.color_temp) + "K"
343 − }
344 − if (entityState.attributes.temperature) {
338 + } else if (entityState.attributes.temperature !== undefined) {
345 339 tooltip += "\nTemperature: " + entityState.attributes.temperature + "°"
346 − }
347 − if (entityState.attributes.humidity) {
348 − tooltip += "\nHumidity: " + entityState.attributes.humidity + "%"
349 − }
350 − if (entityState.attributes.battery_level) {
340 + } else if (entityState.attributes.battery_level !== undefined) {
351 341 tooltip += "\nBattery: " + entityState.attributes.battery_level + "%"
352 342 }
353 343 }
354 344
355 − // Add instruction for advanced controls
345 + // Add instruction for expanded view
356 346 if (hasAdvancedControls) {
357 − tooltip += "\n\nRight-click for advanced controls"
347 + tooltip += "\n\nRight-click for advanced controls & details"
358 348 } else {
359 − tooltip += "\n\nRight-click for details"
349 + tooltip += "\n\nRight-click for detailed information"
360 350 }
361 351
362 352 return tooltip
@@ -507,20 +497,15 @@ PlasmoidItem {
507 497 handlePanelEntityClick(entityId, controlType, isOn)
508 498 }
509 499
510 − // Right-click to show advanced controls popup for lights or expanded view
500 + // Right-click to show expanded view with entity details
511 501 MouseArea {
512 502 anchors.fill: parent
513 503 acceptedButtons: Qt.RightButton
514 504 onClicked: {
515 − if (hasAdvancedControls) {
516 − // Store the current entity for the popup
517 − root.expandedEntityId = entityId
518 − root.expandedEntityData = modelData
519 − root.expanded = true
520 − } else {
521 − // For non-light entities, show expanded view
522 − root.expanded = !root.expanded
523 − }
505 + // Store the current entity for the popup
506 + root.expandedEntityId = entityId
507 + root.expandedEntityData = modelData
508 + root.expanded = true
524 509 }
525 510 }
526 511

Parents: 608d4a9