Astro Items+Sitemap+Map+♈ Binding Example

Tags: #<Tag:0x00007faef926ecd8> #<Tag:0x00007faef9272748>

@ThomDietrich @rossko57 - I still have not successfully defined “minus90” as used for EveningTime in the original post. Can you enlighten? THanks.

astro:sun:rhubarb [ geolocation="52.5200066,13.4049540,100", interval=60 ] {
    Channels:
        Type rangeEvent : set#event [
            offset=-90
        ]
}
DateTime Early_dusk   "Sunset -90m  [%1$tH:%1$tM]" { channel="astro:sun:rhubarb:set#start" }

Untested, as per

1 Like

for a beginner with OH2, this tutorial is PERFECT. I was wondering if there is way to add constants as a item label though. I would like to use the constants just like the astro.map e.g.:

SUN_RISE=Sonnenaufgang

as

DateTime    Sunrise_Time         "Sunrise [%1$tH:%1$tM]"     <SUN_RISE>    (Astro) {channel="astro:sun:home:rise#end"}

instead of

DateTime    Sunrise_Time         "Sonnenaufgang[%1$tH:%1$tM]"       (Astro) {channel="astro:sun:home:rise#end"}

is there a way to do so?
Not sure if you mentoined it before, sorry I didn’t get it

Hi,

I have created SVG icons for all the moon phases which must be stored under the following directory structure openhab/conf/icons/classic … you might need to create the classic directory. Then just simply add the parameter icon="moonphases" to the line in your sitemap for the Moon_Phase item

              Text item=Moon_Phase icon="moonphases"

Find below all phases as PNGs (as SVGs are not shown through the upload mechanism). Either convert them yourself or send me a private message and I can provide the SVG collection in a zip file by email:

The files must be named for the appropriate order like:

  • moonphase-new.svg
  • moonphase-waxing_crescent.svg
  • moonphase-first_quarter.svg
  • moonphase-waxing_gibbous.svg
  • moonphase-full.svg
  • moonphase-waning_gibbous.svg
  • moonphase-third_quarter.svg
  • moonphase-waning_crescent.svg

!!! The uploaded pictures below are not in order !!!
!!! You have to sort out the right naming yourself when downloading these pngs and converting yourself!!!

!!! I recently uploaded all the PNGs again as there was one JPG accidentally hidden !!!
!!! Now all the pics are PNGs - I can provide the SVGs if you send me a message !!!

moonphases-new moonphases-full moonphases-waxing_gibbous moonphases-waning_gibbous moonphases-first_quarter moonphases-third_quarter moonphases-waxing_crescent moonphases-waning_crescent

!!! I recently uploaded all the PNGs again as there was one JPG accidentally hidden !!!
!!! Now all the pics are PNGs - I can provide the SVGs if you send me a message !!!

This is how it looks in my Basic UI:

Cheers Justus

4 Likes

I found that the SVG files are only working in the web view with the Basic UI and not in the mobile app :frowning:
Most likely to the size as the are 256x256 pixel and not as required 32x32 pixels. The pictures look horrible in the lower resolution …
If anyone has an idea how to make these pictures (PNG and/or SVG) work in the mobile app then feel free to advise :slight_smile:

Did you test your svg pictures with the beta version of the android app?
There is a fix for the svg handling, which is already in beta but not yet in the stable app on google play.

Hello Jerome,

I looked closer to the app and I found the documentation of the bug and that it is fixed in the beta. Hence I installed the beta (v2.3.7) from the Google Play Store. The scaling issue was fixed in the 2.2.5 … But my problem seems not to be related to this bug.

I solved it with an app setting because my finding works with both app versions!

Here is my solution for displaying SVG icons in the mobile app:
This works in both avaialable app verions from the Google play store:

  1. Stable version 2.2.0 from May 2018
  2. Beta version 2.3.7 from September 2018

In the settings there is a option to set the Symbol-Format which is either

  • Pixelgrafik (in English probably: Pixel Graphics)
    or
  • Vektorgrafik (in English probably: Vector Graphics)

The Default is Pixelgrafik

With this setting the SVG icons are not shown. But setting the format to Vektorgrafik the app will display the icons.
I believe that this might probably be the most likely reason why customized/indvidual SVG icons are not shown in the app because I did not find this explanation in any of the topics which are dealing with that issue. As this works with the 2.2.0 I guess a lot of problems come from this easy settings change and probably not from the bug.
Anyway, I think it is worth a try for everyone who experiences the same issue :slight_smile:

1 Like

Question: Is it possible to get the sunrise and sunset information for the next day?
At least the sunrise information would be helpful because it probably makes sense to have the information about sunrise before the sun rises :wink:

Is there a way to get this information additionally to the values for the current day?

hello

first of all many thanks for the tutorial. I copy + paste everything. But all I get is this:

What have I done wrong? I’ve activated the UTF-8 encoding.

Also i cant find a icon named sunmoon and fulmoon in the documentation

best regards

You can use Astro Actions for calculating sunrise/sunset on given date

1 Like

That is cool!

That is cool!
I helped myself with a python script leveraging the Astral library of Python and it inserts the data via REST-API to the appropriate items … still need to create the tutorial for this.

But this is also a charming way which needs no external python scripts. Thanks, I will test that out when I find the time!

I did not get the moon symbols from the MAP file displayed in Basic UI as well even though the zodiac symbol works ??? I thought that the moon symbol wouldn’t work in the Basic UI at all???!!! I would be wondering if anybody got it working in the Basic UI. I only got them working in the Android mobile app!

That is why I created a set of dynamic icons to have the moon icon changing in the beginning of the line. But these icons are not in the documentation or default in openhab icon sets. I can send them to you if you are interested. You would need to copy them to "icons/classic and check that the item name is the same as the icon name.

Here is my polish translation (PL)-pl.
Tłumaczenie na język polski.

astro.map

//
ARIES=♈ Baran (21 marca - 20 kwietnia)
TAURUS=♉ Byk (21 kwietnia - 21 maja)
GEMINI=♊ Bliźnięta (22 maja - 21 czerwca)
CANCER=♋ Rak (22 czerwca - 22 lipca)
LEO=♌ Lew (23 lipca - 22 sierpnia)
VIRGO=♍ Panna (23 sierpnia - 22 września)
LIBRA=♎ Waga (23 września - 22 października)
SCORPIO=♏ Skorpion (23 października - 22 listopada)
SAGITTARIUS=♐ Strzelec (23 listopada - 20 grudnia)
CAPRICORN=♑ Koziorożec (21 grudnia - 19 stycznia)
AQUARIUS=♒ Wodnik (20 stycznia - 18 lutego)
PISCES=♓ Ryby (19 lutego - 20 marca)

//
SPRING=Wiosna
SUMMER=Lato
AUTUMN=Jesień
WINTER=Zima

//
SUN_RISE=Wschód słońca
ASTRO_DAWN=Astronomiczny wschód słońca
NAUTIC_DAWN=Morski wschód słońca
CIVIL_DAWN=Cywilny wschód słońca
CIVIL_DUSK=cywilny zachód słońca
NAUTIC_DUSK=Morski zachód słońca
ASTRO_DUSK=Astronomiczny zachód słońca
SUN_SET=Zachód słońca
DAYLIGHT=Dzień
NOON=Południe
NIGHT=Noc

//
MORNING=Poranek
DAY=Dzień
AFTERNOON=Popołudnie
EVENING=Wieczór
NIGHT=Noc
BED=Czas na sen

//
NEW=🌑 Nów
WAXING_CRESCENT=🌑→🌓 Sierp przybywający
FIRST_QUARTER=🌓 Pierwsza kwadra
WAXING_GIBBOUS=🌓→🌕 Księżyc przed pełnią
FULL=🌕 Pełnia
WANING_GIBBOUS=🌕→🌗 Ubywający księżyc
THIRD_QUARTER=🌗 Ostatnie kwadra
WANING_CRESCENT=🌗→🌑 Sierp ubywający

//
NULL=Błąd ⁉
-=Błąd ⁉
2 Likes

@Casa75
What UI are you looking in. when I do something like

WANING_CRESCENT=\ud83c\udf17→\ud83c\udf11 afnemende halve maan

it works on the mobile app but not in any browser (safari, chrome or Firefox).

Is this what you are doing ? or do you have other escape or special characters?

Can someone explain again how to display the symbols in the map file in a normal browser ?

Hello Justus,

i would like to use your very cool moonphase-icons.
Unfortunately one icon (waxing_gibbous) is an jpeg and no png, therefore its not transparent.
Could you send me the svg or png?

Thank you in advance. =)

Posting here as well as translated for me

astro.map in Latvian

//
ARIES=♈ Auns
TAURUS=♉ Vērsis
GEMINI=♊ Dvīņi
CANCER=♋ Vēzis
LEO=♌ Lauva
VIRGO=♍ Jaunava
LIBRA=♎ Svari
SCORPIO=♏ Skorpions
SAGITTARIUS=♐ Strēlnieks
CAPRICORN=♑ Mežāzis
AQUARIUS=♒ Ūdensvīrs
PISCES=♓ Zivs

//
SPRING=Pavasaris
SUMMER=Vasara
AUTUMN=Rudens
WINTER=Ziema

//
SUN_RISE=Saullēkts
ASTRO_DAWN=Astronomiskā rītausma
NAUTIC_DAWN=Jūras navigācijas rītausma
CIVIL_DAWN=Civilā rītausma
CIVIL_DUSK=Civilā krēsla
NAUTIC_DUSK=Jūras navigācijas krēsla
ASTRO_DUSK=Astronomiskā krēsla
SUN_SET=Saulriets
DAYLIGHT=Diena
NOON=Pēcpusdiena
NIGHT=Nakts

//  
NEW=🌑 Jauns mēness
WAXING_CRESCENT=🌑→🌓 Augošs mēness
FIRST_QUARTER=🌓 Pirmais ceturksnis
WAXING_GIBBOUS=🌓→🌕 Augošs mēness
FULL=🌕 Pilnmēness
WANING_GIBBOUS=🌕→🌗 Dilstošs mēness
THIRD_QUARTER=🌗 Pēdējais ceturksnis
WANING_CRESCENT=🌗→🌑 Dilstošs mēness

//
NULL=nezināms ⁉
-=nezināms ⁉

@ThomDietrich
Thank you very much, well explained and it works fine to me! MERCI
vinc

I use the astro startup rules but it triggers a deprecated warning on “.calendar.timeInMillis”

Its in the startup rule Astro INIT. The rule works but the deprecated annoys me. Does anyone know how to fix this?

Here are my Astro Rules. Does this help?

rule “Astro Startup Handler”
when
System started
then
createTimer(now.plusSeconds(60)) [ |
if (now.isAfter((Sunset_Time.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli) || now.isBefore((Sunrise_Time.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)) {
postUpdate(Night_State, ON)
} else {
postUpdate(Night_State, OFF)
}
]
end

rule “Update Astro Night State”
when
Item Sun_Elevation changed
then
if(Sun_Elevation.state > 0){
if(Night_State.state != OFF) {
postUpdate(Night_State, OFF)
}
} else {
if(Night_State.state != ON) {
postUpdate(Night_State, ON)
}
}
end

Hi,

For French, here is the astro.map:

//
ARIES = ♈ Bélier
TAURUS = ♉ Taureau
GEMINI = ♊ Gemeau
CANCER = ♋ Cancer
LEO = ♌ Lion
VIRGO = ♍ Vierge
LIBRA = ♎ Balance
SCORPIO = ♏ Scorpion
SAGITTARIUS = ♐ Sagittaire
CAPRICORN = ♑ Capricorne
AQUARIUS = ♒ Verseau
PISCES = ♓ poisson

//
NEW=Nouvelle Lune
WAXING_CRESCENT=Croissant de Lune croissante
FIRST_QUARTER=Premier quart
WAXING_GIBBOUS=Lune gibbeuse croissante
FULL=Pleine Lune
WANING_GIBBOUS=Lune gibbeuse décroissante
THIRD_QUARTER=Dernier quart
WANING_CRESCENT=Croissant de Lune décroissante

//
SPRING = Printemps
SUMMER = Ete
AUTUMN = Automne
WINTER = Hiver

And moonphase icons

Regards,


Vincent Ferreux
Alter&Coop