In other home automation systems I was always using a simple widget/module/app where text/label/message was updatable using an api call.
For instance an information string with cpu temp/temp/disk space etc (instead of using snmp), or the result of whatever push-button function/macro/script.
I have searched through the apps for text and label, but no app seems to have this.
Is there a better way in this framework perhaps? An app showing a message log?
Looking at the examples, I guess it might not be very tricky to create a new app for this purpose, but I am sure someone already did this.
text device, with api call for updating text
Re: text device, with api call for updating text
You can use the CodeDevice (or HTTPDevice) app to show temp, disc space, etc. You can also use InfoWidget and API to change it's text if you really need text only instead of number + scale units.
Re: text device, with api call for updating text
Thank you!
I made a module creating a vDev deviceType text. I wanted to use the Virtual Device API, and this seems to work.
// Create vdev
self.vDev = self.controller.devices.create({
deviceId: "LabelDevice_" + this.id,
// contains initial values for UI when module is created
defaults: {
metrics: {
title: self.config.wtitle,
text: self.langFile.v_text
}
}, // defaults
// how module is presented in UI
overlay: {
deviceType: 'text'
}, // overlay
handler: function(command, args) {
if (command === 'on' || command === 'off') {
return;
}
if (command === 'set' && args) {
console.log("command", command);
console.log("args", args);
if (args.title) {
this.set("metrics:title", args.title);
}
if (args.text) {
this.set("metrics:text", args.text);
}
}
}, // handler
moduleId: self.id
}); // self.vDev
Does the text deviceType support html in the text metric? I can see bold text in in the InfoWidget, so I guess some type of markup is supported.
I made a module creating a vDev deviceType text. I wanted to use the Virtual Device API, and this seems to work.
// Create vdev
self.vDev = self.controller.devices.create({
deviceId: "LabelDevice_" + this.id,
// contains initial values for UI when module is created
defaults: {
metrics: {
title: self.config.wtitle,
text: self.langFile.v_text
}
}, // defaults
// how module is presented in UI
overlay: {
deviceType: 'text'
}, // overlay
handler: function(command, args) {
if (command === 'on' || command === 'off') {
return;
}
if (command === 'set' && args) {
console.log("command", command);
console.log("args", args);
if (args.title) {
this.set("metrics:title", args.title);
}
if (args.text) {
this.set("metrics:text", args.text);
}
}
}, // handler
moduleId: self.id
}); // self.vDev
Does the text deviceType support html in the text metric? I can see bold text in in the InfoWidget, so I guess some type of markup is supported.
Re: text device, with api call for updating text
yes, it seems to support html
markup is stripped when using the GUI api information, but it works
markup is stripped when using the GUI api information, but it works