Hello Community,
in my environment I have a lot of items organized in groups. The items are Numbers, Number:Temperature or Number:Power etc…
Example for 2 items for “heating”. The measures room temperature lcn_Temp_… and the expected room temperature lcn_SetTe_…
Group gHeizung_Soll "Heizung Soll" <temperature> (EG_Technik) ["Equipment"]
Group gHeizung_Ist "Heizung Ist" <temperature> (EG_Technik) ["Equipment"]
Number lcn_SetTe_OG_Gaeste "Hz Gaeste" <temperature> (OG_Gaeste,gHeizung_Soll) ["Temperature","Setpoint"]
{ channel="lcn:module:bus:S000M220:rvarsetpoint#1",
widget ="oh-stepper-card"[ title="Gaeste", min=16, max=24, step=0.5, icon="oh:temperature" ],
listWidget="oh-stepper-item"[ title="Gaeste", min=16, max=24, step=0.5, icon="oh:temperature" ],
cellWidget="oh-stepper-cell"[ title="Gaeste", min=16, max=24, step=0.5, icon="oh:temperature" ],
autoupdate="false"
}
Number:Temperature lcn_Temp_OG_Gaeste "Hz Gaeste Ist" <temperature> (OG_Gaeste,gHeizung_Ist) ["Temperature","Measurement"]
{ channel="lcn:module:bus:S000M220:variable#2",
stateDescription=" "[ pattern="%.1f °C"]
}
Now I build my simple widget, which has two properties. A title and the name of the group. I will use this widget in different pages as an universal widget.
uid: 0_widget_number
tags: []
props:
parameters:
- description: Small title on top of the card
label: Title
name: title
required: false
type: TEXT
- context: item
description: Which group you will see
label: Group
name: GroupName
required: false
type: TEXT
parameterGroups: []
timestamp: May 13, 2025, 5:42:51 PM
component: f7-card
config:
title: "=props.title ? props.title : ''"
slots:
content:
- component: oh-list-card
slots:
default:
- component: oh-repeater
config:
filter: =(loop.item.type == "Number" && parseFloat(loop.item.state) > 0)
for: item
groupItem: =props.GroupName
sourceType: itemsInGroup
slots:
default:
- component: f7-row
slots:
default:
- component: f7-col
config:
style:
text-align: left
slots:
default:
- component: Label
config:
text: =loop.item.label
- component: f7-col
config:
style:
text-align: right
slots:
default:
- component: Label
config:
text: =loop.item.state
style:
color: |
=loop.item.state < 19 ? 'blue' :
loop.item.state < 21 ? 'green' :
loop.item.state < 23 ? 'orange' : 'black'
background-color: |
=loop.item.state < 19 ? 'lightgreen' :
loop.item.state < 21 ? 'lightblue' :
loop.item.state < 23 ? 'yellow' : 'red'
padding: 1px
My problem is, how to deal with the unit, if an item is e.g. “Number:Temperature”.
Any ideas how to deal with these “unit” ?
Best regards
Rafl