Wind direction

alfredxyz

New member
Hi. I made a simple macro to display weather conditions as notification to have it on my watch. I use the inbuilt {weather_wind_direction} to get the wind direction but only in degree. Is it possible to show the direction in N W S O?
 

Dm114

Well-known member
Hi. I made a simple macro to display weather conditions as notification to have it on my watch. I use the inbuilt {weather_wind_direction} to get the wind direction but only in degree. Is it possible to show the direction in N W S O?
All depends on the precision you need but you can begin with:
• 45⁰ < E < 135⁰
• 135⁰ < S < 225⁰
• 225⁰ < W < 315⁰
• otherwhise = N
 

alfredxyz

New member
All depends on the precision you need but you can begin with:
• 45⁰ < E < 135⁰
• 135⁰ < S < 225⁰
• 225⁰ < W < 315⁰
• otherwhise = N
Thank you for replying. And how to integrate it into the macro? Attached a screenshot of my macro
 

Attachments

  • Screenshot_20250131-123524_MacroDroid.png
    Screenshot_20250131-123524_MacroDroid.png
    163.9 KB · Views: 12

Dm114

Well-known member
Thank you for replying. And how to integrate it into the macro? Attached a screenshot of my macro
First of all, I'm not sure you can use {weather_wind_direction} as it's not a regular Magic Text.

Otherwise to integrate the conversion it's easy enough with a IF...ELSE IF...ELSE IF...ELSE statement, such as:
IF {weather_wind_direction} > 44.9 AND {weather_wind_direction} < 135 THEN Diection = E
ELSE IF {weather_wind_direction} > 134.9 AND {weather_wind_direction} < 225 THEN Direction = S
ELSE IF...
ELSE Drection = N
ENDIF
assuming "Direction" is a Local string variable.
 

alfredxyz

New member
If I don't made a mistake it doesn't work:

{weather_conditions} Temperatur: {weather_temperature_c}°C Wind: {weather_wind_speed_kmh} km/h IF {weather_wind_direction} > 44.9 AND {weather_wind_direction} < 135 THEN Direction = E ELSE IF {weather_wind_direction} > 134.9 AND {weather_wind_direction} < 225 THEN Direction = S ELSE IF {weather_wind_direction} > 224.9 AND {weather_wind_direction} < 315 THEN Direction = W ELSE IF {weather_wind_direction} > 314.9 ELSE Direction = N ENDIF Luftfeuchte: {weather_humidity}%
 

Dm114

Well-known member
If I don't made a mistake it doesn't work:

{weather_conditions} Temperatur: {weather_temperature_c}°C Wind: {weather_wind_speed_kmh} km/h IF {weather_wind_direction} > 44.9 AND {weather_wind_direction} < 135 THEN Direction = E ELSE IF {weather_wind_direction} > 134.9 AND {weather_wind_direction} < 225 THEN Direction = S ELSE IF {weather_wind_direction} > 224.9 AND {weather_wind_direction} < 315 THEN Direction = W ELSE IF {weather_wind_direction} > 314.9 ELSE Direction = N ENDIF Luftfeuchte: {weather_humidity}%
As I told you, all your {weather_...} variables are not built-in variables: where do you pick them up from?
 

alfredxyz

New member

Attachments

  • Screenshot_20250131-201116_MacroDroid.png
    Screenshot_20250131-201116_MacroDroid.png
    162.9 KB · Views: 10
  • Screenshot_20250131-201156_MacroDroid.png
    Screenshot_20250131-201156_MacroDroid.png
    169.6 KB · Views: 10
  • Screenshot_20250131-201238_MacroDroid.png
    Screenshot_20250131-201238_MacroDroid.png
    215.1 KB · Views: 10
  • Screenshot_20250131-201313_MacroDroid.png
    Screenshot_20250131-201313_MacroDroid.png
    267.7 KB · Views: 10

Dm114

Well-known member
Apologize! I completly forgot this functionality. Shame on me!

Give me a couple of hours and I'll show you an example of what you could do.
 

RSF

Well-known member
All of @Dm114's IF/ELSE-IF statements have to be put in the macro as MacroDroid actions -- not inserted into the notification text as is:

1738370428023.png
and so forth for the other conditions...

Then you can insert the value of that local variable "wind_direction_compass" into your notification.
 

alfredxyz

New member
All of @Dm114's IF/ELSE-IF statements have to be put in the macro as MacroDroid actions -- not inserted into the notification text as is:

View attachment 12877
and so forth for the other conditions...

Then you can insert the value of that local variable "wind_direction_compass" into your notification.
Thank you but I am not able to set it up like in your screenshot. I never used those IF/ELSE THINGS cause I don't understand it fully. Could you please tell me step by step the first two lines of your screenshot?
 

alfredxyz

New member
I think you should helpfully have a look to MacroDroid Wiki
I have now spent several hours reading the instructions and trying to get a result, unfortunately without success. Do I have to create the variables {weather_wind_direction} and wind_direction_compass: myself in the main menu under Variables?
 

Dm114

Well-known member
I have now spent several hours reading the instructions and trying to get a result, unfortunately without success. Do I have to create the variables {weather_wind_direction} and wind_direction_compass: myself in the main menu under Variables?
Just use the Weather trigger (in the top red area of the screen) then, in the blue area, add IF statements as in the example @RSF gave you above, a couple of days ago.
 

RSF

Well-known member
Do I have to create the variables {weather_wind_direction} and wind_direction_compass: myself in the main menu under Variables?
{weather_wind_direction} is a built-in variable -- referred to as "Magic Text" in MacroDroid's documentation. You already found that and used it in your original Benachrichtigung Anzeigen action, along with the Magic Text for wind speed, temperature, and so forth.

wind_direction_compass is indeed a variable that you'll need to create yourself, since its value doesn't exist as Magic Text. That's the reason you need to create those If / Else-If / Else-If / Else action statements. But you don't have to use a Global Variable (which are created in the Variables button on MacroDroid's main screen, which you found). It's better to create a Local Variable, which exists only in your macro -- otherwise, you'll end up with a lot of global variables which gets unwieldy. Furthermore, local variables are easy to create -- they're created automatically by Set Variable actions, as in the screen shot above. Try adding one of those Set Variable actions to your macro, and choose the [New Variable] option on the very next screen it'll show you. Read the MacroDroid Wiki page on Variables for more information.
 

alfredxyz

New member
Just use the Weather trigger (in the top red area of the screen) then, in the blue area, add IF statements as in the example @RSF gave you above, a couple of days ago.
Please have a look if I'm on the right path
 

Attachments

  • Screenshot_20250204-192302_MacroDroid.png
    Screenshot_20250204-192302_MacroDroid.png
    140.5 KB · Views: 6
  • Screenshot_20250204-192329_MacroDroid.png
    Screenshot_20250204-192329_MacroDroid.png
    185.6 KB · Views: 6
  • Screenshot_20250204-192355_MacroDroid.png
    Screenshot_20250204-192355_MacroDroid.png
    156.4 KB · Views: 6
  • Screenshot_20250204-192415_MacroDroid.png
    Screenshot_20250204-192415_MacroDroid.png
    146.6 KB · Views: 6

Dm114

Well-known member
Please have a look if I'm on the right path
This 1st step is correct!

Now add a Set variable action to a local string variable between the IF and END IF line/statement (let's say "wind_direction_compass" to follow @RSF's example). Set it with the letter corresponding to the test, i.e. "E" in the 1st branch of your test. Then add a ELSE IF line/statement (2nd branch) and so on (following @RSF's example).
 

alfredxyz

New member
Dieser 1. Schritt ist richtig!

Fügen Sie nun einer lokalen Zeichenfolgevariable zwischen der IF- und der END IF-Zeile/Anweisung eine Aktion „Variable festlegen“ hinzu (sagen wir „wind_direction_compass“, um dem Beispiel von @RSF zu folgen). Setzen Sie sie mit dem Buchstaben, der dem Test entspricht, also „E“ im 1. Zweig Ihres Tests. Fügen Sie dann eine ELSE IF-Zeile/Anweisung (2. Zweig) usw. hinzu (gemäß dem Beispiel von @RSF).
Everything is right so far?
 

Attachments

  • Screenshot_20250205-210126_MacroDroid.png
    Screenshot_20250205-210126_MacroDroid.png
    364.8 KB · Views: 5
  • Screenshot_20250205-210155_MacroDroid.png
    Screenshot_20250205-210155_MacroDroid.png
    316.8 KB · Views: 5
  • Screenshot_20250205-210225_MacroDroid.png
    Screenshot_20250205-210225_MacroDroid.png
    285.8 KB · Views: 5
  • Screenshot_20250205-210258_MacroDroid.png
    Screenshot_20250205-210258_MacroDroid.png
    227.4 KB · Views: 5
  • Screenshot_20250205-210324_MacroDroid.png
    Screenshot_20250205-210324_MacroDroid.png
    161.1 KB · Views: 5
Top