Blockly Astro data type ChronoUnit

  • Platform information:
    • RPI 5 8gb - Docker
    • Debian 12 bookworm
    • Java Runtime Environment: 17.01.4
    • openHAB version: 4.3.4
  • Issue of the topic:
    I am trying to create a blockly script that shows what time each astro event will occur today.

I have 2 libraries installed:
Astro
dateTime

I can get the number of minutes until the next astro event without issue, but the type of this object is “ChronoUnit”, which cannot be used in another datetime object.

Here is an example:

This script cannot be saved, it gives an error:

If I try to do this without the variable, I cannot link the “number of minutes” to the copy of “minutes”, box.
I think this is because the number of minutes astro object is of type ChronoUnit which is not accepted by other blocks.

How can I convert the output of the Astro event “number of minutes” to a numeric so it can be used to work out the time of the event?

Hi,
The Typ is number. Throw out the DateTime library. It may have been useful before OH 3.3, but hasn’t been maintained since then.

Hi Tschetan,

Ahh, yes you are right, I found a way to do the same thing using standard Openhab date and time component, which works perfectly:

image