LCD 2004 display problem at line 4

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

LCD 2004 display problem at line 4

#1 Post by Blatzi » 16 Jan 2023, 08:01

Hi,

I am using a Wemos D1 which should send different values via I2C to a 2004 Display 4 * 20
I send all the values via iobroker and Http request. I use the normal espeasy mega-20221105

I can display everything. Every line is working like: http://IP-Adress/control?cmd=lcd,1,1,TEXT ; http://IP-Adress/control?cmd=lcd,1,12,value

I have only a problem at line 4.
The values are displayed in the line 4 in the same way, but from time to time, they are displayed and after a few miliseconds they are cleared. Then the hole row or only the value which is send by: http://IP-Adress/control?cmd=lcd,4,12,value is empty.
(The values are updated every 10 sec) somethime it needs 2-3 updates, that the value gets displayed again. Then it works for a few updates and again the line 4 is empty again. I have alredy interchanged at what line the values are displayed. I have the problem only in line 4
I have already shortened the values, that they are not too long, but no change.

Can anyone help?

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#2 Post by Ath » 16 Jan 2023, 08:23

Can you show how you configured the display in ESPEasy?
/Ton (PayPal.me)

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#3 Post by Blatzi » 16 Jan 2023, 16:56

I have attached a few pictures about the hardware configuation.
Attachments
hardware.png
hardware.png (41.78 KiB) Viewed 2509 times
2023-01-16 16_55_26-Keller-Display – Mozilla Firefox.png
2023-01-16 16_55_26-Keller-Display – Mozilla Firefox.png (10.14 KiB) Viewed 2509 times
2023-01-16 16_55_52-Keller-Display – Mozilla Firefox.png
2023-01-16 16_55_52-Keller-Display – Mozilla Firefox.png (18.69 KiB) Viewed 2509 times

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#4 Post by Ath » 16 Jan 2023, 23:25

Blatzi wrote: 16 Jan 2023, 08:01 I have only a problem at line 4.
The values are displayed in the line 4 in the same way, but from time to time, they are displayed and after a few miliseconds they are cleared. Then the hole row or only the value which is send by: http://IP-Adress/control?cmd=lcd,4,12,value is empty.
(The values are updated every 10 sec) somethime it needs 2-3 updates, that the value gets displayed again. Then it works for a few updates and again the line 4 is empty again. I have alredy interchanged at what line the values are displayed. I have the problem only in line 4
Are there any remaining spaces in Line 4 of the settings? As the line is only re-displayed (and wiped to end, according to the LCD command mode) if *any* data is in that line, including spaces.
/Ton (PayPal.me)

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#5 Post by Blatzi » 17 Jan 2023, 07:32

Hi, you mean the line 4 in device settings? These lines I have checked, they are empty.
In my script, I send additonal after 10 times refresh a LCD clear comand.
Anything else?

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#6 Post by Ath » 17 Jan 2023, 07:41

Blatzi wrote: 17 Jan 2023, 07:32 In my script, I send additonal after 10 times refresh a LCD clear comand.
Anything else?
Why would you do that?

What scripts/commands are sent to the display, other than what you already showed before?
/Ton (PayPal.me)

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#7 Post by Blatzi » 17 Jan 2023, 20:17

Hi, it is programmed in iobroker blockly.


The clear comand is definitly not the reason why the line 4 gets empty. I see, when it is cleared and I see, that everything gets displayed afterwarts. (sometimes not). And randomly, maybe after 1, 2... refreshes of the data, the last line is empty. Most of the time only the value is empty. This means, that the text "Feuchtedif" is displayed, but not the value. But I have alredy changed the value in a fix number and then, I saw the same, that this number was displayed sometimes, and sometimes not.

This is the part, which is somethimes not there:
require("request")((['http://192.168.178.173/control?cmd=lcd, ... sult,'g/qm'].join(''))).on("error", function (e) {console.error(e);});
} catch (e) { console.error(e); }

At line 4 positon 13 the value + g/qm should be displayed.


Whole script looks like:

Code: Select all

var temp, feucht, absfeuchte, P_Balkon, absfeuchte_keller, z, Absfeuchteresult;

// Beschreibe diese Funktion …
async function etwas_tun(temp, feucht) {
  absfeuchte = parseFloat((parseFloat(parseFloat(parseFloat(6.112) * Math.exp(parseFloat((parseFloat(17.67) * temp)) / (parseFloat(243.5) + temp))) * 2.1674) * feucht)) / (parseFloat(273.15) + temp);
}


schedule("*/10 * * * * *", async function () {
  P_Balkon = Math.round(getState("mqtt.0.inverter.total.P_AC").val*10)/10;
  await etwas_tun(getState("zigbee.0.00158d000893a1ae.temperature").val, getState("zigbee.0.00158d000893a1ae.humidity").val);
  absfeuchte_keller = Math.round(absfeuchte*100)/100;
  await etwas_tun(getState("weatherunderground.0.forecast.current.temp").val, getState("weatherunderground.0.forecast.current.relativeHumidity").val);
  absfeuchte = Math.round(absfeuchte*100)/100;
  if (z < 1 || z > 10) {
    z = 1;
  }
  if (z == 1) {
    try {
      require("request")('http://192.168.178.173/control?cmd=lcdcmd,clear').on("error", function (e) {console.error(e);});
    } catch (e) { console.error(e); }
  }
  z = (typeof z == 'number' ? z : 0) + 1;
  Absfeuchteresult = Math.round((parseFloat(absfeuchte_keller) - absfeuchte)*10)/10;
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,1,1,BKW','',''].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,1,12,',P_Balkon,'%A0W'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,2,1,Temp:','',''].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,2,7,',Math.round(getState("zigbee.0.00158d000893a1ae.temperature").val*10)/10,'%dfC'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,2,15,',getState("weatherunderground.0.forecast.current.temp").val,'%dfC'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,3,1,Feuchte:','',''].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,3,10,',Math.round(getState("zigbee.0.00158d000893a1ae.humidity").val*10)/10,'%'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,3,17,',getState("weatherunderground.0.forecast.current.relativeHumidity").val,'%'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,4,1,Feuchtediff','',''].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,4,13,',Absfeuchteresult,'g/qm'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
});


schedule("*/5 * * * *", async function () {
  try {
    require("request")(('http://192.168.178.173/control?cmd=lcdcmd,off')).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
});

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#8 Post by Ath » 17 Jan 2023, 21:35

Could having a schedule every 5 minutes to turn off the display (lcdcmd,off) have anything to do with that? And your regular schedule is once every 10 minutes, so the chance of that clashing is close to 200%, AFAICS
/Ton (PayPal.me)

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#9 Post by Blatzi » 18 Jan 2023, 16:43

No, this has nothing to do with it. I have revomed it and nothing has changed. This is only a routing to switch off the backlight of the display.

RonkA
Normal user
Posts: 10
Joined: 07 Jan 2023, 02:58
Location: The Netherlands

Re: LCD 2004 display problem at line 4

#10 Post by RonkA » 19 Jan 2023, 00:33

Hello,
In the log of ESP you can see what is beeing send, is there sometimes an extra space or weird caracter in the text sent to line 4?
I have a lcd2004 display that will stop displaying a line of text if a space is send. So 'hello%20world' outputs in log 'hello world' but displays 'hello'.

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#11 Post by Ath » 19 Jan 2023, 07:38

RonkA wrote: 19 Jan 2023, 00:33 Hello,
In the log of ESP you can see what is beeing send, is there sometimes an extra space or weird caracter in the text sent to line 4?
I have a lcd2004 display that will stop displaying a line of text if a space is send. So 'hello%20world' outputs in log 'hello world' but displays 'hello'.
The proper way to handle that is by quoting the text to be put on the display, using f.e.: lcd,4,12,"hello world"
See https://github.com/letscontrolit/ESPEasy/issues/2724
/Ton (PayPal.me)

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#12 Post by Blatzi » 19 Jan 2023, 09:14

Hi, Thank you for giving me the hint for the log file.

But here I see things, I can't explain:

WD : Uptime 3038 ConnectFailures 143 FreeMem 18344 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init This comes sometimes. Is it a reconnect because of WD (Watchdog?) I don't know, why this wil happen. But, I saw this is not the reason for my problem.

I wrote behind some lines, if it was transfered correctly. It is always the last line - before after few seconds a new transmit is started.
I can see, that the line for the value was not transmited. Due to this it will be not displayed. But why this happens and why it happens only in line 4. I don't now (I never saw missing values at any other lines)


182698105: HTTP: lcd,3,10,88.6%
182698161: HTTP: lcd,3,17,82%
182698207: HTTP: lcd,4,1,Feuchtediff
182698407: HTTP: lcd,4,13,4.9g/qm
182707792: HTTP: lcd,1,1,BKW
182707865: HTTP: lcd,1,12,30.7�W
182707904: HTTP: lcd,2,1,Temp:
182707963: HTTP: lcd,2,7,11.1�C
182708012: HTTP: lcd,2,15,0.2�C
182708063: HTTP: lcd,3,1,Feuchte:
182708122: HTTP: lcd,3,10,88.6%
182708177: HTTP: lcd,3,17,82%
182708222: HTTP: lcd,4,1,Feuchtediff
182708279: HTTP: lcd,4,13,4.9g/qm OK
182713746: WD : Uptime 3045 ConnectFailures 143 FreeMem 18344 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
182717829: HTTP: lcd,1,1,BKW
182717898: HTTP: lcd,1,12,30.7�W
182717940: HTTP: lcd,2,1,Temp:
182718000: HTTP: lcd,2,7,11.1�C
182718047: HTTP: lcd,2,15,0.2�C
182718081: HTTP: lcd,3,1,Feuchte:
182718139: HTTP: lcd,3,10,88.6%
182718197: HTTP: lcd,3,17,82%
182718241: HTTP: lcd,4,13,4.9g/qm
182718435: HTTP: lcd,4,1,Feuchtediff After this line, the value is missing
182727785: HTTP: lcd,1,1,BKW new transfer
182727851: HTTP: lcd,1,12,30.7�W
182727891: HTTP: lcd,2,1,Temp:
182727953: HTTP: lcd,2,7,11.1�C
182727999: HTTP: lcd,2,15,0.2�C
182728035: HTTP: lcd,3,1,Feuchte:
182728094: HTTP: lcd,3,10,88.6%
182728153: HTTP: lcd,3,17,82%
182728201: HTTP: lcd,4,1,Feuchtediff
182728258: HTTP: lcd,4,13,4.9g/qm OK
182737792: HTTP: lcdcmd,clear
182737826: HTTP: lcd,1,1,BKW
182737892: HTTP: lcd,1,12,33.2�W
182737934: HTTP: lcd,2,1,Temp:
182737990: HTTP: lcd,2,7,11.1�C
182738038: HTTP: lcd,2,15,0.2�C
182738074: HTTP: lcd,3,1,Feuchte:
182738131: HTTP: lcd,3,10,88.6%
182738185: HTTP: lcd,3,17,82%
182738230: HTTP: lcd,4,1,Feuchtediff
182738286: HTTP: lcd,4,13,4.9g/qm OK

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#13 Post by Ath » 19 Jan 2023, 09:57

Blatzi wrote: 19 Jan 2023, 09:14 But here I see things, I can't explain:

WD : Uptime 3038 ConnectFailures 143 FreeMem 18344 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init This comes sometimes. Is it a reconnect because of WD (Watchdog?) I don't know, why this wil happen. But, I saw this is not the reason for my problem.
That message will come every 30 seconds if the log level is set to INFO or more detailed
Blatzi wrote: 19 Jan 2023, 09:14 182718241: HTTP: lcd,4,13,4.9g/qm
182718435: HTTP: lcd,4,1,Feuchtediff After this line, the value is missing
This has to do with the order of the data being sent (look at the time-stamp, msec from boot), the data is sent before the label, and writing the label will wipe out the rest of the line...
The cause is most likely the asynchronous way the http messages are sent from IOBroker.

A (the?) solution would be to concatenate the label and the value for each line, probably including a space so quotes should be added around that part as mentioned earlier, so it will only be 1 http request per line.

Don't know the exact syntax, but it could be something like this

Code: Select all

  try {
    require("request")((['http://192.168.178.173/control?cmd=lcd,4,1,"Feuchtediff ',Absfeuchteresult,'g/qm"'].join(''))).on("error", function (e) {console.error(e);});
  } catch (e) { console.error(e); }
(The second ...=lcd,4... section should be disabled/deleted)
Edit:
Similar concatenations should be done for lines 1..3, just to lower traffic/load on ESPEasy and IOBroker.
/Ton (PayPal.me)

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#14 Post by Blatzi » 19 Jan 2023, 11:02

Yes, thank you so much. I have not seen before, that the value was send befor. Yes, this will swipe the value.

I have now done it in one line with gaps between and it works.

Thanks a lot.

RonkA
Normal user
Posts: 10
Joined: 07 Jan 2023, 02:58
Location: The Netherlands

Re: LCD 2004 display problem at line 4

#15 Post by RonkA » 19 Jan 2023, 11:08


The proper way to handle that is by quoting the text to be put on the display, using f.e.: lcd,4,12,"hello world"
See https://github.com/letscontrolit/ESPEasy/issues/2724
Sorry, You are right, for standard coding its double quotes, only if you use dzVents its wrong, its single qoutes.. :D

@Blatzi: F.Y.I. My lcd2004 display can not handle <%20> for a space caracter, i have to use <%FE> to get this to work.

Blatzi
New user
Posts: 8
Joined: 16 Jan 2023, 07:42

Re: LCD 2004 display problem at line 4

#16 Post by Blatzi » 19 Jan 2023, 11:19

I have used %A0 for the space and it works

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#17 Post by Ath » 19 Jan 2023, 11:34

My example should have the correct quotes to be handled by ESPEasy, and allowed by Javascript.

The link to the Github issue explains exactly what quotes can/should be used, the double quotes I gave as an example is only 1 of 3 supported quote types (double quote, single quote, back-tick), as long as the starting and ending quote are the same.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3494
Joined: 10 Jun 2018, 12:06
Location: NL

Re: LCD 2004 display problem at line 4

#18 Post by Ath » 19 Jan 2023, 11:37

RonkA wrote: 19 Jan 2023, 11:08 My lcd2004 display can not handle <%20> for a space caracter, i have to use <%FE> to get this to work.
Url-encoding, like %20, is only used when calling/sending via HTTP, when used in rules a regular space character should be used (and quotes around the entire string to display, as explained above)
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 74 guests