I have tinkered with the following widget for some time.
The goal was to build a widget that makes the most important values and functions of my Shelly plugs usable and is as easy to use as possible.
Here you can already see a peculiarity. The LEDs of the ShellyPlug are on when xxxLEDoff is OFF. So I had a lot of trouble setting the corresponding toggle element to green when the corresponding element is OFF and red when it is On.
(Green means always on, red means off. So the WiFi LED is off and the power LED is on, at least when the power switch is in use).
Maybe, that you have to translate the item names for other languages then german.
Possibly someone can help me with two issues I need to work on:
-
On Android devices, the toggle element has a small bug. The white circle (the toggle) takes the color of the background (i.e. red or green) when ON. But this is also the case with the default widgets.
-
I am looking for a way to iterate through all the property fields, this would avoid the many repetitions and make the widget more universal.
The usage of the Widget is simple:
Screenshots
Changelog
Version 0.1
- initial release
Version 0.5
- Runtime presentation optimized
- added WiFi
- some cleanup
Resources
uid: ud_shellyplug_grid
tags: []
props:
parameters:
- description: Ăśberschrift (wenn leer, dann wird der Name des Schalters benutzt)
label: Ăśberschrift
name: ueberschrift
required: false
type: TEXT
- context: item
description: Der Schalter (Shelly Plug)
label: Item
name: item
required: true
type: TEXT
parameterGroups: []
timestamp: Dec 8, 2021, 6:19:50 PM
component: oh-list-card
config:
title: '="Zustand von " + ((props.ueberschrift) ? props.ueberschrift : props.item)'
slots:
default:
- component: oh-toggle-item
config:
title: = "In Betrieb"
item: = props.item + "_Betrieb"
color: green
style:
--f7-toggle-inactive-color: "#e64a19"
badgeColor: red
- component: oh-toggle-item
config:
title: ="BetriebsLED aus"
item: = props.item + "_BetriebsLEDaus"
style:
--f7-toggle-active-color: "#e64a19"
--f7-toggle-inactive-color: "#4cd964"
- component: oh-toggle-item
config:
title: ="Wi-Fi LED aus"
item: = props.item + "_StatusLEDaus"
style:
--f7-toggle-active-color: "#e64a19"
--f7-toggle-inactive-color: "#4cd964"
- component: oh-list-item
config:
title: "Gerätetemperatur:"
badge: =items[props.item + "_Geratetemperatur"].state
- component: oh-list-item
config:
title: "Gesamtverbrauch:"
badge: =items[props.item + "_Gesamtverbrauch"].state
- component: oh-list-item
config:
title: "Läuft seit:"
badge: =dayjs().subtract(Number.parseInt(items[props.item + "_Laufzeit"].state), 's' ).format('D.MM.YY HH:mm')
- component: oh-list-item
config:
title: "Leistung:"
badge: =items[props.item + "_Leistung"].state
- component: oh-list-item
config:
title: "Signalstärke:"
badge: =items[props.item + "_Signalstarke"].state
badgeColor: '=(Number.parseInt(items[props.item + "_Signalstarke"].state) < 1 ) ? "red" : ((Number.parseInt(items[props.item + "_Signalstarke"].state) > 2) ? "green" : "yellow")'