The Shelly H&T is a relatively inexpensive small sensor that provides temperature (_Temperatur) and humidity (_Luftfeuchtigkeit) via WLAN. However, it only reports when there is a change in its values, so it makes sense to also consider the time of the last update (_LetzteAktualisierung - the stateDescription Metadata is: %1$tA, %1$td.%1$tm.%1$ty %1$tH:%1$tM).
If you click on the card (see first screenshot), the following diagram will open
Screenshots
Changelog
Version 0.1
- initial release
Resources
uid: ud_shellyht_card
tags: []
props:
parameters:
- description: Überschrift (wenn leer, dann wird der Name des Gerätes benutzt)
label: Ăśberschrift
name: ueberschrift
required: false
type: TEXT
- context: item
description: Das Gerät (ShellyHT)
label: Item
name: item
required: true
type: TEXT
filterCriteria:
- name: type
value: Group
parameterGroups: []
timestamp: Jan 5, 2022, 2:02:55 PM
component: oh-label-cell
config:
header: "=(props.ueberschrift) ? props.ueberschrift : props.item"
label: = "Temperatur " + items[props.item + "_Temperatur"].state
trendItem: = props.item +"_Temperatur"
action: analyzer
actionAnalyzerItems: =[props.item +"_Luftfeuchtigkeit", props.item +"_Temperatur"]
icon: oh:temperature
footer: = 'Letzte Aktualisierung ' + items[props.item + "_LetzteAktualisierung"].displayState
subtitle: = "Luftfeuchtigkeit " + items[props.item + "_Luftfeuchtigkeit"].state
expandable: false
style:
background: '=(items[props.item + "_Luftfeuchtigkeit"].state.split(" ")[0] > 60) ? "red" : "lightblue"'
A few explanations about the code (even though no line numbers are shown here):
- The first 15 lines mainly define the configuration settings. An item must be selected and a heading (ueberschrift) can be set.
- With the lines 16 to 18 I actually want to achieve that only groups (so mainly equipment) can be selected. Unfortunately this does not work.
- In line 23 it is specified that the entered ueberschrift is used as header, or if none was specified, the item name.
- In line 24 the temperature output is generated, as main information. (I don’t understand why I can’t write “Temperature:” there, the colon is criticized).
- Line 25 creates the blue temperature curve in the background
- Line 26 and 27 configure the effect when clicking the card. Behind actionAnalyserItems an array is expected, see the square brackets. Therefore, multiple items are possible
- The next lines are quite common, again I must not put a colon in my text.
- With the lines 32 and 33 I achieve that at a humidity of more than 60% the background becomes red. To be able to compare the numbers, the unit (%) must be removed from the humidity, hence the split function.