1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00
beestat/js/component/tile/thermostat.js
2023-11-15 06:48:13 -05:00

50 lines
1.0 KiB
JavaScript

/**
* A tile representing a thermostat.
*
* @param {number} thermostat_id
*/
beestat.component.tile.thermostat = function(thermostat_id) {
this.thermostat_id_ = thermostat_id;
beestat.component.tile.apply(this, arguments);
};
beestat.extend(beestat.component.tile.thermostat, beestat.component.tile);
/**
* Get the icon for this tile.
*
* @return {string} The icon.
*/
beestat.component.tile.thermostat.prototype.get_icon_ = function() {
return 'thermostat';
};
/**
* Get the text for this tile.
*
* @return {string} The first line of text.
*/
beestat.component.tile.thermostat.prototype.get_text_ = function() {
const thermostat = beestat.cache.thermostat[this.thermostat_id_];
const temperature = beestat.temperature({
'temperature': thermostat.temperature,
'round': 0,
'units': true
});
return [
thermostat.name,
temperature
];
};
/**
* Get the size of this tile.
*
* @return {string} The size of this tile.
*/
beestat.component.tile.thermostat.prototype.get_size_ = function() {
return 'large';
};