I am building a widget that shows the temperature and humidity in a chart.
I also wanted to add the state(open/closed) of a window into it.
Everything worked fine till I wanted to add the window sensor item via props. The item don’t get resolved.
See line 110 in the example below. Calling the item directly by its name does the job, configuring it in props not.
I tried =props.window_item and =items[props.window_item].
yaml
uid: chart
tags: []
props:
parameters:
- context: item
description: Temperature Item shown in chart
label: Temperature Item
name: temperature_item
required: true
type: TEXT
groupName: chartItems
- context: item
description: Humidity Item shown in chart
label: Humidity Item
name: humidity_item
required: true
type: TEXT
groupName: chartItems
- context: item
description: Window Sensor Item shown in chart
label: Window Item
name: window_item
required: false
type: TEXT
groupName: chartItems
- description: Room name
label: Room name
name: roomName
required: true
type: TEXT
groupName: general
parameterGroups:
- name: general
label: General settings
description: Most important widget settings
- name: chartItems
label: Items on chart
description: Items on chart
timestamp: Jun 2, 2021, 10:37:42 AM
component: f7-card
config: {}
slots:
default:
- component: oh-chart
config:
label: =props.roomName
periodVisible: false
slots:
grid:
- component: oh-chart-grid
config:
show: true
left: 50
right: 50
xAxis:
- component: oh-time-axis
config:
gridIndex: 0
yAxis:
- component: oh-value-axis
config:
gridIndex: 0
name: Temperatur
min: 17
max: 30
axisLabel:
formatter: "{value} °C"
- component: oh-value-axis
config:
gridIndex: 0
name: Luftfeuchtigkeit
min: 30
max: 100
axisLabel:
formatter: "{value} %"
series:
- component: oh-time-series
config:
name: Temperatur
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
item: =props.temperature_item
smooth: true
color: green
- component: oh-time-series
config:
name: Luftfeuchtigkeit
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 1
type: line
item: =props.humidity_item
smooth: true
color: blue
- component: oh-time-series
config:
name: Fenster
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
color: red
slots:
markArea:
- component: oh-mark-area
config:
name: Fenster
item: =props.window_item #Fenster_Sensor_Wohnzimmer_Rechts
legend:
- component: oh-chart-legend
config:
show: true
tooltip:
- component: oh-chart-tooltip
config:
show: true
dataZoom:
- component: oh-chart-datazoom
config:
show: true
type: slider
orient: horizontal
start: 50
end: 100
xAxisIndex:
- 0
- 1