Widgets are a completely different environment from rules. All you have access to from the Item in a widget is the state in various formats (number, displayState, etc.). You do not have access to any of the persistence functions in a widget.
The solution is to do what you have working, use a separate Item and a rule.
And … bonus question. I tried to get PowerFromGrid “and” PowerToGrid" with the same conditions to the same graph. I failed. Any hint? Or do I need to create two charts?
I don’t really do much with charts so will be of limited help here.
And there really isn’t enough information to say what is going on. It’s not clear what Item is being shown and how it’s updated.
I don’t think Charts update dynamically though. If there is a change in the Item’s state that change won’t necessarily be reflrected in the chart until you refresh the chart. That can account for a difference.
Not enough information to say. But I do know you can chart more than one Item on the same chart. Beyond that . We don’t know what you actually tried in enought detail.
I did loaded the chart with some seconds shifted to the Main UI item.
The item got calculated each time the smart-meter get a new value (from or to grid)
Got my chart now with much more trial and error. I already did this before, but it was a bit special. However. This is working now. Except the tool tip. It would be much better if I have both values per day on the same tool tip. This is a minor thing.
config:
chartType: month
label: Power from/to Grid (kWh)
slots:
grid:
- component: oh-chart-grid
config: {}
xAxis:
- component: oh-category-axis
config:
gridIndex: 0
categoryType: month
monthFormat: short
weekdayFormat: short
yAxis:
- component: oh-value-axis
config:
gridIndex: 0
name: kWh
series:
- component: oh-aggregate-series
config:
name: Power from Grid (kWh) 1-0:1.8.0
item: smartmeterEHZM_10180
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: bar
dimension1: date
aggregationFunction: diff_last
- component: oh-aggregate-series
config:
name: Power to Grid (kWh) 1-0:2.8.0
item: smartmeterEHZM_10280
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: bar
dimension1: date
aggregationFunction: diff_last
tooltip:
- component: oh-chart-tooltip
config:
confine: true