Add sensor name prefix. Fix #20. Add Toast command

This commit is contained in:
2019-10-03 15:26:54 +02:00
parent 98f2797aa1
commit eaed9cd8d9
6 changed files with 40 additions and 5 deletions

View File

@@ -126,6 +126,9 @@ class BrowserMod {
this.mute(msg);
break;
case "toast":
this.toast(msg);
break;
case "popup":
this.popup(msg);
break;
@@ -208,6 +211,15 @@ class BrowserMod {
this.player.muted = Boolean(msg.mute)
}
toast(msg) {
if(!msg.message) return;
fireEvent("hass-notification", {
message: msg.message,
duration: msg.duration !== undefined ? parseInt(msg.duration) : undefined
}, document.querySelector("home-assistant"));
}
popup(msg){
if(!msg.title && !msg.auto_close) return;
if(!msg.card) return;