Skip to content

Commit

Permalink
Merge pull request #3 from cgiesche/streamdeck-homeassistant-1
Browse files Browse the repository at this point in the history
Added missing fallback label-templates for default sensor.
  • Loading branch information
cgiesche authored Feb 3, 2021
2 parents 16eebd5 + 1b1dc8f commit 0d27f06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# streamdeck-homeassistant
The aim of this project is to allow owners of an eglato StreamDeck to control their entities or display sensor data via
The aim of this project is to allow owners of an elgato StreamDeck to control their entities or display sensor data via
their StreamDeck. As the code is kept very generic, nearly every sensor should work out of the box as well as every
service that does not need any more information but the entity id.

Expand Down
6 changes: 3 additions & 3 deletions src/modules/plugin/imageUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const IconFactory = {
},

default: (state, attributes, labelTemplate) => {
return Icon.labelledIcon(state, attributes, labelTemplate)
return Icon.labelledIcon(state, attributes, labelTemplate || IconFactory.sensor._defaultLabelTemplate)
}
}

Expand Down Expand Up @@ -217,8 +217,8 @@ const Icon = {
return `<g fill="${colors.bg}" transform="translate(24,6) scale(4,4)">${weatherIcon}</g>`
},

labelledIcon: (state, attributes, templates, image = "", labelTopOffset = 30) => {
const line1 = new Handlebars.compile(templates.line1)({...{state}, ...attributes, ...{colors}})
labelledIcon: (state, attributes, templates = {}, image = "", labelTopOffset = 30) => {
const line1 = new Handlebars.compile(templates.line1 || "{{state}}")({...{state}, ...attributes, ...{colors}})
const line2 = new Handlebars.compile(templates.line2 || "")({...{state}, ...attributes, ...{colors}})
const line3 = new Handlebars.compile(templates.line3 || "")({...{state}, ...attributes, ...{colors}})

Expand Down

0 comments on commit 0d27f06

Please sign in to comment.