Closed uqs closed 12 months ago
As documented at https://openhab.github.io/openhab-jruby/main/OpenHAB/Core/Items/Persistence.html#evolution_rate-instance_method, evolution_rate
takes a timestamp (anything that responds to #to_zoned_date_time), not a duration. I'm assuming you mean rate = PM_G_energy.evolution_rate(1.minute.ago)
to get the evolution rate over the past minute.
Aw, man! Thanks a ton!
I was browsing https://boc-tothefuture.github.io/openhab-jruby/examples/how_do_i/#datetime and especially https://boc-tothefuture.github.io/openhab-jruby/usage/misc/persistence/#persistence and on there sadly an example for this is missing.
It also lists most things as taking a timestamp and it passes both 1.hours
and 2.hours
to things that take either a timestamp or a begin/end.
Can this documentation be improved or maybe the class could catch a duration getting passed in an barf up a more useful exception?
Hi there, I'm not sure which version of jrubyscripting is installed, but I have:
- OpenHab 4.0.3
- /etc/openhab/automation/ruby/.gem/9.4.2.0/gems/openhab-scripting-5.11.0/lib/openhab/rspec/jruby.rb
So this looks like I'm on the latest? The karaf bundle however shows the version as 4.0.3, same as OH.
You're on the latest - 5.11.0 (see the path above). How did you see the library version on the karaf bundle?
The documentation for 5.x library is here: https://openhab.github.io/openhab-jruby/
The documentation in https://boc-tothefuture.github.ui/openhab-jruby/ is for library version 4.x (old version). The persistence methods taking a timestamp instead of a duration is documented in Breaking Changes
section of the 5.0 Changelog
Can this documentation be improved maybe the class could catch a duration getting passed in an barf up a more useful exception?
The openhab core's methods take a timestamp too, so Duration arguments for persistence are only remnants of 4.x library convention, so hopefully this is a one off issue for you.
Hi there, I'm not sure which version of jrubyscripting is installed, but I have:
So this looks like I'm on the latest? The karaf bundle however shows the version as 4.0.3, same as OH.
Anyway, I'm trying to use persistence to derive the power draw, based on the energy readings of a power meters, but no matter what I pass in, I get an error about undefined methods.
Other ruby rules are working fine, though this is the first time I'm doing anything with time units.