nest.class.php
public function getDevices($type = DEVICE_TYPE_THERMOSTAT) {
        $this->prepareForGet();
        if ($type == DEVICE_TYPE_PROTECT) {
            $protects = array();
            $topaz = isset($this->last_status->topaz) ? $this->last_status->topaz : array();
            foreach ($topaz as $protect) {
                $protects[] = $protect->serial_number;
            }
            return $protects;
        }
        $devices_serials = array();
        foreach ($this->last_status->user->{$this->userid}->structures as $structure) {
            list(, $structure_id) = explode('.', $structure);
            foreach ($this->last_status->structure->{$structure_id}->devices as $device) {
                list(, $device_serial) = explode('.', $device);
                $devices_serials[] = $device_serial;
            }
        }
        return $devices_serials;
    }
public function getDevices($type = DEVICE_TYPE_THERMOSTAT) {
        $this->prepareForGet();
        if ($type == DEVICE_TYPE_PROTECT) {
            $protects = array();
            $topaz = isset($this->last_status->topaz) ? $this->last_status->topaz : array();
            foreach ($topaz as $protect) {
                $protects[] = $protect->serial_number;
            }
            return $protects;
        }
        $devices_serials = array();
        foreach ($this->last_status->user->{$this->userid}->structures as $structure) {
            list(, $structure_id) = explode('.', $structure);
            foreach ($this->last_status->structure->{$structure_id}->devices as $device) {
                list(, $device_serial) = explode('.', $device);
                $devices_serials[] = $device_serial;
            }
        }
        return $devices_serials;
    }
public function getDevices ( $ type = DEVICE_TYPE_THERMOSTAT ) { $ this -> prepareForGet ( ) ; if ( $ type == DEVICE_TYPE_PROTECT ) { $ protects = array ( ) ; $ topaz = isset ( $ this -> last_status -> topaz ) ? $ this -> last_status -> topaz : array ( ) ; foreach ( $ topaz as $ protect ) { $ protects [ ] = $ protect -> serial_number ; } return $ protects ; } $ devices_serials = array ( ) ; foreach ( $ this -> last_status -> user -> { $ this -> userid } -> structures as $ structure ) { list ( , $ structure_id ) = explode ( '.' , $ structure ) ; foreach ( $ this -> last_status -> structure -> { $ structure_id } -> devices as $ device ) { list ( , $ device_serial ) = explode ( '.' , $ device ) ; $ devices_serials [ ] = $ device_serial ; } } return $ devices_serials ; }
Get all the devices of a specific type from the user's account.

@param string $type DEVICE_TYPE_THERMOSTAT or DEVICE_TYPE_PROTECT.

@return array Devices
Get all the devices of a specific type from the user s account .