JSONDB files and Astro Binding

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Rev 1.2

    • OS: Raspbian GNU/Linux 9 (stretch)

    • Java Runtime Environment:
      openjdk version “1.8.0_152”
      OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8.0_152-b76)
      OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, mixed mode, Evaluation)

    • openHAB version: 2.4.0~S1452-1 (Build #1452)

I get several errors from the Astro binding. This is the latest one but I’ve also gotten ‘miles’, ‘kilometer’ errors as well. I turned off those channels to stop them.

2018-12-07 12:33:57.354 [ERROR] [ding.astro.handler.AstroThingHandler] - Can't update state for channel astro:moon:local:phase#agePercent : null

Finally fed up with seeing this error, I decided to try and get to the bottom of it. To date I have:

  • Removed the Astro Binding
  • Stopped OpenHab
  • Manually cleared the cache
  • Deleted everything in the /var/lib/openhab2/tmp directory
  • Searched for any .jar file with the word astro in it. (Did not find any)
  • Restarted openhab2
  • Installed the Astro Binding

Still I get the error. Finally, fed up and desperate, I grepped the /var/lib/openhab dir for agePercent. I found a hit in . the jsondb directory. (several in fact)

org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
org.eclipse.smarthome.core.thing.Thing.json

These entries survive deleting the Astro Binding so I think that the problem is that they contain references to channels that no longer exist in the binding.

My question:
Could the entries in the jsondb files be what is causing my Astro binding to throw errors?

Followup question:
Is there a tool to remove these entries other than a text editor?

Bonus Question:
Shouldn’t the binding clean these up automatically if this is the problem?

Thanks for any help! :slight_smile:

Cheers!
=C=

I think that you nailed it :slight_smile:

Most likely: yes

PaperUI (delete the Links, then the Items and the Things)
You will have to disable SImple Mode for Item Linking

Uninstalling a binding does not remove the associated Things, Channel Links & Items. This is an extra step that you need to perform using PaperUI

from the console:

items list
links list
things list
1 Like

So if I delete the astro binding, then use the console to delete all the items, links, and things associated with it, and then re-install, I should be good?

Cheers! :slight_smile:
=C=

absolutely

If you remove the 3 configuration elements (items, links, things) either using PaperUI and/or console, the corresponding jsonDB files will be updated:

items : org.eclipse.smarthome.core.items.Item.json
links : org.eclipse.smarthome.core.thing.link.ItemChannelLink.json
things : org.eclipse.smarthome.core.thing.Thing.json
$ openhab-cli console smarthome:links list | grep astro | awk {'print $1,$3'} | xargs -l -t  openhab-cli console smarthome:links removeChannelLink
$ openhab-cli console smarthome:items list | grep astro | awk {'print $1'} | xargs -l -t  openhab-cli console smarthome:items remove
$ openhab-cli console smarthome:things list | grep astro | awk {'print $1'} | xargs -l -t  openhab-cli console smarthome:things remove

My bash-foo isn’t what it used to be but I managed to cobble these together.

So I:

  • Deleted the Astro Binding
  • Ran the above commands
  • Stopped OH
  • Cleared cache with the cli
  • Started OH
  • Installed Astro binding

Now I’m down to these 2 errors:

2018-12-07 15:33:50.756 [ERROR] [ding.astro.handler.AstroThingHandler] - Can't update state for channel astro:moon:local:phase#agePercent : null
2018-12-07 15:33:50.690 [ERROR] [ding.astro.handler.AstroThingHandler] - Can't update state for channel astro:moon:local:phase#ageDegree : null

Not sure where to go from here.

Cheers! :slight_smile:
=C=

1 Like

One option would be… to disregard this one :slight_smile:
See here: Astro binding throwing exceptions for moon since 00:00 this morning - #5 by namraccr

I didn’t find any better response than this… I know it’s not very “satisfactory” :slight_smile:

1 Like

:smile: Thanks for that. When I initially searched it was a different error. Didn’t think to research.

Cheers! :slight_smile:
=C=

1 Like

that’s pretty good! (better than my bash-foo for sure!)

by the way/side note : some people use this method (openhab-cli <commands>) with the Exec Binding to restart a bundle if it gets stuck (with bundle:restart 123)

Not a big fan of this bundle:restart story since I try to debug the heck out of my installations to avoid this kind of workarounds :slight_smile:

Interesting. I’ve not yet had to restart a bundle. Didn’t know it was a thing. Learned a lot of new today. :slight_smile:

Cheers!
=C=

1 Like