Skip to content

Commit

Permalink
Merge pull request #67 from ToBiDi0410/master
Browse files Browse the repository at this point in the history
Added 'last_updated' and 'last_changed' into Title Variables
  • Loading branch information
cgiesche committed Dec 30, 2021
2 parents e365faa + 56de9dc commit 9785765
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Plugin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ export default {
changedContexts.forEach(context => {
try {
if(stateMessage.last_updated != null) stateMessage.attributes["last_updated"] = new Date(stateMessage.last_updated).toLocaleTimeString();
if(stateMessage.last_changed != null) stateMessage.attributes["last_changed"] = new Date(stateMessage.last_changed).toLocaleTimeString();
updateContextState(context, entity, stateMessage);
} catch (e) {
console.error(e)
Expand Down Expand Up @@ -205,6 +208,7 @@ export default {
if (contextSettings.useCustomTitle) {
let state = stateObject.state;
let stateAttributes = stateObject.attributes;
const customTitle = nunjucks.renderString(contextSettings.buttonTitle, {...{state}, ...stateAttributes})
this.$SD.setTitle(currentContext, customTitle);
}
Expand Down

0 comments on commit 9785765

Please sign in to comment.