DWD Unwetter Binding "Beschreibung" long text idea

Hi
I have the same problem like many others. In the “DWD Unwetter Binding” is the text of the description often to long for the Sitemap. So I searched for a solution.
I found some ideas, like put everythin in frames or something else. That was all not what I have seached for.

Now maybe I have a better solution.

I take via REST from the “Beschreibung” item the JSON value from “state” which is the description. The Transform this in a html file and display it with the webview in my sitemap.

The style is not perfect at the moment. And because I have never worked with html or css previously the code is probably not well.

This my code:

<!DOCTYPE html>
<html lang="en">
  <style>
    p {
      color: rgb(92, 91, 91);
      font-family: verdana;
      font-weight: bolder;
      font-size: 90%;
    }
    </style>
<head>
<title>JavaScript - read JSON from URL</title>
    <script src="jquery.min.jsm"></script>
</head>
<body>
    <p class="mypanel"></p>
    <script>
    $.getJSON('http://192.168.0.2:8080/rest/items/DWDBeschreibung', function(data) {
        
        var text = `${data.state}`                        

        $(".mypanel").html(text);

    });

    </script>
 
</body>
</html>

The local skript I´ve used is jquery. You can download it there:
https://jquery.com/download/
Then you have to save it in your openhab html folder.
Or refer to an online version of it: https://code.jquery.com/jquery-3.2.1.min.js
I prefere the local version :sunglasses:

ps sorry for my bad english, my school days are a long time ago :wink:

3 Likes

from where did you pull the map image? :smiley:

Also looking at your html I see that you refer to a local script source with the ending jsm?

1 Like

The image are from the DWD:
https://www.dwd.de/DWD/warnungen/warnapp_gemeinden/json/warnungen_gemeinde_map_de.png
https://www.dwd.de/DWD/warnungen/warnstatus/SchilderSU.jpg (this ist also for the other german states available.

1 Like