Frontail custom theme coloring

That sounds good, then I don’t have to change anything in my processes and the containers are built automatically when there are changes. Thanks again for your work.

Minor issue with regex in openhab_AEM.json.

I’m running openHABian v1.6.5 on a RPi3:

###############################################################################
###############  openhab  #####################################################
###############################################################################
##        Ip = 192.168.1.17
##   Release = Raspbian GNU/Linux 10 (buster)
##    Kernel = Linux 5.10.17-v7+
##  Platform = Raspberry Pi 3 Model B Rev 1.2
...
###############################################################################

openhabian@openhab:~ $ openhab-cli info

Version:     3.0.2 (Build)


When an item changes to or from “nothing”, like this (/var/log/openhab/events.log):

2021-05-28 23:03:21.678 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FlircRemote_KeyEvent' changed from  to KEY_ENTER
2021-05-28 23:03:21.682 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FlircRemote_Key_Enter' changed from OPEN to CLOSED
2021-05-28 23:03:21.685 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FlircRemote_KeyEvent' changed from KEY_ENTER to


frontail renders it like this:

 class="date">2021-05-28 23:03:21.678 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FlircRemote_KeyEvent' changed from  to KEY_ENTER
2021-05-28 23:03:21.682 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FlircRemote_Key_Enter' changed from OPEN to CLOSED
 class="date">2021-05-28 23:03:21.685 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'FlircRemote_KeyEvent' changed from KEY_ENTER to 


A small change in /opt/frontail/preset/openhab_AEM.json:

FROM:

  "wordsRegExMatchClass": {
    "Item '(.*?)'": "highlight",
    "model '(.*?)'": "highlight",
    "through (.*)": "highlight",
    "through</span> (.*)": "highlight",
    "from(\\s.*?) to": "afterFrom",     <--- CHANGE THIS
    " to(\\s.*)": "afterTo"             <--- CHANGE THIS
  },

TO:

  "wordsRegExMatchClass": {
    "Item '(.*?)'": "highlight",
    "model '(.*?)'": "highlight",
    "through (.*)": "highlight",
    "through</span> (.*)": "highlight",
    "from (.*?) to": "afterFrom",       <--- TO THIS
    " to (.*)": "afterTo"               <--- TO THIS
  },

seems to solve the problem.

This may not be the correct way to solve it, but it works for me…

Hmmm, I think I created a new problem…

Since the match no longer includes the space, I get problems with this one:

2021-05-29 20:18:59.177 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OpenHAB_Sensor_CPUTemp' changed from 59.1 to 57.5

The “from” is here matched as “59.1”, but unfortunately, the timestamp also includes 59.1 and therefor the 59.1 in the timestamp is highlighted instead of the temperature.

So, my suggestion above doesn’t work…

Hello @magnuslsjoberg

First check: are you sure you have the latest version of the json? Because your json seems different from the one available here, which is the one openHABian 1.6.4 or later should install.

I remember adding the spaces in the regEx because i was experiencing exactly the same glitch with the date. But later on I changed the approach adding new classes which I don’t see in your json.

In case the problem persists with the latest version of frontail_AEM I will digg the case you pointed out (when an item changes to or from “nothing”). In that case, can you confirm you have 2 spaces between the “from” and “to” words? Can you copy/paste the html of the full line ( <div class="line">...</div> )?

Also, feel free to create an issue!

@AEM

Yes, two spaces (both in log and HTML)

With my change:

<div class="line"><p class="inner-line"><span class="afterFrom"></span><span class="date">2021-05-29 20:54:54.913</span> <span class="type info">[INFO ]</span> <span class="origin"><span class="origin">[openhab.event.ItemStateChangedEvent ]</span></span> - Item '<span class="highlight">FlircRemote_KeyEvent</span>' changed from  to <span class="afterTo">KEY_ENTER</span></p></div>

With original regex:

<div class="line"><p class="inner-line"><span<span class="afterFrom"> class="date"&gt;2021-05-29 21:06:16.951 <span class="type info">[INFO ]</span> <span class="origin"><span class="origin">[openhab.event.ItemStateChangedEvent ]</span></span> - Item '<span class="highlight">FlircRemote_KeyEvent</span>' changed from  to<span class="afterTo"> KEY_ENTER</span></span<span></p></div>

I have not looked into what is happening under the hood and how these regexes re applied, but perhaps it would be possible to do more complete matches like (not tested at all!):

(from\\s.*?) to": "afterFrom"

Sorry I was editing my reply and you replied in the meanwhile!
Can you check if your json is updated? If it is not, reinstalling frontail through openhabian-config using menu 21 may fix the problem.

I see some classes missing in your HTML, e.g. .noKeyword or .marked ones.

OK, I will update and recheck!

I did a quick test on my openHABian, it seems to render correctly:

This is the HTML it outputs:

<div class="line">
	<p class="inner-line">
		<span class="date">2021-05-28 23:03:21.678</span> 
		<span class="type info">[INFO ]</span> 
		<span class="origin"><span class="origin">[openhab.event.ItemStateChangedEvent ]</span></span> - Item '<span class="highlight">FlircRemote_KeyEvent</span>' changed<span class="afterFrom marked"><span class="noKeyword from"> from</span> </span><span class="afterTo marked"><span class="noKeyword to"> to</span> KEY_ENTER</span>
	</p>
</div>

<div class="line">
	<p class="inner-line">
		<span class="date">2021-05-28 23:03:21.682</span> 
		<span class="type info">[INFO ]</span> 
		<span class="origin"><span class="origin">[openhab.event.ItemStateChangedEvent ]</span></span> - Item '<span class="highlight">FlircRemote_Key_Enter</span>' changed<span class="afterFrom marked"><span class="noKeyword from"> from</span><span class="keyword green open"> OPEN</span></span><span class="afterTo marked"><span class="noKeyword to"> to</span><span class="keyword red closed"> CLOSED</span></span>
	</p>
</div>

<div class="line">
	<p class="inner-line">
		<span class="date">2021-05-28 23:03:21.685</span> 
		<span class="type info">[INFO ]</span> 
		<span class="origin"><span class="origin">[openhab.event.ItemStateChangedEvent ]</span></span> - Item '<span class="highlight">FlircRemote_KeyEvent</span>' changed<span class="afterFrom marked"><span class="noKeyword from"> from</span> KEY_ENTER</span><span class="noKeyword to"> to</span>
	</p>
</div>
1 Like

Yes it does! Thanks a lot!

I just realised that the regexes are JavaScript and not python as I thought and perhaps they have different syntax.

Anyway I added a few more lines:

    "\\sreceived\\scommand\\s(\\S*)": "afterReceivedCommand marked",
    "\\sreceived\\scommand": "noKeyword received command",

    "\\striggered\\s(\\S*)": "afterTriggered marked",
    "\\striggered": "noKeyword triggered",

    "\\slx": "lux marked",

I also added:

    "\\[HABApp(.*?)\\]": "origin",

since I am a HABApp user.

Works really well now! Thanks again!

Happy to hear you solved!

Thank you for the additional lines, will test them and eventually implement specific css rules for the new classes you introduced.

Interesting thing is that no new CSS is required! I only added the lined above in openhab_AEM.json.

That’s because of the .marked, .noKeyword and .origin classes, which are already styled via css.

For example:

“\slx”: “lux marked”

adds 2 classes: .lux and .marked

So that element inherits the rules that are already defined for all .marked elements. It actually ignores the .lux class, since there are no rules defined. In other words it will be the same as:

“\slx”: “marked”

But having both classes is a good idea, you can take it farther, for example defining a rule for .lux.marked (meaning elements that have both classes). Let’s say you add this rule:

.lux.marked {color: green; }

So in this case the element style will be determined via css following this criteria:

  1. apply all .marked rules
  2. apply .lux.marked rules (eventually overriding the ones applied from .marked) -because these rules are more “specific”

So this element will be styled as all other .marked elements (in terms of font size, font weight, etc) but in green color.

Hello,

I am very interested in this frontail thing for openhab3.
Is this still alive? because I see that the git of @Schnuecks is not online anymore?
I am not a expert user but I understand the concepts of git, docker, docker-compose.
I’m actually searching for a solution to view my openhab3 logfile’s.

greetings

Hello at all,
the git repo is moved to GitHub - Schnuecks/frontail_AEM: 📝 streaming logs to the browser from there the current docker image is build if there are changes on the main repo from @AEM

To install the docker image use a docker-compose.yml examples are on the linked git page

Edit: edit the git repo in original posts

If you use openHABian then the updated theme for Frontail is installed by default.

This is very cool, thank you! Besides using it to highlight a few more lines than configured in your preset (ie all the info level logging from JSScripting), I have also just used it to hide some lines from the frontail view of my log that I do not want to see (as there is a bug in JSScripting that is currently spamming the log every time a particular function is called).
So just added a ‘noLine’ class to your css with display: none and then added a line in the preset.json to catch lines with the spam text, and presto, clean log again!

1 Like

Hi,
I made two themes: Light and Dark, which are based on the basic themes available in openhabian 3x.
I changed a little bit the color scheme and display of log items (e.g. I added highlights not only for Items but also for Rules and Things in different colors).
I replaced the colored text display with different background colors - it makes the logs more readable.

I corrected the display of INFO lines, which were displayed as error lines.
Maybe someone will like these themes. They are available in my github repository:

Hello, I’m brand new to the world of Docker.

I’ve been running Openhab 3.2 in a Docker container for a while. I noticed that frontail is missing. I reinstalled this. Unfortunately, I’m missing the colored highlighting of the individual lines. While searching I came across this thread.

So far I have tried in vain to get the “schnueks Frontail_aem” to run in a container. But already fail during the installation. If someone would be so kind and describe me in a beginner friendly way how to get the image to run in a Docker container on a Synology 218+?

Thank you in advance…

Gerhard

Can you share what errors you got?
You would normally just need to use the command shown in the github.
I can also share my docker-compose though if that helps.
You will need to make sure that you bind your OH container’s log folder to the host, so that you can then bind frontail to that folder as well to access the logs.

Hi Chris, thanks for your feedback.

I still don’t get any errors. My problem starts earlier…

Where do I have to enter which command?

As I have understood so far, I log in to my NAS via e.g. Putty. Here I can check if Docker Compose is installed at all.

I just don’t understand what to do with this .yaml file?