Page 1 of 1

alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:01
by JuanUil
Hi all,

is there a way to change the alignment in a dummy text device in LUA?
I would also like to change the color of the text is that possible?

Thank you for any help

Juan

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:02
by freijn
I believe the sensor does accept html format. try that.

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:05
by JuanUil
freijn wrote: Sunday 13 January 2019 17:02 I believe the sensor does accept html format. try that.
and how do you do that in LUA?

sorry a newbie in programming :o

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:09
by freijn
Try this in your " <font color="red">This is some text!</font>"

not sure thought... sorry..

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:25
by jvdz
That indeed works fine. :)

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:34
by JuanUil
So for instance
meldtekst= <font color="red">Dit is een melding</font>
should work?

this gives me a fault unexpeted symbol near <

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:43
by jvdz
JuanUil wrote: Sunday 13 January 2019 17:34 So for instance
meldtekst= <font color="red">Dit is een melding</font>
should work?
That should be: meldtekst= '<font color="red">Dit is een melding</font>'

Jos

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 17:52
by JuanUil
No, not working.
Jos I use this in the afvalwijzer.
I now get the <fontcolor> in the text device

Code: Select all

txt ='<font color="red">txt..web_afvaldate .. " = " .. web_afvaltype .. "\r\n"</font>'

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 18:12
by jvdz
Yes, that won't work. ;)
Try this version:

Code: Select all

                     txt = txt..'<font color="red">'..web_afvaldate .. " = " .. web_afvaltype .. "</font>'\r\n"
Jos

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 22:16
by JuanUil
nope, now I get

Code: Select all

<font color="red">vr 18 jan = Plastic, Metaal en Drankkartons</font>' <font color="red">vr 18 jan = GFT</font>'

Re: alignment of text in a dummy text device

Posted: Sunday 13 January 2019 22:52
by jvdz
I've just actually tried it with a text sensor and worked fine for me.
Knipsel.PNG
Knipsel.PNG (14.59 KiB) Viewed 1587 times
How does it look for you?

ps: I do see there is an single quote too many at the end, so the line should be:

Code: Select all

                     txt = txt..'<font color="red">'..web_afvaldate .. " = " .. web_afvaltype .. "</font>\r\n"
Jos

Re: alignment of text in a dummy text device

Posted: Monday 14 January 2019 19:17
by JuanUil
Hoi Jos,

I now get in the TAB others the right format.
Knipsel1.JPG
Knipsel1.JPG (20.12 KiB) Viewed 1563 times
but I also placed the textbox on my floorplan.
here I get
Knipsel.JPG
Knipsel.JPG (23.66 KiB) Viewed 1563 times
So the alignment is crap and the color is not coming over.

Re: alignment of text in a dummy text device

Posted: Tuesday 15 January 2019 15:08
by JuanUil
no Idea why the textbox on the floorplan is different then in devices

Re: alignment of text in a dummy text device

Posted: Tuesday 15 January 2019 15:34
by jvdz
I don't know either, I am not using àny floor plans, but guess the text isn't treated as regular HTML in the floorplan, unlike the Text sensor text display.
Maybe somebody knows.
JOs

Re: alignment of text in a dummy text device

Posted: Wednesday 16 January 2019 16:00
by JuanUil
Anybody who can help me further with this.
any help is very appreciated.

Re: alignment of text in a dummy text device

Posted: Saturday 19 January 2019 11:36
by JuanUil
Nobody? :o :o