I’m struggling with the handling of charts to show the power consumption over a day. For this purpose I want to use my Shellys. I’ve defined some groups for that and each matching shelly item contains a reference to the specific group.
But: The resulting chart does not show the trend of the aggregated value; it shows the trend for each shelly item. Now I’ve multiple series in the chart, but my idea was to have only one series (by the group).
I’ve tried the alternative way via virtual resp. proxy item, which should be updated via rule based on the group item. But that didn’t work. Therefore I’ve to change to another type of charts or to use another workaround - or to skip it. Maybe I simply use that chart only for habpanel (on usual monitor/tablet); the sitemap chart (with all the series) is too small for smartphone.
Yes. Because I did not get it running, I’ve removed this workaround from my files (without committing them into my git repo). But: It was solved like that:
Added a virtual item virtual_gPowerInWattsSumShelly1PM as proxy for the group gPowerInWattsSumShelly1PM
Added a new rule file with a rule to react on changes/updates on gPowerInWattsSumShelly1PM. The rule code copies the value from gPowerInWattsSumShelly1PM to virtual_gPowerInWattsSumShelly1PM
Changed the chart item in sitemap to virtual_gPowerInWattsSumShelly1PM
The problem was that nothing happened with that. The log file didn’t contain any errors regarding the changed items, rule and sitemap files.
After that, I’ve added a log entry into that rule. But even this log entry did not occur, i.e. the rule was never called (even when I tap on the light buttons on the wall to trigger value changes). I’ve tried it with a rule for “on update” and “on change” event. But all without success.
Well, if you show us the broken rule there may be some help to be had.
And perhaps your events.log of the Group Item changing that you expected to trigger it.
event.log is empty, but nevertheless it became interesting. I opened openhab.log with an another editor (cause of its size due to another problem). It contains some entries to the point in time where I was working on that:
2022-02-26 19:20:56.297 [INFO ] [enhab.core.model.script.helper.rules] - [helper] Copy value gPowerInWattsSumShelly1PM (Type=GroupItem, BaseType=NumberItem, Members=11, State=69.26, Label=Shelly 1PM (Sum), Category=energy, Groups=[gPowerInWattsSum])
2022-02-26 19:20:56.298 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'helper-2' failed: An error occurred during the script execution: Cannot assign a value in null context. in helper
The first entry is from loginfo in my .rule file. The second one is caused by an error in that file.
I could not recover the origin .rule file, but it was like this:
rule "blabla"
when Item gPowerInWattsSumShelly1PM changed
then
logInfo("...")
virtual_gPowerInWattsSumShelly1PM = gPowerInWattsSumShelly1PM
end
I’ve also tried it with another trigger (“received update” instead of “changed”).
Both items, i.e. virtual_gPowerInWattsSumShelly1PM and gPowerInWattsSumShelly1PM are declared in the corresponding items. files
events.log
If that is not a typo mistake, I would advise sorting the logging out ASAP or you won’t be able to deal with issues.
Alright, let’s see this new try. There’s not much point in showing us a half-remembered rule with several errors. We’re getting to the end of the “twenty questions”.