YinYang
(Andreas)
November 26, 2020, 6:43am
1
Hi,
In my OpenHab project I am using the action “getElevation” to get the sun position in 30 minutes.
This is the code extract so far:
import java.time.ZonedDateTime
[...]
val sunActions = getActions("astro", "astro:sun:home")
var timeIn30Minutes = ZonedDateTime.now.plusMinutes(30)
var elevation_30min = sunActions.getElevation(timeIn30Minutes)
[...]
This seems to work but in the log viewer I get the following error message:
The method getElevation(ThingActions, ZonedDateTime) from the type AstroActions refers to the missing type Object
Does anybody has an idea what could be wrong and how to solve it?
Thank you!
Andreas
Just a quick look but I think the line starting with val should be var.
YinYang
(Andreas)
November 26, 2020, 11:05am
3
Hi Bruce,
I’ve replaces val by var but warning still occurs.
Best regards,
Andreas
DaToBi-89
(Tobias)
November 27, 2020, 11:47am
6
Seems like the same issue for the getAzimuth as i psoted here:
Hello Community,
i’m playing with the Astro Binding and i want to use the getAzimuth(timeStamp) as described here:
Astro Binding
when doing so, I´m getting the Info in the Log and Visual Studio Code shows an Error, but it is working as intended and I’m getting the correct value.
16:34:16.758 [INFO ] [del.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'astro.rules', using it anyway:
The method getAzimuth(ThingActions, ZonedDateTime) from the type AstroActi…
YinYang
(Andreas)
November 28, 2020, 8:09pm
7
Seems so. Do you have any solution available?
DaToBi-89
(Tobias)
November 30, 2020, 6:47pm
8
I played with the QuantityType<T> in rules and i think the <Angle> is the Problem.
If i create an QuantityType<Number> in a rule, it is working, for example:
val QuantityType<Number> test1 = new QuantityType("5")
But when i try to create a QuantityType<Angle> i get an error:
val QuantityType<Angle> test2 = new QuantityType("5")
Angle cannot be resolved to a type.(org.eclipse.xtext.diagnostics.Diagnostic.Linking)
The getElevation(timestamp) function in the AstroActions.java is defined as a QuantityType<Angle> which is causing the warning
public static @Nullable QuantityType<Angle> getElevation(ThingActions actions, @Nullable ZonedDateTime date) {
return ((AstroActions) actions).getElevation(date);
}
So I think the correct definition of the getAzimuth() and getElevation() should be with the generic type <Number> and not <Angle>
Can or should i create an issue of this on github?
YinYang
(Andreas)
November 30, 2020, 9:18pm
9
Hi Tobias,
Thanks for your investigation! This looks reasonable but I am unsure about the suggested solution.
Are there two possible solutions?
Change return type to QuantityType<Number>
OR
Change return((AstroActions)actions).getElevation(date)
to new QuantityType<>(((AstroActions)actions).getElevation(date), SmartHomeUnits.DEGREE_ANGLE)
;
Nevertheless it looks like an issue
ranielsen
(Rob Nielsen)
December 1, 2020, 6:50pm
10
This is broken with the OH3 as well. I’m trying to follow the example at https://www.openhab.org/addons/bindings/astro/#getazimuth-timestamp
DaToBi-89
(Tobias)
December 14, 2020, 3:20pm
11
sorry for the delay, but i’ve finally created an issue:
opened 03:19PM - 14 Dec 20 UTC
from the openHAB community forum https://community.openhab.org/t/astro-getelevation-has-missing-type-object/108945
Current Behavior
the getAzimuth() ant get Elevation() Actions generate a warning when used in a rule:
16:34:16.758 [INFO...
bug
YinYang
(Andreas)
December 14, 2020, 8:33pm
12
Hi Tobias! Thank you! Hope it will be fixed for OpenHab 2.x and 3.x, too.
YinYang
(Andreas)
January 17, 2021, 6:41pm
13
Does somebody has any information when it will be fixed?
system
(system)
Closed
February 28, 2021, 10:44am
14
This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.