Modifying domoticz Last Seen status - changing js script

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
blazej222
Posts: 5
Joined: Thursday 21 March 2019 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Modifying domoticz Last Seen status - changing js script

Post by blazej222 »

Hi.I'm trying to modify domoticz website so
1) in place of field Last Seen of tab switches it would return either OFF status or device uptime (not overall - just time since it was powered on during this particular "session").
2) The overall time of device power on time would be stored somewhere and alert would be shown after device has worked for 1000 hrs(lets say a lifespan of a light bulb).
I have no idea where I should look for a script that is responsible for what is shown in Last Seen field.
I've found script called domoticzdevices.js and the following piece of code inside:

Code: Select all

            var gText = makeSVGnode('text', { id: "lastseen", x: 0, y: Device.elementPadding * 7.5, 'font-size': '80%' }, '');
            gStatusGroup.appendChild(gText);
            gText.appendChild(makeSVGnode('tspan', { id: "lastlabel", 'font-style': 'italic', 'font-size': '80%' }, $.t('Last Seen')));
            gText.appendChild(makeSVGnode('tspan', { id: "lastlabel", 'font-style': 'italic', 'font-size': '80%' }, ':'));
            gText.appendChild(makeSVGnode('tspan', { id: "lastupdate", 'font-size': '80%' }, ' ' + this.lastupdate));
However, when I modify anything there it seems to have no effect - even if I change "Last Seen" title, after refreshing page it's still the same.
I've been looking for "Last Seen" and "lastupdate" with grep - and domoticzdevices.js seemed to be the most logical name for a script that returns lastupdate time.

I'd be very, very thankful for any help in modifying this website - it's very important to me to get it done :)
SweetPants

Re: Modifying domoticz Last Seen status - changing js script

Post by SweetPants »

You have to reload the app cache before changes take effect. refreshing browser cache is not enough
blazej222
Posts: 5
Joined: Thursday 21 March 2019 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Modifying domoticz Last Seen status - changing js script

Post by blazej222 »

How do I reload the app cache? I've tried exiting and starting again domoticz binary - it doesn't work.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Modifying domoticz Last Seen status - changing js script

Post by waaren »

blazej222 wrote: Monday 06 May 2019 0:24 How do I reload the app cache? I've tried exiting and starting again domoticz binary - it doesn't work.
- clear browser appcache
Chrome: chrome://appcache-internals/#
Firefox: https://support.mozilla.org/en-US/kb/storage
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
gizmocuz
Posts: 2541
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Modifying domoticz Last Seen status - changing js script

Post by gizmocuz »

If you would like to modify the HTTP code it is best to launch domoticz from the commandline with the option -nocache

./domoticz -nocache

then clear the browser cache + appcache

from now on, there will be no more caching and you can edit the HTML
Quality outlives Quantity!
blazej222
Posts: 5
Joined: Thursday 21 March 2019 20:33
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

Re: Modifying domoticz Last Seen status - changing js script

Post by blazej222 »

Thanks for all sugestions, they definitely help a lot when working with html and js code. However, I've searched through whole domoticz directory using grep (to be precise, grepWin and AgentRansack since I've tried doing it on RPI and Windows.) Unfortunately, both programs find some css files and js files - but changing any of the files doesn't really do anything. I've also tried changing domoticz language - the fun fact is,after changing language to Polish and searching domoticz files for Polish strings that appear on screen, there's no results. It seems domoticz doesn't store translations with all the files - or I am doing something wrong. Does anybody have any idea how I could search domoticz files for the strings I am looking for ( and most important - how do I change the "Last Seen" text?)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest