Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String-Item is no more shown in any newer App-Version than 3.15.4 #3814

Open
chsteidle opened this issue Sep 1, 2024 · 7 comments
Open

String-Item is no more shown in any newer App-Version than 3.15.4 #3814

chsteidle opened this issue Sep 1, 2024 · 7 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@chsteidle
Copy link

The String-Item was since years shown in the app and everywhere else it works, only in the new app-verssion it's without any text

*.sitemap: Text item=KA_AF
*.items: String KA_AF "[%s]" <waste> { channel="http:url:KA_AF:text"}
*.things:

Thing http:url:KA_AF "Abfuhrkalender" [
    baseURL="https://******",
    commandMethod="POST",
    refresh=3600]{
      Channels:
        Type string : text "Text" [ stateTransformation="JS:KA_AF.js" ]
      }

KA_AF*.js

    var array = i.split("BEGIN:VEVENT");
    var poi = [];
    var ausgabe = "";
    var aus = "";
    var Datum = new Date();
    var Start = new Date(Datum.getTime() + 86400000 * 7)
    for (i = 1; i < array.length; i++) {
        SUMMARY = array[i].split("SUMMARY:");
        SUMMARY = SUMMARY[1].split("\r");
        SUMMARY = SUMMARY[0].split(" in Donauw");
        SUMMARY = SUMMARY[0];
        if (array[i].indexOf("DATE:") > -1) {
            DTSTART = array[i].split("DATE:");
            DTSTART = DTSTART[1].split("\r");
            DTSTART = calenDayTo(DTSTART[0]);
            DTEND = new Date(DTSTART.getTime() + 86400000)
        } else {
            DTSTART = array[i].split("DTSTART:");
            DTSTART = DTSTART[1].split("\r");
            DTSTART = calenDateTo(DTSTART[0]);
            DTEND = array[i].split("DTEND:");
            DTEND = DTEND[1].split("\r");
            DTEND = calenDateTo(DTEND[0]);
        }
        if (Start >= DTSTART && Datum <= DTEND) {
            startdiff = DTSTART.getTime() - Datum.getTime() + Datum.getHours() * 3600000 + Datum.getMinutes() * 60000 + Datum.getSeconds() * 1000;
            startdiff = startdiff / 86400000;
            startdiff = Math.round(startdiff);
            poi.push([startdiff, SUMMARY]);
        }
    };
    poi.sort(function(a, b) {
        return a[0] - b[0];
    });
    for (i = 0; i < poi.length; i++) {
        ausgabe += poi[i][1];
        j = 0;
        if (i + 1 < poi.length) {
            if (poi[i][0] == poi[i + 1][0]) {
                j = 1;
            }
        }
        if (j == 1) {
            ausgabe += " und ";
        } else if (poi[i][0] == 0) {
            ausgabe += " heute";
        } else if (poi[i][0] == 1) {
            ausgabe += " morgen";
        } else {
            ausgabe += " " + poi[i][0] + " Tage";
        }
        if (j != 1 && i + 1 < poi.length) {
            ausgabe += ",\n";
        }
    }
    return ausgabe;
})(input);

function calenDayTo(DT) {
    var DTY = DT.substr(0, 4);
    var DTM = DT.substr(4, 2) - 1;
    var DTT = DT.substr(6, 2);
    var DT2 = new Date(DTY, DTM, DTT, 0, 0, 0);
    return DT2;
}

function calenDateTo(DT) {
    var DTY = DT.substr(0, 4);
    var DTM = DT.substr(4, 2) - 1;
    var DTT = DT.substr(6, 2);
    var DTS = DT.substr(9, 2);
    var DTI = DT.substr(11, 2);
    var DTE = DT.substr(13, 2);
    var DT2 = new Date(DTY, DTM, DTT, DTS, DTI, DTE);
    return DT2;
}    
     

String example: Gelber Sack 2 Tage, Biotonne 4 Tage

@chsteidle chsteidle added the bug Indicates an unexpected problem or unintended behavior label Sep 1, 2024
@mueller-ma
Copy link
Member

Is this the only String item with issues? Can you post the Sitemap definition and make a screenshot of the app?

@chsteidle
Copy link
Author

Hello Mueller-ma,

yes only that one string item (with the issue is the one witht the brown garbage can)

version newer than 3.15.4
WhatsApp Bild 2024-09-01 um 10 54 51_96e32272

Version 3.15.4
WhatsApp Bild 2024-09-01 um 10 54 51_366737fc

sitemap (remove *.txt | item on line 362 "KA_AF")
demo.sitemap.txt

@maniac103
Copy link
Contributor

So this is a text widget with only value, and without label. I assume you have 'compact mode' enabled?

@chsteidle
Copy link
Author

Yes, it's only a text widget, if I create a label it show the label but without the value. If I switch on or of the 'Compact-mode' there is no difference

WhatsApp Bild 2024-09-01 um 12 05 30_a5a3c253

WhatsApp Bild 2024-09-01 um 12 05 30_5209956f

@lenschith
Copy link

I have the same. With Text from the DWD Binding.

Group icon=storm item=DWDUnwetterWarnungen_Type1 label="Unwetterwarung" visibility=[DWD_Unwetter_Warnungen_Switch==ON] { Text icon=news item=DWDUnwetterWarnungen_Headline1 label="Titel" Text icon=dwdbeschreibung item=DWDUnwetterWarnungen_Description1 label="Beschreibung" Text icon=dwdanweisung item=DWDUnwetterWarnungen_Instruction1 label="Anweisung" Text icon=dwdschweregrad item=DWDUnwetterWarnungen_Severity1 label="Schweregrad" }
But only the text from item=DWDUnwetterWarnungen_Instruction1 do not work all other show the text. MainUI the text is visible.
I Do Not use the compact mode

@maniac103
Copy link
Contributor

I just tried to reproduce this on 3.16.2:

Created a new Item:

label: ""
type: String
category: ""
groupNames: []
tags: []

Assigned it @chsteidle's text using Karaf console: openhab:update TestString "Gelber Sack 2 Tage, Biotonne 4 Tage"

Put it into sitemap:

sitemap page_6ef01a3487 label="Test" {
  Text item=TestString
  Frame label="Frame Test" {
    Text item=TestString
  }
}

Result:
grafik

So I'm not sure what's going on, especially since 3.15.5 didn't ship any changes that look remotely related.
Can either of you seeing the issue plrease replicate my experiment above and see whether that one reproduces the issue?

@mueller-ma
Copy link
Member

Could this be related to the increase of maximum lines for item values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants