var genericCpt = require("./abstract/genericComponent.js");


function switch_onoff() {

    genericCpt.apply(this, arguments);//inherite 

    var me = this;

    var sensor_temperature = this.createSensor({
        sensorName: "temperature",
        desc: "Température",
        value: 0,
        unit : "°C",
        active : true
    });
    
    this.statusServer = sensor_temperature;

    this.check = function () {

        sensor_temperature.value = getRandomInt(50,250) / 10;

    };

    //inits
    //
    //adding the default route
    this.createMethod({
        route: "refresh",
        fn: function (req, res) {
            me.check();
        }
    });

}

util.inherits(switch_onoff, genericCpt);//apply inherit

module.exports = switch_onoff;