1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Added last sync timestamp for everyone

This commit is contained in:
Jon Ziebell 2023-12-14 19:08:41 -05:00
parent c81ae3d8d8
commit 0eab6c4bee

View File

@ -529,29 +529,47 @@ beestat.component.card.system.prototype.get_subtitle_ = function() {
if (ecobee_thermostat.settings.hvacMode !== 'off') { if (ecobee_thermostat.settings.hvacMode !== 'off') {
if (override === true) { if (override === true) {
subtitle += ' / Overridden'; subtitle += ' Overridden';
} else { } else {
subtitle += ' / Schedule'; subtitle += ' Schedule';
} }
} }
if (ecobee_thermostat.settings.hvacMode === 'auto') { if (ecobee_thermostat.settings.hvacMode === 'auto') {
subtitle += ' / ' + heat + ' - ' + cool; subtitle += ' ' + heat + ' - ' + cool;
} else if ( } else if (
ecobee_thermostat.settings.hvacMode === 'heat' || ecobee_thermostat.settings.hvacMode === 'heat' ||
ecobee_thermostat.settings.hvacMode === 'auxHeatOnly' ecobee_thermostat.settings.hvacMode === 'auxHeatOnly'
) { ) {
subtitle += ' / ' + heat; subtitle += ' ' + heat;
} else if ( } else if (
ecobee_thermostat.settings.hvacMode === 'cool' ecobee_thermostat.settings.hvacMode === 'cool'
) { ) {
subtitle += ' / ' + cool; subtitle += ' ' + cool;
} }
if (beestat.user.has_early_access() === true) { const last_synced_on_m =
subtitle += ' @ ' + moment.utc(ecobee_thermostat.runtime.lastStatusModified).local() moment.utc(beestat.user.get().sync_status.thermostat).local();
.format('h:mm a');
const data_as_of_m =
moment.utc(ecobee_thermostat.runtime.lastStatusModified).local();
// Include the date if the sync gets more than 3 hours behind.
let format;
if (moment().diff(data_as_of_m, 'minutes') > 180) {
format = 'MMM Do [at] h:mm a';
} else {
format = 'h:mm a';
} }
subtitle +=
'<br/><span title="Last sync: ' +
last_synced_on_m.format(format) +
'" style="color: ' +
beestat.style.color.gray.dark +
'">As of ' +
data_as_of_m.format(format) +
'</span>';
return subtitle; return subtitle;
}; };