Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.
This repository has been archived by the owner on May 7, 2020. It is now read-only.

[astro] Can't update state for channel :position#elevation #6693

Closed
janb14 opened this issue Dec 18, 2018 · 2 comments
Closed

[astro] Can't update state for channel :position#elevation #6693

janb14 opened this issue Dec 18, 2018 · 2 comments

Comments

@janb14
Copy link

janb14 commented Dec 18, 2018

After sucessful using the astro binding for over a year now, a couple of days ago i noticed missing/incomplete data provided by the position#elevation and position#azimuth channels. Does anyone has anything similar in his logs/can help me with a workaround?

Expected Behavior

I was updating two Number Variables and saving them to mysql persistance to visualize in Grafana and to tell artificial and natural light apart. Suddenly two channels doesnt seem to work anymore even if testwise upgrading to 2.5.0-SNAPSHOT or using the latest 2.4.0-SNAPSHOT.

Current Behavior

Currently my rules fire but only produce either null states or garbage data as u can see in the log/pictures.

2018-12-18 08:09:19.875 [ERROR] [ding.astro.handler.AstroThingHandler] - Can't update state for channel astro:sun:home:position#elevation : null
java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:98) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:100) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getPropertyValue(PropertyUtils.java:88) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.internal.util.PropertyUtils.getState(PropertyUtils.java:53) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.handler.AstroThingHandler.publishChannelIfLinked(AstroThingHandler.java:156) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.handler.AstroThingHandler.publishPlanet(AstroThingHandler.java:139) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.handler.SunHandler.publishPositionalInfo(SunHandler.java:61) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at org.eclipse.smarthome.binding.astro.internal.job.PositionalJob.run(PositionalJob.java:45) [199:org.eclipse.smarthome.binding.astro:0.10.0.201808242044]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.(BigDecimal.java:494) ~[?:?]
at java.math.BigDecimal.(BigDecimal.java:383) ~[?:?]
at java.math.BigDecimal.(BigDecimal.java:806) ~[?:?]
at org.eclipse.smarthome.core.library.types.QuantityType.(QuantityType.java:104) ~[?:?]
at org.eclipse.smarthome.binding.astro.internal.model.Position.getElevation(Position.java:62) ~[?:?]
... 18 more

Picture 1 shows old vs new behaviour
Picture 2 shows the error in more detail

Obviously the sun should be down at midnight in winter and not go up and down like this (Picture 2).

Steps to Reproduce (for Bugs)

My things:

astro:sun:home [geolocation="50.7778258,6.09564,163" ,interval=60]
astro:moon:home [geolocation="50.7778258,6.09564" ,interval=60]

My Items:

Number Sun_Elevation "Elevation [%.2f]" (Persist){channel="astro:sun:home:position#elevation"}
Number Sun_Azimuth "Azimuth [%.2f]" (ThirtyM) {channel="astro:sun:home:position#azimuth" }

My Sitemap:

Frame label="Astro"{
Text item=Sun_Elevation
Text item=Sun_Azimuth
}

My Rules:

rule "Sunset Rule"

when
Channel 'astro:sun:home:set#event' triggered START
then
postUpdate(Sunset_Azimuth,Sun_Azimuth.state)
logInfo("Shaddow","Setting Sunset Azimuth.")
end
rule "Sunrise Rule"
when
Channel 'astro:sun:home:rise#event' triggered START
then
postUpdate(Sunrise_Azimuth,Sun_Azimuth.state)
logInfo("Shaddow","Setting Sunrise Azimuth.")
end

Context

Im not needing the elevation for something mission critical but it seems something broke a couple of days ago and im unshure if im the problem or the astro api broke.

Your Environment

openjdk version "1.8.0_192"
FreeBSD 11.2 (FreeNAS Jail)
currently openHAB 2.4.0 Build #1340 (last working built,also tried latest 2.4.0-Snapshot and 2.5.0-Snapshot without success)
Addon Version 2.4.0 Snapshot shown in PaperUI

Edit: Corrected copy error in items.

@HerzScheisse-zz
Copy link

Hi @janb14 , dont know if its a copy/paste error in your item definition... but it seems you are missing a "{" bracket in front of "channel"

anyway... i'm using this binding too on the lastest OH 2.4/2.5 Snapshot... and everything is working...
But in my items i have the Units of Measurement (UoM) included...

astro.items

DateTime			Sunrise_Time		"Sonnenaufgang [%1$tH:%1$tM]"		{ channel="astro:sun:home:rise#start" }
DateTime			Sunset_Time			"Sonnenuntergang [%1$tH:%1$tM]"		{ channel="astro:sun:home:set#start" }
Number:Angle		Azimuth				"Horizontalwinkel [%.1f %unit%]"	{ channel="astro:sun:home:position#azimuth" }
Number:Angle		Elevation			"Höhenwinkel [%d %unit%]"			{ channel="astro:sun:home:position#elevation" }
String				MoonPhase			"Mond Phase [%s]"					{ channel="astro:moon:home:phase#name" }
Number:Length		MoonDistance		"Mond Entfernung [%.1f %unit%]"		{ channel="astro:moon:home:distance#distance" }
Number:Intensity	Total_Radiation		"Strahlung [%.2f %unit%]"			{ channel="astro:sun:home:radiation#total" }
Number:Intensity	Diffuse_Radiation	"Diffuse Strahlung [%.2f %unit%]"	{ channel="astro:sun:home:radiation#diffuse" }
Number:Time			DaylightDuration	"Tageslicht Dauer"					{ channel="astro:sun:home:daylight#duration" }
String				SeasonName			"Jahreszeit"						{ channel="astro:sun:home:season#name" }
String				SunPhaseName		"Sonnen Phase"						{ channel="astro:sun:home:season#name" }

astro.things

astro:sun:home  [ geolocation="YOUR_LAT_LONG_ALT", interval=60 ]
astro:moon:home [ geolocation="YOUR_LAT_LONG_ALT", interval=60 ]

@clinique
Copy link
Contributor

Using appropriate quantity types, this seems to be working as expected. Could be closed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants