refreshCurrentStatus() {
        if (this.token.timestamp + this.token.expires_in < (new Date()).getTime() / 1000) {
            this.refreshToken();
        }
        let options = {
            method: "GET",
            headers: {
                "accept": "application/vnd.bsh.sdk.v1+json",
                "Accept-Language": "en-GB",
                "authorization": "Bearer " + this.token.access_token
            }
        };

        let self = this;
        request("https://api.home-connect.com/api/homeappliances/" + this.config.haId, options,
            (err, res, body) => {
                let result = JSON.parse(body);
                if (!result.data.connected) self.setStatus(Status.Disconnected);
            });


        request("https://api.home-connect.com/api/homeappliances/" + this.config.haId + "/status", options,
            (err, res, body) => {
                let result = JSON.parse(body);
                try {
                    let state = result.data.status[2].displayvalue;
                    if (state === "Inactive") {
                        self.log("Current state is inactive");
                        self.setStatus(Status.Inactive);
                    } else if (state === "Ready") {
                        self.log("Current state is Running");
                        self.setStatus(Status.Running);
                    } else {
                        self.log("Current state is unknown");
                        self.log(body);
                    }
                } catch (e) {
                    this.log("Unexpected response from result: " + result);
                    self.setStatus(Status.Disconnected);
                }
            });
    }
/**
     * Queries the current state from the API. DO NOT USE THIS ITERATIVELY, API CALLS ARE LIMITED.
     * Only used at init time to get current state of device. For subsequent information about state
     * use processEvents function.
     * */
Queries the current state from the API. DO NOT USE THIS ITERATIVELY, API CALLS ARE LIMITED.
Only used at init time to get current state of device. For subsequent information about state
use processEvents function.
Queries the current state from the API . DO NOT USE THIS ITERATIVELY API CALLS ARE LIMITED . Only used at init time to get current state of device . For subsequent information about state use processEvents function .
refreshCurrentStatus() {
        if (this.token.timestamp + this.token.expires_in < (new Date()).getTime() / 1000) {
            this.refreshToken();
        }
        let options = {
            method: "GET",
            headers: {
                "accept": "application/vnd.bsh.sdk.v1+json",
                "Accept-Language": "en-GB",
                "authorization": "Bearer " + this.token.access_token
            }
        };
        let self = this;
        request("https://api.home-connect.com/api/homeappliances/" + this.config.haId, options,
            (err, res, body) => {
                let result = JSON.parse(body);
                if (!result.data.connected) self.setStatus(Status.Disconnected);
            });
        request("https://api.home-connect.com/api/homeappliances/" + this.config.haId + "/status", options,
            (err, res, body) => {
                let result = JSON.parse(body);
                try {
                    let state = result.data.status[2].displayvalue;
                    if (state === "Inactive") {
                        self.log("Current state is inactive");
                        self.setStatus(Status.Inactive);
                    } else if (state === "Ready") {
                        self.log("Current state is Running");
                        self.setStatus(Status.Running);
                    } else {
                        self.log("Current state is unknown");
                        self.log(body);
                    }
                } catch (e) {
                    this.log("Unexpected response from result: " + result);
                    self.setStatus(Status.Disconnected);
                }
            });
    }
refreshCurrentStatus ( ) { if ( this . token . timestamp + this . token . expires_in < ( new Date ( ) ) . getTime ( ) / 1000 ) { this . refreshToken ( ) ; } let options = { method : "GET" , headers : { "accept" : "application/vnd.bsh.sdk.v1+json" , "Accept-Language" : "en-GB" , "authorization" : "Bearer " + this . token . access_token } } ; let self = this ; request ( "https://api.home-connect.com/api/homeappliances/" + this . config . haId , options , ( err , res , body ) => { let result = JSON . parse ( body ) ; if ( ! result . data . connected ) self . setStatus ( Status . Disconnected ) ; } ) ; request ( "https://api.home-connect.com/api/homeappliances/" + this . config . haId + "/status" , options , ( err , res , body ) => { let result = JSON . parse ( body ) ; try { let state = result . data . status [ 2 ] . displayvalue ; if ( state === "Inactive" ) { self . log ( "Current state is inactive" ) ; self . setStatus ( Status . Inactive ) ; } else if ( state === "Ready" ) { self . log ( "Current state is Running" ) ; self . setStatus ( Status . Running ) ; } else { self . log ( "Current state is unknown" ) ; self . log ( body ) ; } } catch ( e ) { this . log ( "Unexpected response from result: " + result ) ; self . setStatus ( Status . Disconnected ) ; } } ) ; }
Queries the current state from the API.
Queries the current state from the API .