Add sensor name prefix. Fix #20. Add Toast command
This commit is contained in:
12
js/main.js
12
js/main.js
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user